MathGroup Archive 2006

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

Search the Archive

Re: Simplifying algebraic expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66901] Re: [mg66839] Simplifying algebraic expressions
  • From: "Carl K. Woll" <carlw at wolfram.com>
  • Date: Sat, 3 Jun 2006 03:25:29 -0400 (EDT)
  • References: <200606011054.GAA20566@smc.vnet.net> <44803200.7000104@wolfram.com> <21E4A437-213D-4201-A902-70BC331E2D01@cs.bc.edu>
  • Sender: owner-wri-mathgroup at wolfram.com

Amitabha Roy wrote:
> In Mathematica 5.2,
> 
> this does not work
> 
> Simplify[ (-1)^(2 x  + 3 y), Element[{x, y}, Integers] ]
> gives no simplication. Neither does Refine.
> 
> I forgot to mention that I am only interested in the situation when  the 
> variables
> take on integer values.
> 

Sorry, I forgot to check version 5.2. It works in the development version.

A possible workaround:

simp[expr_, assum_] :=
   expr //.
     (-1)^(a_Integer b_?(Refine[Element[#,Integers],assum]&)+x_.):>
     ((-1)^a)^b (-1)^x

For your example:

In[14]:=
simp[(-1)^(2x+3y),Element[{x,y},Integers]]

Out[14]=
     y
(-1)

Carl Woll
Wolfram Research

> 
> 
> 
> 
> 
> On Jun 2, 2006, at 8:41 AM, Carl K. Woll wrote:
> 
>> 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
>>
>>
>> I presume you want this simplification to occur assuming x and y  are 
>> integers, as the simplification is not valid when either x or y  are 
>> not integers. For example, with x==0 and y==.1, we have (-1)^ (3*.1) 
>> != (-1)^.1. Try:
>>
>> Simplify[ (-1)^(2 x  + 3 y), Element[{x,y},Integers] ]
>>
>>     y
>> (-1)
>>
>> (you could also use Refine with the same syntax instead of Simplify)
>>
>> Carl Woll
>> Wolfram Research


  • Prev by Date: Re: calling mathematica functions from a c++ program
  • Next by Date: Re: mathematica newbie question
  • Previous by thread: Re: Simplifying algebraic expressions
  • Next by thread: Re: Simplifying algebraic expressions