[Date Index]
[Thread Index]
[Author Index]
Re: Simplification question
*To*: mathgroup at smc.vnet.net
*Subject*: [mg59112] Re: [mg59032] Simplification question
*From*: Adam Strzebonski <adams at wolfram.com>
*Date*: Fri, 29 Jul 2005 00:41:49 -0400 (EDT)
*References*: <200507270525.BAA19953@smc.vnet.net> <30D2C21A-5F80-42E8-8E5C-AF5AB426DF5B@mimuw.edu.pl>
*Reply-to*: adams at wolfram.com
*Sender*: owner-wri-mathgroup at wolfram.com
Andrzej Kozlowski wrote:
>
> 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.
For this to work Simplify needs to applied recursively to the result
of the transformation Cos[3*m*Pi] -> (-1)^(3*m). Simplify rarely
applies itself recursively to results of transformations that did
not make the expression simpler, because of high computational cost.
> I also wonder why something like f is not automatically included among
> the transformation functions?
I will add it (of course f needs to check that all polynomial variables
in k are assumed to be integers).
Best Regards,
Adam Strzebonski
Wolfram Research
Prev by Date:
**Re: silly questions?**
Next by Date:
**NIntegrate::inum continued**
Previous by thread:
**Re: Simplification question**
Next by thread:
**Re: Simplification question**
| |