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

MathGroup Archive 2010

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

Search the Archive

Re: Replacement Rule with Sqrt in denominator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113986] Re: Replacement Rule with Sqrt in denominator
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sat, 20 Nov 2010 06:10:54 -0500 (EST)

On 11/19/10 at 5:11 AM, tmatsoukas at me.com (Themis Matsoukas) wrote:

>This replacement rule works,

>Sqrt[-4 \[Zeta]^2 + (1 + \[Rho]^2)^2] /. Sqrt[-4 \[Zeta]^2 + (1
>+ \[Rho]^2)^2] -> G

>but this doesn't:

>1/Sqrt[-4 \[Zeta]^2 + (1 + \[Rho]^2)^2] /. Sqrt[-4 \[Zeta]^2 +
>(1 + \[Rho]^2)^2] -> G

>The only difference is that the quantity to be replaced is in the
>denominator. If I remove Sqrt from the replacement rule it will work
>but I don't understand why a square root in the denominator (but not
>in the numerator) causes the rule to fail.

It is essential to know Mathematica only does a replacement
where there is a literal match when applying replacement rules
and the match *must* to the form Mathematica uses to represent
the expression. Using FullForm

In[10]:= FullForm[1/Sqrt[-4 \[Zeta]^2 + (1 + \[Rho]^2)^2]]

Out[10]//FullForm= Power[Plus[Times[-4,Power[\[Zeta],2]],Power[Plus[1,Power[\[Rho],2]],2]],Rational[-1,2]]

you can see there is no Sqrt in the denominator. So, your
pattern fails to match and no replacement is done.



  • Prev by Date: Re: Replacement Rule with Sqrt in denominator
  • Next by Date: Re: Replacement Rule with Sqrt in denominator
  • Previous by thread: Re: Replacement Rule with Sqrt in denominator
  • Next by thread: Re: Replacement Rule with Sqrt in denominator