MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Evaluating expressions in pure functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28459] Re: [mg28453] Evaluating expressions in pure functions
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Fri, 20 Apr 2001 04:24:10 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

on 01.4.19 4:26 PM, Max Ulbrich at ulbrich at biochem.mpg.de wrote:

> 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
> 
> 
> 

The reason why this happens is that

In[6]:=
Exp[2*3*#] & // FullForm

Out[6]//FullForm=
Function[Exp[Times[2, 3, Slot[1]]]]
and

In[7]:=
Attributes[Function]

Out[7]=
{HoldAll, Protected}


To overcome this you have to force Function to evaluate its arguments, e.g.

In[8]:=
Evaluate[Exp[2*3*#]] &

Out[8]=
 6 #1
E     &

The problem is, it seems rather quicker just to enter 6 in the first
place...
-- 
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/



  • Prev by Date: Re: Evaluating expressions in pure functions
  • Next by Date: Re: plotting question
  • Previous by thread: RE: Evaluating expressions in pure functions
  • Next by thread: Re: Evaluating expressions in pure functions