IntegerQ
- To: mathgroup at smc.vnet.net
- Subject: [mg8024] IntegerQ
- From: "K. Nikolaj Berntsen" <knb at bkm.dtu.dk>
- Date: Sat, 2 Aug 1997 22:32:34 -0400
- Organization: News Server at UNI-C, Danish Computing Centre for Research and Education.
- Sender: owner-wri-mathgroup at wolfram.com
If this is posted twice, please forgive me; I posted it yesterday and it has not appeared yet, so I try by another channel. I am looking for a way to tell mathematica that "n" is an integer AND to use that piece of information. I have tried something like In[]= n /: IntegerQ[n]=True Out[]= True But this does not seem to get through to mathematica, other than when you explicitely ask the question In[]= IntegerQ[n] For example mathematica cannot do the following: In[]= Sin[n Pi] Out[]= 0 Of course I do not really care for the above identity, but I do want to carry out an integration like Integrate[Exp[Cos[x]] Cos[n x],{x,0,2 Pi}] Mathematica can do this for any "n" I have come with, but it can not give me the general expression (well sometimes it can, in the beginning of a notebook). Another example would be to get Integrate[Cos[x]^n,{x,0,2 Pi}] In the same form as (or whatever integer you choose to put in) Integrate[Cos[x]^3,{x,0,2 Pi}] Maybe it would be necessary to tell mathematica that it is an even or odd number, but that does not seem to help it out: In[]= n/: EvenQ[n]=True Out[]= True In[]= Integrate[Cos[x]^n,{x,0,2 Pi}] Anybody out there who has as way to do it? Regards, Nikolaj -------------------------------------------------------------- | Ph.D. stud., cand.scient. | | K. Nikolaj Berntsen | | Office: Department of Structural Engineering and Materials | | Technical University of Denmark | | Building 118, room 152 | | DK-2800 Lyngby | | Tel +45 4525 1769 | | Fax +45 4588 3282 | | Email: knb at bkm.dtu.dk | | URL: http://www.bkm.dtu.dk/~knb | -------------------------------------------------------------