Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Using two bars (//.)' topicStudent Support Forum > General > Archives > "Using two bars (//.)"

Help | Reply To Topic
Author Comment/Response
Sinval Santos
04/24/04 2:09pm

radp[ex_,lista_]:=ex//.Power[x_/;(Re[Simplify[x//.lista]]>0&&Im[Simplify[x//.lista]]==0),Rational[p_,n_]]:>Abs[x]^(p/n)

In[1]:= ss=Sqrt[a + Sqrt[a]];
Applying the rule radp in ss

In[2]:=radp[ss, {a -> 2}]
Out[2]=Sqrt[Abs[Sqrt[a] + a]]

It didn't work well (it doesn't convert Sqrt[a]), same using two bars (/ /. )
Because?
It only works with MapAll

In[3]:=MapAll[radp[#, {a -> 2}]&,ss]
Out[3]=Sqrt[Abs[a + Sqrt[Abs[a]]]]

Is it possible to move for not using MapAll?
Thank you
Sinval



URL: ,
Help | Reply To Topic