MathGroup Archive 2009

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

Search the Archive

Re: NIntegrate & Integrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100094] Re: NIntegrate & Integrate
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Fri, 22 May 2009 23:42:10 -0400 (EDT)

On 5/22/09 at 1:47 AM, kzhuravl at mtu.edu (Konstantin) wrote:

>Easy question for Mathematica. Evaluate definite integral: 2*Cos[x]
>from 8.76 to 4.56.

>I have evaluated it three different ways: Integrate, NIntegrate and
>Integral sign from basic math input palette.

>Here is the code(without Integral sign from basic math input
>palette):

>Clear[x]
>{a, b} = {8.76, 4.56};
>NIntegrate[2*Cos[x], {x, a, b}]
>Clear[x]
>Integrate[2*Cos[x], {x, a, b}]

>My output is:

>3.21059(NIntegrate)
>-3.21059(Integrate)

>The right answer is -3.21059.

>Why does NIntegrate gave me wrong answer?

I cannot reproduce your results above. I get the correct value
by simply pasting your code up to the line for NIntegrate into a
fresh session. That is:

In[1]:= {a, b} = {8.76, 4.56};
NIntegrate[2*Cos[x], {x, a, b}]

Out[2]= -3.21059

In[3]:= $Version

Out[3]= 7.0 for Mac OS X x86 (64-bit) (February 19, 2009)



  • Prev by Date: Apply function breaks Parallelize?
  • Next by Date: Re: Basic question about Mathematica Interface
  • Previous by thread: Re: NIntegrate & Integrate
  • Next by thread: Re: NIntegrate & Integrate