Re: Simplification question

*To*: mathgroup at smc.vnet.net*Subject*: [mg59073] Re: [mg59032] Simplification question*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Thu, 28 Jul 2005 02:26:32 -0400 (EDT)*References*: <200507270525.BAA19953@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 27 Jul 2005, at 07:25, snoofly wrote: > Can someone explain this to me please. > > Clear[m] > > Simplify[Sin[3 m Pi], Assumptions -> m \[Element] Integers] > 0 > > Simplify[Cos[3 m Pi], Assumptions -> m \[Element] Integers] > > Cos[3 m \[Pi]] > > I'm not sure why Mathematica cannot deduce that the second > simplification > should be (1)^m. > > The reason is, hm, simple, that is Mathematica's default complexity function does not consider (-1)^(3m) as "simpler" than Cos[3m Pi]. You can use In[15]:= Refine[Cos[3*m*Pi], Assumptions -> m â?? Integers] Out[15]= (-1)^(3*m) Actually, however, the real situation is not as simple. The answer (-1)^m does indeed have a lower LeafCount than Cos[3*m*Pi] (3 vs. 5) but Mathematica never arrives at this answer. Instead it gets (-1)^ (3*m) which has the same LeafCount 5 as Cos[3*m*Pi]. So let us define a function which will convert (-1)^(3*m) to (-1)^m f[(-1)^(k_)] := (-1)^PolynomialMod[k, 2] We shall append f to the default transformation functions and try FullSimplify: FullSimplify[Cos[3*m*Pi], m â?? Integers, TransformationFunctions -> {Automatic, f}] (-1)^m Very surprisingly (for me) this does now work with just Simplify. I also wonder why something like f is not automatically included among the transformation functions? Andrzej Kozlowski

**References**:**Simplification question***From:*"snoofly" <snoofly@snoofly.com>