This program is an implementation of numerical integration methods sing the trapezoid method, the Simpson's method and Monte Carlo methods. It is part of Chapter 6 in the computational physics textbook by Landau Landau (2015)1 on numerical integration. It is also a good refresher of the topics I learnt in MH3700 Numerical Analysis I that I took in NTU.
Integrating numerically involves finding the area under the curve of a function.
This method involves approximating the area under the curve of the function as a collection of
where
This method invovles approximating the area under the curve of a function as a collection of
This method involves making use of the mean value theorem in calculus that states that
Where
where
The function to be integrated is a function TheFunction(double x) that is defined in mainwindow.cpp. As it is a 1D integration it accepts a single variable x. An example that evaluates
Footnotes
-
Landau, R. H. (2015). Computational physics problem solving with python. John Wiley & Sons, Incorporated. ↩