Numerical Integration: Computer inquiry into efficiency of numerical integration methods
Efficiency of numeric integration (programming assignment)
Nothing beats the mathematical analysis of truncation errors, but it is also possible and advisable to experimentally study behaviour of implementations of numerical integration methods. For example, for integrals that can be calculated exactly in numerical integration methods, you can systematically reduce the mesh size and check how many decimal places become correct in the numerical integration result. You will do this kind of inquiry in an assignment format.
Programming task
You have already made your own implementations of left point, right point and midpoint Riemann sums, the trapezoidal rule and Simpson's rule in previous assignments.
- For each of these methods, find out how many sub-intervals are needed to approximate \(\displaystyle \int_0^1\frac{4}{x^2+1}\dd x\) with precision 0.1, 0.01, 0.001, and 0.0001.
- For each of these methods, find out how many division intervals are needed to approximate \(\displaystyle \int_0^{\pi}\sin(x)\,\dd x\) with a precision of 1 to 7 decimal places.
- Do your findings agree with the theoretical truncation errors for the integration method?
- Which integration method is most efficient? Which method is second best?
Unlock full access