Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5903 > unrolled thread
| Started by | Andrzej Kozlowski <akoz@mimuw.edu.pl> |
|---|---|
| First post | 2011-10-26 21:52 +0000 |
| Last post | 2011-10-26 21:52 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Full simplify problem Andrzej Kozlowski <akoz@mimuw.edu.pl> - 2011-10-26 21:52 +0000
| From | Andrzej Kozlowski <akoz@mimuw.edu.pl> |
|---|---|
| Date | 2011-10-26 21:52 +0000 |
| Subject | Re: Full simplify problem |
| Message-ID | <j89ver$24a$1@smc.vnet.net> |
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
with
Last[PolynomialReduce[b + c - a, {a - d, d - b - c}]]
0
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
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web