The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Re: [mg4898] Transformation rule exercise
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
hall robert

Posts: 10
Registered: 12/7/04
Re: [mg4898] Transformation rule exercise
Posted: Oct 9, 1996 2:06 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Subject: Re: [mg4898] Transformation rule exercise
Newsgroups: comp.soft-sys.math.mathematica
In-Reply-To: <53a61p$>
Organization: University of Maryland, Baltimore County

In article <53a61p$> you write:
>> Date: Fri, 4 Oct 1996 00:17:36 -0400
>> From: (hall robert)
>> To:
>> Subject: [mg4898] Transformation rule exercise
>> ... exercise 4 from p. 113 of
>> Introduction to Programming with Mathematica, by Gaylord, Kamin & Wellin.
>> The problem is to rewrite
>> g[x_] = x /. Plus[z___] -> Times[z]
>> so that
>> g[a + b + c]
>> returns
>> a b c
>> I'm looking for a solution to which the
>> authors' hint applies...

>I'm not sure what if the following is what you are looking for.
>g[x_] := ReleaseHold[ Hold[ Plus[3,4,5] ] /. Plus->Times]

Specified input is "a + b + c", specified output is "a b c".
g[a + b + c]

Nope, that's not it.

Rewriting g[] so that x appears in the lhs;
g[x_] := ReleaseHold[Hold[x] /. Plus -> Times]
g[a + b + c]
a b c

But ReleaseHold[] and Hold[] are unnecessary. One of my
original solutions was
g[x_] := x /. Plus -> Times
g[a + b + c]
a b c

Thanks to all who emailed responses, but I think we're wasting
our time. I think there's a typo in either the
problem or the hint. The two don't seem to be related.

Bob Hall | "Know thyself? Absurd direction! | Bubbles bear no introspection." -Khushhal Khan Khatak

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.