Re: Re: Re: Simplifying algebraic expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg67006] Re: [mg66959] Re: [mg66881] Re: [mg66839] Simplifying algebraic expressions
- From: "Carl K. Woll" <carlw at wolfram.com>
- Date: Tue, 6 Jun 2006 06:29:24 -0400 (EDT)
- References: <200606011054.GAA20566@smc.vnet.net> <200606020809.EAA18083@smc.vnet.net> <200606050748.DAA16346@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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) missing from Simplify, which
> apparently has already been added 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[30]:= Simplify[((-1)^a)^b == (-1)^(a b), Element[{a, b}, Integers]]
Out[30]= True
So, I think my approach is generally valid.
> 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[50]:=
Simplify[e^a e^b == e^(a+b)]
Out[50]=
True
In[51]:=
Simplify[(e^a)^b == e^(a b), Element[{a,b},Integers]]
Out[51]=
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[56]:=
simp[(-1)^(u+v),Mod[u,2]==0]
Out[56]=
v
(-1)
In[57]:=
simp[(-2)^(u+v),Mod[u,2]==0]
Out[57]=
v u + v
(-1) 2
In[58]:=
simp[(-1)^(2x+3y),Element[{x,y},Integers]]
Out[58]=
y
(-1)
In[59]:=
simp[(-2)^(2x+3y),Element[{x,y},Integers]]
Out[59]=
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
>>
- References:
- Simplifying algebraic expressions
- From: Amitabha Roy <aroy@cs.bc.edu>
- Re: Simplifying algebraic expressions
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Simplifying algebraic expressions
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Simplifying algebraic expressions