Re: Converting a number back to a symbol?

*To*: mathgroup at smc.vnet.net*Subject*: [mg82904] Re: Converting a number back to a symbol?*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Sat, 3 Nov 2007 03:20:22 -0500 (EST)*Organization*: The Open University, Milton Keynes, UK*References*: <fgenct$fsd$1@smc.vnet.net>

AES wrote: <snip> > But what about the reverse case: we have an expression containing > various integer powers of Pi, and we want to replace all the explicitly > appearing Pi's by 2 u0. Writing > > expr /. {Pi-> 2 u0} > > doesn't seem to do it. > > Is there a way? Please, could you give a concrete example where such a transformation does not work? In[1]:= expr = Pi + Pi^2 + Pi^3 + (Pi/2 + (Pi/2)^2 + (Pi/5)^3) + 1/(Pi + Pi^2 + Pi^3) Out[1]= 2 3 3 Pi 5 Pi 126 Pi 1 ---- + ----- + ------- + -------------- 2 4 125 2 3 Pi + Pi + Pi In[2]:= expr /. Pi -> 2 u0 Out[2]= 3 2 1008 u0 1 3 u0 + 5 u0 + -------- + -------------------- 125 2 3 2 u0 + 4 u0 + 8 u0 Regards, -- Jean-Marc