       Re: Re: Re: Simplifying algebraic expressions

```I suddenly remembered that I have already met a very closely related
problem once before and even suggested that the transformation
promising that he would do so:

http://forums.wolfram.com/mathgroup/archive/2005/Jul/msg00717.html

So it may have had something to do with the change in the development
version.

It also shows that my memory is no longer what it used to be :-

Andrzej Kozlowski

On 6 Jun 2006, at 13:00, Andrzej Kozlowski wrote:

>
> On 6 Jun 2006, at 11:46, Carl K. Woll wrote:
>
>> Andrzej Kozlowski wrote:
>>> Here is, I think, an optimized version of the "simplification" I
>>> sent  earlier:
>>> rule1 = {2x -> u, 3y -> v}; rule2 = Map[Reverse, rule1];
>>> Simplify[TrigFactor[Simplify[ExpToTrig[
>>>       Simplify[ExpToTrig[(-1)^(2*x + 3*y) /. rule1],
>>>         Mod[u, 2] == 0] /. rule2], y â?? Integers]],
>>>    y â?? Integers]
>>> (-1)^y
>>> "Optimized" means that I can't see any obvious way to make this
>>> simpler.
>>> Unlike other answers to the original post, this works in
>>> Mathematica  5.1 and 5.2, and involves only reversible
>>> operations. In other words,  it constitutes a proof. On the other
>>> hand, obviously, it would be  ridiculous to use this approach in
>>> practice: there must be a simple  transformation rule (or rules)
>>> in the development version.
>>
>> Andrzej,
>>
>> It seems to me that your simplification approach isn't as general
>> as the replacement method I advocated (a variant of which is given
>> below), as rule1 and rule2 are specific to the input. Also, my
>> replacement method is based on the fact that:
>>
>> In:= Simplify[((-1)^a)^b == (-1)^(a b), Element[{a, b},
>> Integers]]
>>
>> Out= True
>>
>> So, I think my approach is generally valid.
>
> You are right, I apologise. I did not look carefully at your code.
> But now that I see some challenge ;-) I also see  that I can
> completley remove rule1 and rule 2 form my code and make it equally
> general:
>
>
> Simplify[TrigFactor[Simplify[ExpToTrig[
>      Simplify[ExpToTrig[(-1)^PolynomialMod[2*x + 3*y,
>          2]], Mod[u, 2] == 0]], y â?? Integers]],
>   y â?? Integers]
>
>
> (-1)^y
>
> What's more, I can actually produce an even shorter code that will
> produce the required simplification:
>
>
> f[(-1)^(n_)] := (-1)^PolynomialMod[n, 2]
>
>
> Simplify[f[(-1)^(2*x + 3*y)], TransformationFunctions ->
>    {Automatic, f}]
>
>
> (-1)^y
>
>
> Of course this ought to be modified so as to be performed only
> under the assumption that x and y are integers (not very hard to
> do).  I suspect that this is close to what has been done in the
> development version.
>
> Andrzej Kozlowski
>
>
>
>
>>
>>> Note also the following problem, which I suspect is related:
>>> Simplify[(-1)^(u + v), (u | v) â?? Integers &&
>>>     Mod[u, 2] == 0 && Mod[v, 2] == 1]
>>> -1
>>> Simplify[(-1)^(u + v), (u | v) â?? Integers &&
>>>     Mod[u, 2] == 0 && Mod[v, 2] == 0]
>>> 1
>>> But
>>> Simplify[(-1)^(u + v), (u | v) â?? Integers &&
>>>     Mod[u, 2] == 0]
>>> (-1)^(u + v)
>>> I am sure this also gives (-1)^v in the development version.
>>
>> To obtain the desired simplification in 5.2, we can modify my
>> previous approach as follows:
>>
>> power[e_, a_Plus] := Times @@ (Simplify /@ (power[e, #1]&) /@ List
>> @@ a)
>> power[e_, a_Integer b_?(Refine[Element[#,Integers]]&)] := (e^a)^b
>> power[e_, a_] := e^a
>>
>> simp[expr_, assum_] := Block[{\$Assumptions = assum},
>>   Simplify[expr /. Power -> power]
>> ]
>>
>> In the above I rely on the following two equivalences, verified by
>> Mathematica:
>>
>> In:=
>> Simplify[e^a e^b == e^(a+b)]
>>
>> Out=
>> True
>>
>> In:=
>> Simplify[(e^a)^b == e^(a b), Element[{a,b},Integers]]
>>
>> Out=
>> True
>>
>> The tricky part is that Mathematica automatically converts e^a e^b
>> --> e^(a+b), and as you point out above Simplify[(-1)^(u+v),...]
>> doesn't work. However, Simplify[(-1)^u, ...] does work, which is
>> why the Simplify appears in the definition of power[e_,a_Plus]
>> before Times is applied.
>>
>> Here are some examples:
>>
>> In:=
>> simp[(-1)^(u+v),Mod[u,2]==0]
>>
>> Out=
>>     v
>> (-1)
>>
>> In:=
>> simp[(-2)^(u+v),Mod[u,2]==0]
>>
>> Out=
>>     v  u + v
>> (-1)  2
>>
>> In:=
>> simp[(-1)^(2x+3y),Element[{x,y},Integers]]
>>
>> Out=
>>     y
>> (-1)
>>
>> In:=
>> simp[(-2)^(2x+3y),Element[{x,y},Integers]]
>>
>> Out=
>>     y  2 x + 3 y
>> (-1)  2
>>
>> Carl Woll
>> Wolfram Research
>>
>>> Andrzej Kozlowski
>>> On 2 Jun 2006, at 17:09, Andrzej Kozlowski wrote:
>>>> On 1 Jun 2006, at 19:54, Amitabha Roy wrote:
>>>>
>>>>
>>>>> Hello:
>>>>>
>>>>> I would like Mathematica to be able to take an expression, say,
>>>>>
>>>>> (-1)^{2 x  + 3 y} and be able to simplify to (-1)^y.
>>>>>
>>>>> Is there a way one can do this ?
>>>>>
>>>>> Thanks
>>>>>
>>>>
>>>> Note that you are using {} instead of (). Different kind of
>>>> brackets
>>>> have completely different meaning in Mathematica.
>>>> I have found it amazingly hard to force Mathematica to perform this
>>>> simplification. The best I could do is this. We need two rules.
>>>> rule1
>>>> will replace 2x by u and 3y by v. rule 2 does the opposite: it
>>>> replaces u by 2x and v by 2y.
>>>>
>>>> rule1 = {2x -> u, 3y -> v};rule2 = Map[Reverse, rule1];
>>>>
>>>> Now:
>>>>
>>>>
>>>> Simplify[TrigFactor[
>>>>    FullSimplify[ExpToTrig[
>>>>      FullSimplify[
>>>>        ComplexExpand[
>>>>         (-1)^(2*x + 3*y) /.
>>>>          rule1], Mod[u, 2] ==
>>>>         0] /. rule2],
>>>>     y â?? Integers]],
>>>>   y â?? Integers]
>>>>
>>>>
>>>> (-1)^y
>>>>
>>>> Uff... Surely, this ought to be easier...
>>>>
>>>> Andrzej Kozlowski
>>>> Tokyo, Japan
>>>>
>>
>

```

• Prev by Date: Re: New Analytical Functions - Mathematica Verified
• Next by Date: Re: Re: Re: Simplifying algebraic expressions
• Previous by thread: Re: Re: Re: Simplifying algebraic expressions
• Next by thread: Re: Re: Re: Simplifying algebraic expressions