MathGroup Archive 2007

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

Search the Archive

Re: Converting a number back to a symbol?


AES wrote:
> 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?
> 

Can you give a full, evaluatable example?

It works for me:

In[1]:= Plus@@(Pi^Range[3])
Out[1]= Pi + Pi^2 + Pi^3

In[2]:= % /. Pi->2u0
Out[2]= 2 u0 + 4 u0^2 + 8 u0^3

-- 
Szabolcs


  • Prev by Date: Re: Re: Re: Setting Negatives to Zero
  • Next by Date: Re: Help on drawing intervals
  • Previous by thread: Re: Re: Mathematica 6 Graphics Options
  • Next by thread: Re: Converting a number back to a symbol?