Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

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

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

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

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

In article <53a61p$noo@dragonfly.wolfram.com> you write:
>> Date: Fri, 4 Oct 1996 00:17:36 -0400
>> From: rhall2@umbc.edu (hall robert)
>> To: mathgroup@smc.vnet.net
>> 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!
rhall2@gl.umbc.edu | 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]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.