Re: Evaluating expressions in pure functions
- To: mathgroup at smc.vnet.net
- Subject: [mg28469] Re: [mg28453] Evaluating expressions in pure functions
- From: Ralph Benzinger <mma-l at endlos.org>
- Date: Fri, 20 Apr 2001 04:24:17 -0400 (EDT)
- References: <200104190726.DAA19470@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
> 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? Max, Function (and Sum) keep their arguments unevaluated, presumably to allow for non-standard simplification. In[1]:= Exp[2*3*#]& Out[1]= Exp[2 3 #1] & In[2]:= Attributes[Function] Out[2]= {HoldAll, Protected} This often gets in my way, though, so I simply remove the HoldAll attribute (or in the case of Sum, I replace it with HoldRest): In[3]:= ClearAttributes[Function, HoldAll] In[4]:= Exp[2*3*#] & 6 #1 Out[4]= E & HTH, Ralph -- Ralph Benzinger "This is my theory, it is mine, I own it, Cornell University and what it is, too." -- Ann Elk (Mrs.)
- References:
- Evaluating expressions in pure functions
- From: Max Ulbrich <ulbrich@biochem.mpg.de>
- Evaluating expressions in pure functions