MathGroup Archive 2007

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

Search the Archive

Re: Converting a number back to a symbol?


"AES" <siegman at stanford.edu> schrieb im Newsbeitrag 
news:fgenct$fsd$1 at smc.vnet.net...
> If we have an expression containing integer powers of the symbol u0 
> and
> we know that u0's numerical value is (or at least eventually will be) 
> u0
> = Pi/2, we know what happens if we write
>
>   expr /. {u0 -> Pi/2}
>
> 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?
>

I don't see the problem:

Here's an example (Pi is always being entered from the keyboard using 
the sequence ESC p ESC)
In[1]:=
a = 2 \[Pi] (* entered with ESC p ESC *)
Out[1]=
2*Pi
In[4]:=
a /. {Pi -> pu}
Out[4]=
2*pu

Cheers,
Wolfgang







  • Prev by Date: Eliminate items in q equation.
  • Next by Date: Re: Displaying graphics with the MathKernel in OS X
  • Previous by thread: Re: Converting a number back to a symbol?
  • Next by thread: Re: Converting a number back to a symbol?