|
[Date Index]
[Thread Index]
[Author Index]
Re: Unexpected behavior of Simplify
- To: mathgroup at smc.vnet.net
- Subject: [mg63261] Re: Unexpected behavior of Simplify
- From: Adam Strzebonski <adams at wolfram.com>
- Date: Tue, 20 Dec 2005 23:35:46 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Some transformations used by Simplify, like partial
factorization, depend on the order of variables.
Simplify does not try all variable orders, because first it
does not know in general what the "variables" are, and
second trying all orders would multiply the computation
time of Simplify by Factorial[number of variables].
Here is a simple implementation of a variable order
independent Simplify. (A FullSimplify variant of
the code was posted at
http://forums.wolfram.com/mathgroup/archive/2005/Jan/msg00237.html
see also the accompanying discussion.)
In[1]:= VOISimplify[vars_, expr_, assum_:True] :=
Module[{perm, ee, best},
perm=Permutations[vars];
ee=(Simplify@@({expr, assum}/.Thread[vars->#]))&/@perm;
best=Sort[Transpose[{LeafCount/@ee, ee, perm}]][[1]];
best[[2]]/.Thread[best[[3]]->vars]]
In[2]:= expr = c^4*b^2 + a^4*b^2 + c^2*a^2*(1 - 2*b^2) ;
In[3]:= VOISimplify[{a, b, c}, expr]
2 2 2 2 2 2
Out[3]= a c + b (a - c )
In[4]:= VOISimplify[{a, b, c}, expr/.{a -> b, b -> a}]/.
{a -> b, b -> a}
2 2 2 2 2 2
Out[4]= a c + b (a - c )
Best Regards,
Adam Strzebonski
Wolfram Research
Prev by Date:
Re: Re: Replacement equivalence?
Next by Date:
Re: Unexpected behavior of Simplify
Previous by thread:
Unexpected behavior of Simplify
Next by thread:
Re: Unexpected behavior of Simplify
|