Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

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!!
>




  • Prev by Date: Graphics Gallery: wallpapers, Kaleidoscopes,...
  • Next by Date: Re: (a-b)/(c-d)=!=(b-a)/(d-c) ???
  • Previous by thread: Re: How to declare Integers?
  • Next by thread: (a-b)/(c-d)=!=(b-a)/(d-c) ???