Re: NIntegrate of a Decaying Exponential

*To*: mathgroup at smc.vnet.net*Subject*: [mg15180] Re: NIntegrate of a Decaying Exponential*From*: "Allan Hayes" <hay at haystack.demon.co.uk>*Date*: Fri, 18 Dec 1998 02:10:57 -0500*References*: <75a179$rv3@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Wretch wrote in message <75a179$rv3 at smc.vnet.net>... ........ >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! ......... Hi, Messages are turned off and on in this way Off[NIntegrate::"ploss"] On[NIntegrate::"ploss"] However I don't get the message that you report: With $Version "Microsoft Windows 3.0 (April 25, 1997)" NIntegrate[-2 v Exp[-v^2],{v,-1,2}] -0.349564 In fact the integral can be computed sybolically a Integrate[-2 v Exp[-v^2],{v,-1,2}] 1/E^4 - 1/E N[%] -0.349564 However, I get the message if I set the PrecisionGoal high enough. NIntegrate[-2 v Exp[-v^2],{v,-1,2}, PrecisionGoal->16] 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." -0.349564 Now turn off the message Off[NIntegrate::"ploss"] Check: NIntegrate[-2 v Exp[-v^2],{v,-1,2}, PrecisionGoal->16] -0.349564 And turned back On[NIntegrate::"ploss"] Allan --------------------- Allan Hayes www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565