 
 
 
 
 
 
Re: normalization and square roots
- To: mathgroup at smc.vnet.net
- Subject: [mg65779] Re: normalization and square roots
- From: bghiggins at ucdavis.edu
- Date: Mon, 17 Apr 2006 02:28:29 -0400 (EDT)
- References: <e1su8g$c3t$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Ruth, There are several problems with the way you have set up your
functions. First of all if you define the functions as in your post
f[x_, om_, oro_] := 1/(Sqrt[oro] - Sqrt[
  om(1 + x)^3 + ol + oro]) /. ol -> myrule
myrule = -om + (-1 + Sqrt[oro])^2 - oro
then evaluating
f[0, om, oro]
gives
1/(-Sqrt[(-1 + Sqrt[oro])^2] + Sqrt[oro])
whereas evaluating
f[0, a, b]
gives
1/(Sqrt[b] - Sqrt[a + b - om + (-1 + Sqrt[oro])^2 - oro])
The reason is clear: the arguments of f are pattern matched in the
function expression but the pattern matching does not extend to the
rule. You can resolve this by writing out myrule explicitly in the
function definition or defining a new rule and function as follows:
myrule2[om_, oro_] := -om + (-1 + Sqrt[oro])^2 - oro
f2[x_, om_, oro_] := 1/(
    Sqrt[oro] - Sqrt[om(1 + x)^3 + ol + oro]) /. ol -> myrule2[om, oro]
Now f2[0,om,oro] gives the same expression for  f2[0,a,b]  with a
substitued for om and b for oro.
If you wrap f2[a,b] with PowerExpand you get 1
f2[0,om,oro]//PowerExpand
1
But this is only true if  oro (or b) is greater than unity. If you look
at the output
f2[0, a, b]
1/(-Sqrt[(-1 + Sqrt[b])^2] + Sqrt[b])
the reason is clear. When you use PowerExpand Mathematica always takes
the positive root of Sqrt[(-1 + Sqrt[b])^2]. There is no ambiguity if
b>1, but if b<1, you need the negative root if you want f2[0,0.2,0.3]
to evalaute to 1.
Hope this helps,
Cheers,
brian

