Re: more questions about NIntegrate

*To*: mathgroup at smc.vnet.net*Subject*: [mg124995] Re: more questions about NIntegrate*From*: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>*Date*: Fri, 17 Feb 2012 06:22:31 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com

Hi, I need to use NIntegrate to obtain highly accurate values of some integral. The relative error should be 1.E-16 or smaller. Is this possible? I am not sure how to proceed. NIntegrate has a number of confusing options: AccuracyGoal, PrecisionGoal and WorkingPrecision. I am playing with these, trying to set them to various values, but whatever I do I obtain results which do not seem to have an error smaller than 1.E-7 or so. I would appreciate an advice. Leslaw Hi, Leslaw, From your post it is not unequivocal, what do you need. 1. The result of numerical integration depends upon the integrand and the numerical method applied as well as some options. If this is your question, check Menu/Help/tutorial/NIntegrateOverview. 2. Your question may be also understood in such a way, that you have already chosen an adequate method, and now you simply need to optimize the result within this method and, therefore, you play with PrecisionGoal etc. You may want to apply to your integral the procedure I applied below to an example integral, just to estimate, what do you gain by increasing the PrecisionGoal. Note that its default value is half of the WorkingPrecision, that gives us 8. tab=Table[{i,NIntegrate[Exp[-x^4],{x,-\[Infinity],\[Infinity]},WorkingPrecision->16]-NIntegrate[Exp[-x^4],{x,-\[Infinity],\[Infinity]},WorkingPrecision->16,PrecisionGoal->i]},{i,8,16}] {{8,1.760*10^-12},{9,1.760*10^-12},{10,1.760*10^-12},{11,1.760*10^-12},{12,1.760*10^-12},{13,1.760*10^-12},{14,1.760*10^-12},{15,1.760*10^-12},{16,1.760*10^-12}} You may want to have look at a list: ListLinePlot[tab] Now it is up to you to decide, where to stop. For the reason I do not understand I could not go beyond PrecisionGoal->16 here. 3. The third possibility is that you only need to visualize the output of NIntegrate up to the 16th figure after comma. In this case NumberForm may help. For example: NumberForm[NIntegrate[x^2*Exp[-x^4],{x,-\[Infinity],\[Infinity]}],{17,16}] 0.6127083512325886 Have fun, Alexei Alexei BOULBITCH, Dr., habil. IEE S.A. ZAE Weiergewan, 11, rue Edmond Reuter, L-5326 Contern, LUXEMBOURG Office phone : +352-2454-2566 Office fax: +352-2454-3566 mobile phone: +49 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu<mailto:alexei.boulbitch at iee.lu>