Re: NIntegrate of a Decaying Exponential

*To*: mathgroup at smc.vnet.net*Subject*: [mg15171] Re: [mg15137] NIntegrate of a Decaying Exponential*From*: BobHanlon at aol.com*Date*: Thu, 17 Dec 1998 00:27:49 -0500*Sender*: owner-wri-mathgroup at wolfram.com

In a message dated 12/16/98 8:44:51 AM, arc at astro.columbia.edu writes: >Greetings -- I'm trying to get Mathematica to do an integral that >appears regularly in plasma physics problems. It appears to give the >right answer, but it's always accompanied with an annoying error >message whose roots are a bit vague. Here is the function to be >integrated: > >f = -2 v Exp[-v^2] over the v-interval (-1,2) > >The answer should be about -.34956 (according to an IMSL subroutine) > >Here's the mathematica input and output: > >In[1]:=NIntegrate[-2 v Exp[-v^2],{v,-1,2}] Out[1]:=Out[99]=-0.349564 > >NIntegrate::"ploss": > "Numerical integration stopping due to loss of precision. Achieved >\ >neither the requested PrecisionGoal nor AccuracyGoal; suspect highly \ >oscillatory integrand, or the true value of the integral is 0. If your >\ integrand is oscillatory try using the option Method->Oscillatory in >\ NIntegrate." > >So, Mathematica gets it right, but with the mysterious warning. The >error/warning message isn't surprising since the integrand has such a >sharp peak at v=0, but none of the options specified in the help menu, >such as MinRecursion, MaxRecursion, Method->, etc. were of any use in >suppressing this error message. I want to suppress messages of this >sort not only so that I don't have to look at them, but also to have an >extra measure of confidence that the answer is actually right! > AC, $Version Power Macintosh 3.0 (May 6, 1997) I do not get the error message. NIntegrate[-2 v Exp[-v^2], {v, -1, 2}] -0.349564 However, why are you using numerical integration? This function can be integrated. Integrate[-2 v Exp[-v^2], {v, -1, 2}] E^(-4) - E^(-1) % // N -0.349564 Integrate[-2 v Exp[-v^2], {v, -1., 2}] -0.349564 Bob Hanlon