Re: Evaluating expressions in pure functions

• To: mathgroup at smc.vnet.net
• Subject: [mg28462] Re: Evaluating expressions in pure functions
• From: "Allan Hayes" <hay at haystack.demon.co.uk>
• Date: Fri, 20 Apr 2001 04:24:12 -0400 (EDT)
• References: <9bm576\$j3j@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Max,
Here are some techniques:

Evaluate/@(Exp[2*3*#]&)

E^(6*#1) &

{2*3+4,#}&/.x_Times:>RuleCondition[x]

{6+5,#1}&

{2*3+4*5,#}&/.x_Times:>RuleCondition[x]

{6+20,#1}&

[
(!) But note that RuleCondition is an internal symbol and is barely
documented:

?RuleCondition

RuleCondition is an internal symbol.

RuleCondition[a] is equivalent to RuleCondition[a,True]
]

To avoid evaluationg both the products, we can use

ReplacePart[{2*3+4*5, #}&,{2*3+3*4, #}&[[1,1,1]], {1,1,1}]

{6+4 5,#1}&

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Max Ulbrich" <ulbrich at biochem.mpg.de> wrote in message
news:9bm576\$j3j at smc.vnet.net...
> Hi,
>
> I have the following problem:
> I have a pure function with a product of numbers in it.
> Mathematica doesn't evaluate the product:
>
> Exp[2*3*#]&
>
> I just want to get
>
> Exp[6*#]&
>
> How can I make Mathematica do this?
> Thanks,
>
> Max
>
>

```

• Prev by Date: Re: plotting question
• Next by Date: AW: Rearrangement of a sequence into random order
• Previous by thread: Re: Evaluating expressions in pure functions
• Next by thread: Re: Evaluating expressions in pure functions