Re: How to declare Integers?
- To: mathgroup at smc.vnet.net
- Subject: [mg13013] Re: How to declare Integers?
- From: "Le Van Tri" <lvtri at cs.uwm.edu>
- Date: Tue, 30 Jun 1998 00:26:10 -0400
- Organization: University of Wisconsin - Milwaukee
- References: <6n4op4$njn@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Carlos, it is interesting to try this: Unprotect[IntegerQ]; IntegerQ[m_+n_]/;IntegerQ[m]&&IntegerQ[n]=True; IntegerQ[m_*n_]/;IntegerQ[m]&&IntegerQ[n]=True; IntegerQ[m_^n_]/;IntegerQ[m]&&IntegerQ[n]&&Positive[n]=True; Unprotect[Sin,Cos]; Sin[m_*Pi]/;IntegerQ[m]=0; Cos[m_*Pi]/;IntegerQ[m]=1; Sin[m_*Pi+x_]/;IntegerQ[m]=Sin[x]; Cos[m_*Pi+x_]/;IntegerQ[m]=Cos[x]; This should work for any simple expressions for you. How ever, more will be involved if you need to do things like this: IntegerQ[m]=True; IntegerQ[n*n]=True; Should IntegerQ[m*(n-1)*(n+1)] return True ? I dont know how to do it yet :) Tri. Carlos Wexler wrote in message <6n4op4$njn at smc.vnet.net>... > >How can one declare m to be integer? There has to be a way! In Maple it >is rather easy and the expected behavior is obtained. I cannot believe >that it is not possible to accomplish the same in Mathematica as well. > >Thanks!! >