Re: Full simplify problem
- To: mathgroup at smc.vnet.net
- Subject: [mg122272] Re: Full simplify problem
- From: dimitris <dimmechan at yahoo.com>
- Date: Sun, 23 Oct 2011 06:22:52 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j7u59t$u$1@smc.vnet.net>
On Oct 22, 1:18 pm, "A. Lapraitis" <ffcita... at gmail.com> wrote:
> Hello,
>
> Could anyone explain why the following does not give zero?
>
> In[72]:= Assuming[
> x == y + z,
> FullSimplify[
> E^x - E^(y + z)
> ]
> ]
>
> Out[72]= E^x - E^(y + z)
>
> Thanks!
Wow! This is rather strange! Here is some similar examples
In[31]:= Assuming[x - y == 0, FullSimplify[E^x - E^(y + z)]] (*works*)
Out[31]= E^y*(1 - E^z)
In[36]:= Assuming[x - y == 2, FullSimplify[E^x - E^(y + z)]](*not
works*)
Out[36]= E^x - E^(y + z)
In[37]:= Assuming[x == y, FullSimplify[E^x - E^(y + z)]] (*works*)
Out[37]= E^y*(1 - E^z)
In[30]:= Assuming[x == 2*y, FullSimplify[E^x - E^(y + z)]] (*not
works*)
Out[30]= E^x - E^(y + z)
Somehow FullSimplify need some push in order to simplify your
expression and similar ones.
I don't claim this is a normal behavior, I don't have any explanation
for it, I don't know what
I would do if I didn't have some knowledge of Mathematica but I found
the following
workaround (not trivial indeed) for your example:
In[69]:= Assuming[x == y + z, FullSimplify[E^x - E^(y + z),
ComplexityFunction -> (If[Head[#1] === Power, 1, 0] & )]]
Out[69]= 0
This does the same
In[70]:= Assuming[x == y + z, FullSimplify[E^x - E^(y + z),
ComplexityFunction -> (Count[{#1}, _Power, Infinity] & )]]
Out[70]= 0
(You can use the option ComplexityFunction to specify different
simplicity criteria. Here the goal is to avoid Power if possible.
Remember that Head[Exp[z]] is Power and FullForm[Exp[z]] is
Power[E,z].)
I would also add that for my similar examples mentioned above a
workaround could be:
In[80]:= TrigToExp[Assuming[x == 2*y, FullSimplify[E^x - E^(y + z),
ComplexityFunction -> (Count[{#1}, _Power, Infinity] & )]]]
Out[80]= E^(2*y) - E^(y + z)
In[82]:= TrigToExp[Assuming[x - y == 2, FullSimplify[E^x - E^(y + z),
ComplexityFunction -> (Count[{#1}, _Power, Infinity] & )]]]
Out[82]= E^(2 + y) - E^(y + z)
Best Regards
Dimitris