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

How to declare Integers?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg12966] How to declare Integers?
  • From: wexler at einstein.phys.ufl.edu (Carlos Wexler)
  • Date: Sun, 28 Jun 1998 02:51:54 -0400
  • Organization: University of Florida, Gainesville
  • Sender: owner-wri-mathgroup at wolfram.com

How can one declare a variable to be integer in Mathematica?

Let me just give an example:

	Integrate[Sin[m x]/Sin[x], {x,0,Pi}]    

is well behaved if one explicitly sets m=1,2,3,... BEFORE doing the
integral:

In[1]:= Integrate[Sin[1 x]/Sin[x], {x,0,Pi}] Out[1]= Pi

In[2]:= Integrate[Sin[2 x]/Sin[x], {x,0,Pi}]  Out[2]= 0

but

In[3]:= Integrate[Sin[m x]/Sin[x], {x,0,Pi}] Out[3]= Integrate::"idiv": 
        Integral of Csc[x] Sin[m x] does not converge on {0,Pi}

Other examples include evaluation of Sin[m Pi], etc...

I tried the following trick stated in the manual:

In[4]:=	m/: IntegerQ[m] = True
Out[4]= True

but still Sin[m Pi] does not simplify to 0 nor does Mathematica figures
out that the integral above does converge in this case.

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


			Carlos



----------------------------------------------------------------- Carlos
Wexler                     |  Dept. of Physics, Box 118440
                                  |  University of Florida
                                  |  Gainesville, FL 32611-8440
                                  |  Tel: (352) 392-7334
wexler at phys.ufl.edu               |  FAX: (352) 392-0524
-----------------------------------------------------------------



-- 


-----------------------------------------------------------------


  • Prev by Date: VC++ debugger, Mathematica interface
  • Next by Date: Re: How to Extract a common factor from a Sum
  • Previous by thread: VC++ debugger, Mathematica interface
  • Next by thread: Re: How to declare Integers?