[Date Index]
[Thread Index]
[Author Index]
Re: Replacement Rule with Sqrt in denominator
*To*: mathgroup at smc.vnet.net
*Subject*: [mg113980] Re: Replacement Rule with Sqrt in denominator
*From*: Peter Breitfeld <phbrf at t-online.de>
*Date*: Sat, 20 Nov 2010 06:09:47 -0500 (EST)
*References*: <ic5igm$44p$1@smc.vnet.net>
Themis Matsoukas wrote:
> This replacement rule works,
>
> Sqrt[-4 \[Zeta]^2 + (1 + \[Rho]^2)^2] /.
> Sqrt[-4 \[Zeta]^2 + (1 + \[Rho]^2)^2] -> G
>
> G
>
> but this doesn't:
>
> 1/Sqrt[-4 \[Zeta]^2 + (1 + \[Rho]^2)^2] /.
> Sqrt[-4 \[Zeta]^2 + (1 + \[Rho]^2)^2] -> G
>
> 1/Sqrt[-4 \[Zeta]^2 + (1 + \[Rho]^2)^2]
>
> 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.
>
> Themis
>
Have a look at the FullForm, which is always used by ReplaceAll:
In your first example the FullForm looks like:
ff1=Power[Plus[Times[-4,Power[\[Zeta],2]],Power[
Plus[1,Power[\[Rho],2]],2]],Rational[1,2]]
In the second one:
ff2=Power[Plus[Times[-4,Power[\[Zeta],2]],Power[
Plus[1,Power[\[Rho],2]],2]],Rational[-1,2]]
the little but important difference is the "-" Sign in the last one. In
the first example the replacement takes place, because the FullForm
matches. You do ff1/.ff1->G
But in the second one it doesn't match because you try ff2/.ff1->G
You can do: ff2/. (1/ff1)->G (no need to use FullForm here)
--
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de
Prev by Date:
**Re: How to work with In?**
Next by Date:
**Re: Mathematica 8**
Previous by thread:
**Re: Replacement Rule with Sqrt in denominator**
Next by thread:
**Re: Replacement Rule with Sqrt in denominator**
| |