Re: Strange behaviour of Simplify
- To: mathgroup at smc.vnet.net
- Subject: [mg79017] Re: [mg79008] Strange behaviour of Simplify
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Mon, 16 Jul 2007 02:10:16 -0400 (EDT)
- References: <200707150514.BAA08789@smc.vnet.net>
On 15 Jul 2007, at 14:14, Andreas Maier wrote: > Hi, > > i'm trying to simplify the following expression > > In:= gamma=c Sqrt[g00])/Sqrt[c^2 g00 + g11 v^2] > 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 > > There is nothing strange about this behaviour. Simplify only uses certain specified transformation functions and applies certain sequences of them (such that the complexity does not increase at any step) but there is no such sequence of functions that would do what you want, because any such sequence would have to temporarily inrease the complexity of the expression. Rather than spend time and energy on trying to find a suitable mix of TransformationFunctions and a ComplexityFunction that would produce the result you want, it is much simpler to use replacement rules or a combination of replacement rules and Simplify, like this: Simplify[gamma /. c -> Sqrt[t], {Sqrt[g00] > 0, t > 0}] /. t -> c^2 1/Sqrt[(g11*v^2)/(c^2*g00) + 1] Andrzej Kozlowski
- References:
- Strange behaviour of Simplify
- From: Andreas Maier <andimai@web.de>
- Strange behaviour of Simplify