Is Finite Precision Arithmetic Affecting Your Numerical Integration Accuracy?

In summary: The increase is not due to the inherent error of the methods -- the inherent error goes to zero as the number of strips increases.In summary, the method can be inaccurate if dx is small, but a better approach is to sort the terms before adding them.
  • #1
dichotomy
24
0
we've a basic numerical integration assignment, using simpsons/trapezium rule to calculate some non analytical function.

Logic suggests that you use as many "strips" as possible (ie. as small a value of dx as possible) to estimate the value of the integral, however I've seen some graph some time ago showing how error can actually start to increase with smaller dx's, because of floating point rounding, and the inherent error of the methods. anyone seen/got anything like this (for a 32bit computer??)
 
Technology news on Phys.org
  • #2
Using finite arithmetic, making the step size too small does indeed lead to loss of accuracy. The attached plots show how step size affects integration accuracy for a variety of integrators. The problems investigated are a torque-free symmetric top and a circular orbit in a spherically symmetric gravity field.
 

Attachments

  • symmetric_top_integ_error.jpg
    symmetric_top_integ_error.jpg
    15 KB · Views: 440
  • circular_orbit_integ_error.jpg
    circular_orbit_integ_error.jpg
    15.3 KB · Views: 477
  • #3
Yep, its a well known fact of life.

Often higher order methods are a good workround, as DH's graphs illustrate.

Another good rule of thumb is: never do ANY "serious" computing in 32-bit precision.
 
  • #4
All of my integration work was done in IEEE double precision: 64 bit doubles. I would never do anything but graphics using floats (32 bit doubles).
 
  • #5
The OP referred to 32-bit.

I guessed DH used 64-bit, otherwise the errors of 1e-10 would be hard to explain :wink:
 
  • #6
dichotomy said:
we've a basic numerical integration assignment, using simpsons/trapezium rule to calculate some non analytical function.
It irrelevant here, but I bet your function is analytic.


Logic suggests that you use as many "strips" as possible (ie. as small a value of dx as possible) to estimate the value of the integral, however I've seen some graph some time ago showing how error can actually start to increase with smaller dx's, because of floating point rounding, and the inherent error of the methods. anyone seen/got anything like this (for a 32bit computer??)
The increase is not due to the inherent error of the methods -- the inherent error goes to zero as the number of strips increases.

One thing you could try is to sort your numbers before adding them: you usually get more accurate results if you always add the smallest 2 numbers in your list of things to be added.
 
  • #7
Hurkyl said:
The increase is not due to the inherent error of the methods -- the inherent error goes to zero as the number of strips increases.

This is not true when one uses finite arithmetic, for example using the 32 and 64 bit floating point representations(floats and doubles) available in most computer languages. Nasty things happen when [itex](1+10^{-16})-1 = 0[/itex].
 
  • #8
Yes, but that's a fault of the floating point arithmetic used, not the approximation method used.
 
  • #9
Hurkyl said:
Yes, but that's a fault of the floating point arithmetic used, not the approximation method used.

I agree that the intrinsic (infinite precision) error for any numerical integration technique (quadrature or differential equations) must go to zero as the step size goes to zero. This condition is a sine qua non for numerical integration; failing this condition means you don't have an integrator.

However, different numerical quadrature and numerical differential equation integration techniques display different susceptibility to finite precision arithmetic. It is important to know how the use of finite precision arithmetic impacts the accuracy of the results of a numerical integration.

Hurkyl said:
One thing you could try is to sort your numbers before adding them: you usually get more accurate results if you always add the smallest 2 numbers in your list of things to be added.

Sometimes its the other way around. If the list of terms sorted by magnitude has alternating signs, you usually get more accurate results if you sum the largest terms first.
 

Related to Is Finite Precision Arithmetic Affecting Your Numerical Integration Accuracy?

1. What is numerical integration error?

Numerical integration error refers to the discrepancy between the exact solution and the approximation obtained through numerical integration methods. It is caused by the limitations of using numerical methods to approximate a mathematical function instead of solving it analytically.

2. What are the sources of numerical integration error?

The main sources of numerical integration error include the choice of integration method, the number of intervals used, and the accuracy of the input data. Other factors such as round-off errors, truncation errors, and machine precision can also contribute to the overall error.

3. How can numerical integration error be reduced?

Numerical integration error can be reduced by using more accurate integration methods, increasing the number of intervals, and using higher precision input data. Additionally, performing error analysis and selecting an appropriate integration method based on the function being integrated can also help reduce error.

4. What is the difference between absolute and relative numerical integration error?

Absolute numerical integration error measures the difference between the exact and approximate solutions in the units of the solution, while relative numerical integration error measures the error as a percentage of the exact solution. Absolute error is more useful when the exact solution is known, while relative error is more useful when comparing different approximations of the same integral.

5. How can numerical integration error affect the accuracy of scientific results?

Numerical integration error can significantly impact the accuracy of scientific results, especially when dealing with complex mathematical functions. Large errors can lead to incorrect conclusions and unreliable predictions. Therefore, it is essential to carefully consider and reduce numerical integration error in scientific calculations.

Similar threads

  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
Replies
5
Views
4K
Replies
14
Views
2K
Replies
5
Views
3K
  • Calculus
Replies
1
Views
2K
  • STEM Academic Advising
Replies
13
Views
2K
  • Advanced Physics Homework Help
Replies
1
Views
1K
Back
Top