MathGroup Archive 2005

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

Search the Archive

Re: Unexpected non-evaluation problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63180] Re: Unexpected non-evaluation problem
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sat, 17 Dec 2005 03:46:13 -0500 (EST)
  • References: <dnrmp1$prb$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Bob,

That got me thinking if I could construct something that would behave in 
the same way:

flag=False;
foo[x_]:=x^2/;flag

ss = foo[x]
    foo[x]

flag=True;

ss
    foo[x]

{ss,foo[x]}
    {foo[x],x^2}

ToExpression[ToString[ss]]
    x^2

ss/. x->y
      y^2

I think expressions like that give a little glimpse at the inner 
workings of Mathematica. These system normally behaves as though it 
tried to evaluate expressions at every possible opportunity, but for 
efficiency reasons it obviously remembers when a sub expression is fully 
evaluated. The above code tricks it into thinking that the expression 
foo[x] is fully evaluated even when it isn't. It is interesting that the 
expression survives unchanged as part of a larger expression - it is 
only when the subexpression is changed with the ReplaceAll that 
Mathematica 'realises' its mistake!

I think something vaguely similar must be happening in the original 
fourier transform example.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: Derivate of Bessel function K
  • Next by Date: Simplifying results
  • Previous by thread: Re: Unexpected non-evaluation problem
  • Next by thread: 3d plot's of function's domain