MathGroup Archive 2011

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

Search the Archive

Re: Full simplify problem

On 25 Oct 2011, at 12:18, A. Lapraitis wrote:

> First of all, thanks to all the people answering!
> The problem is more complicated, indeed, this is just the minimal working
> example. However, I still do not understand Mathematica's behaviour.
> 1. I thought that the whole point of Count[#, x, Infinity]& was to
> distinguish between Exp[x] and Exp[y+z] in favour of Exp[x]. However, the
> same is true for the LeafCount function (it gives 3 and 5 respectively). Why
> is not a good complexity function in this case?

The point was to force Simplify to replace x by y+z or to replace y+z with x. The first complexity function "induces" Simplify to replace x by y+z. LeafCount should "induce" the replacement of y+z by x but this will not always work for reason that it related to your second question.

> 2. I was trying a different workaround and have noticed a dependence of the
> result on the names of the variables:
> In[13]:= Clear["Global`*"]
> In[14]:= Assuming[x == d && d == y + z, FullSimplify[E^x - E^(y + z)]]
> Out[14]= E^x - E^(y + z)
> In[15]:= Assuming[a == d && d == b + c, FullSimplify[E^a - E^(b + c)]]
> Out[15]= 0
> Can anyone explain this?

The above replacement is not achieved by using a replacement rule (as in Bobby Treat's suggested solution) but by using the algebraic function PolynomialReduce. However, PolynomialReduce depends on the ordering of variables. In this particular case you can see this by comparing:

In[45]:= Last[PolynomialReduce[y + z - x, {x - d, d - y - z}]]

Out[45]= -x+y+z


Last[PolynomialReduce[b + c - a, {a - d, d - b - c}]]


In general, it is not a good idea to use Simplify or FullSimplify with assumptions involving Equal. This will only work on in simple situations. Generally, it is better either to use syntactic replacement rules or PolynomialReduce etc, with explicit ordering of variables (which determines what variables you want to remain and which ones you want to be eliminated).

Andrzej Kozlowski

  • Prev by Date: Re: Integral points on elliptic curves
  • Next by Date: Re: Integral points on elliptic curves
  • Previous by thread: Re: Full simplify problem
  • Next by thread: algebraic ReplaceAll?