MathGroup Archive 2005

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

Search the Archive

Re: Simplification question


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


  • Prev by Date: Re: solve output "problem"
  • Next by Date: Re: Showing Mathematica notebooks within Firefox browser (like Adobe PDF's)
  • Previous by thread: Re: Simplification question
  • Next by thread: Re: Simplification question