# Accuracy and Precision in NIntegrate

Posted 10 years ago
6641 Views
|
2 Replies
|
1 Total Likes
|
 I have two functions that I numerically integrate: NIntegrate[f1] and NIntegrate[f2]. I expect these to be equal and they are until I insert an accuracy goal and working precision requirement. Now they are not equal and the sizes ofÂ  AccuracyGoal and WorkingPrecision do not change the value of the intergral of f1 but they do change the integrated value of f2, and the new value of f2 is independent of the size of the accuracy and precision values. The difference between the integral values of f1 and f2 is always about 5% and constant.One consultant has indicated that the results may be rounding errors or noise but I contend that the difference is real because it does not act like noise.How can you tell?Thanks for the help.Luther
2 Replies
Sort By:
Posted 10 years ago
 May be you have numerical computation cancelation errors. Have you tried the comparison computations with your functions having the signatures f1[x_?NumberQ] and f2[x_?NumberQ] ?
Posted 10 years ago
 Without seeing the definitions of f1 and f2, no-one is going to be able to say for sure what is going on. However, on many occasions, numerical round-off error has appeared systematic when I have worked on solving differential equations. For one thing, the precision tracking used in Mathematica is fundamentally different than the simple round-off used in machine precision. If you examine the following:In[2]:= N[\[Pi],20]Out[2]= 3.1415926535897932385In[3]:= FullForm[%]Out[3]//FullForm= 3.141592653589793238462643383279502884197169399375105820285`20.You can see that in order to achieve 20 digits of accuracy in pi, Mathematica forces itself to use far more digits. This is fundamentally different than simply rounding off machine precision and hoping for the best. This could also yield apparently systematic differences for certain computations.