Re: Strange behaviour of Simplify
- To: mathgroup at smc.vnet.net
- Subject: [mg79040] Re: Strange behaviour of Simplify
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 16 Jul 2007 02:22:26 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f7caue$9bj$1@smc.vnet.net>
Andreas Maier wrote:
> Hi,
>
> i'm trying to simplify the following expression
>
> In:= gamma=c Sqrt[g00])/Sqrt[c^2 g00 + g11 v^2]
------------------------^
The above expression is syntacticly incorrect: either a parenthesis is
missing before the 'c' or this parenthesis must be discarded.
> In:=LeafCount[gamma]
> Out:=52
>
> using Simplify
>
> In:= gamma2=Simplify[gamma, {Sqrt[g00] > 0, c > 0 }]
>
> Out:=c/Sqrt[c^2 + (g11 v^2)/g00]
> In:=LeafCount[gamma2]
> Out:=44
>
> Why is Mathematica (I'm using V6.0) able to cancel Sqrt[g00], but is
> not
> able to cancel c? I also tried ComplexityFunction->LeafCount, which
> should work, because
>
> In:=gamma3=1/Sqrt[1 + (g11 v^2)/(c^2 g00)]
> In:=LeafCount[gamma3]
> Out:=43
>
> the LeafCount of gamma3 is smaller than gamma2, but it doesn' work.
> Can anybody tell me, how i can transform gamma to gamma3 in
> Mathematica?
>
> Andreas Maier
Moreover, the leaf count numbers you are reporting are fishy: I have got
a difference of only one between the leaf count of gamma2 and of gamma3.
You should experiment again with a fresh kernel and copy the
input/output from the exact expressions you are working on.
In[1]:= gamma = (c*Sqrt[g00])/Sqrt[c^2*g00 + g11*v^2]
LeafCount[%]
Out[1]= (c*Sqrt[g00])/Sqrt[c^2*g00 + g11*v^2]
Out[2]= 22
In[3]:= gamma2 = Simplify[gamma, {Sqrt[g00] > 0, c > 0}]
LeafCount[%]
Out[3]= c/Sqrt[c^2 + (g11*v^2)/g00]
Out[4]= 18
In[5]:= gamma3 = 1/Sqrt[1 + (g11*v^2)/(c^2*g00)]
LeafCount[%]
Out[5]= 1/Sqrt[1 + (g11*v^2)/(c^2*g00)]
Out[6]= 17
Regards,
Jean-Marc