Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: Converting a number back to a symbol?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82918] Re: Converting a number back to a symbol?
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Sat, 3 Nov 2007 03:27:34 -0500 (EST)
  • References: <fgenct$fsd$1@smc.vnet.net>
  • Reply-to: "Dr. Wolfgang Hintze" <weh at snafu.de>

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