Re: 2*m^z - m^z = ?

• To: mathgroup at smc.vnet.net
• Subject: [mg88133] Re: [mg88104] 2*m^z - m^z = ?
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Sat, 26 Apr 2008 03:41:50 -0400 (EDT)
• References: <200804250926.FAA08036@smc.vnet.net>

```

On 25 Apr 2008, at 18:26, Alexey Popkov wrote:

> Hello,
>
> Table[
>  {2*m^z - m^z,
>   FullSimplify[2*m^z - m^z]},
>  {m, 1, 21}] // TableForm
>
> The answer is very interesting (only odd numbers are treated well):
>
> 1					1
> -2^z + 2^(1 + z)			2^z
> 3^z					3^z
> 2^(1 + 2*z) - 4^z			4^z
> 5^z					5^z
> 2^(1 + z)*3^z - 6^z		2^(1 + z)*3^z - 6^z
> 7^z					7^z
> 2^(1 + 3*z) - 8^z			8^z
> 9^z					9^z
> 2^(1 + z)*5^z - 10^z		2^(1 + z)*5^z - 10^z
> 11^z					11^z
> 2^(1 + 2*z)*3^z - 12^z		2^(1 + 2*z)*3^z - 12^z
> 13^z					13^z
> 2^(1 + z)*7^z - 14^z		2^(1 + z)*7^z - 14^z
> 15^z					15^z
> 2^(1 + 4*z) - 16^z		16^z
> 17^z					17^z
> 2^(1 + z)*9^z - 18^z		2^(1 + z)*9^z - 18^z
> 19^z					19^z
> 2^(1 + 2*z)*5^z - 20^z		2^(1 + 2*z)*5^z - 20^z
> 21^z					21^z
>
> Can anyone explain the reason for this behavior?
>

Thera are many such pheonomna in computer algebra. This particular one
I have already once explained on this forum, but as I can't find my
post I will repeat it.

The reason why this happens is that Mathematica (and all other
Computer ALgebra Systems) performs certain "simplifications", or more
precisely "reductions to canonical form" automatically, even before
applying Simplify or FullSimplify, simply as part of the evaluation
process. One such "simplification" that is done automatically is this:

2*6^z
2^(z + 1)*3^z

In other words, Mathematica sees that 6 has 2 as a factor, it factors
it out and combines all factor of 2 into a single power. This is a
typical example of "reduction to canonical form". Such reductions make
certian operations much simpler and faster but unfortunately this
particular one does not fit in very well with another reduction that
Mathematica also performs automatically:

2^z*3^z
6^z

Such "reductions" cannot be undone by Simplify or FullSimplify because
they are performed on evaluation, so even if Simplify "undid" one of
them, the reduction would be immediately performed again.
Unfortunately these two reductions  prevent Simplify and FullSimplify
form seeing that

2^(z + 1)*3^z-6^z

can be simplified to 6^z, because Simplify cannot re-write 2^(z +
1)*3^z as 2*6^z and it also cannot re-write 6^z as 2^z*3^z for reasons
described above.

In the exmaple you gave the problem can be easily dealt with by
wrapping Evaluate round the first argument of Table.

Table[Evaluate[{2*m^z - m^z, FullSimplify[2*m^z - m^z]}], {m, 1, 21}]

However the problem of simplifying

p=2*6^z-6^z

and similar expressions is harder to deal with. Note that Mathematica
has no difficulty verifying that

p == 6^z // Simplify
True

so it is only transforming p into 6^z by means of FullSimplify that is
difficult. In fact, I don't think it can be done, without using some
tricks. Here is one such trick. We divide p  by 3^z, then FullSimplify
and finally again multiply by 3^z:

FullSimplify[[p/3^z]*3^z
6^z

Andrzej Kozlowski

```

• Prev by Date: Re: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*)
• Next by Date: RE: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*)
• Previous by thread: Re: 2*m^z - m^z = ?
• Next by thread: Re: Re: 2*m^z - m^z = ?