MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Unexpected behavior of Simplify

  • To: mathgroup at
  • Subject: [mg63261] Re: Unexpected behavior of Simplify
  • From: Adam Strzebonski <adams at>
  • Date: Tue, 20 Dec 2005 23:35:46 -0500 (EST)
  • Sender: owner-wri-mathgroup at

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

see also the accompanying discussion.)

In[1]:= VOISimplify[vars_, expr_, assum_:True] :=
    Module[{perm, ee, best},
       ee=(Simplify@@({expr, assum}/.Thread[vars->#]))&/@perm;
       best=Sort[Transpose[{LeafCount/@ee, ee, perm}]][[1]];

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