Re: Strange behaviour of Simplify
- To: mathgroup at smc.vnet.net
- Subject: [mg79075] Re: Strange behaviour of Simplify
- From: Andreas Maier <andimai at web.de>
- Date: Wed, 18 Jul 2007 02:51:08 -0400 (EDT)
- References: <f7caue$9bj$1@smc.vnet.net><f7f3k1$oi3$1@smc.vnet.net>
On Jul 16, 8:35 am, Jean-Marc Gulliet <jeanmarc.gull... at gmail.com> wrote: > 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 You are completely right! I wanted to simplify my problem, so i copied only part of it into my message. The LeafCounts i reported are from In:=LeafCount[{{\[Gamma] -> -(c Sqrt[g00])/Sqrt[ c^2 g00 + g11 v^2]}, {\[Gamma] -> (c Sqrt[g00])/Sqrt[ c^2 g00 + g11 v^2]}}] Out:=52 In:=LeafCount[{{\[Gamma] -> -c/Sqrt[c^2 + (g11 v^2)/g00]}, {\[Gamma] - > c/ Sqrt[c^2 + (g11 v^2)/g00]}}] Out:=44 In:=LeafCount[{{\[Gamma] -> -1/Sqrt[ 1 + (g11 v^2)/(c^2 g00)]}, {\[Gamma] -> 1/Sqrt[ 1 + (g11 v^2)/(c^2 g00)]}}] Out:=43 Sorry for that, Andreas