Computational Methods in Physics ASU Physics PHY 494

07 Integration

Numerical integration is based on the Riemann definition of an integral

In the simplest algorithm, the integral can be approximated by the finite sum over rectangles of width and height corresponding to the value of the function.

Riemann sum. (Based on a figure Copyright (c) 2012 Landau, Paez, Bordeianu, used under CC-BY-NC-SA 3.0 license and licensed under CC-BY-NC-SA 4.0)

More sophisticated algorithms are then variations on this theme (with the exception of Monte Carlo integration, which randomly samples the integrand and which is the preferred technique for higher-dimensional integrals).

Instead of writing our own integration algorithms we typically used tried and tested and highly optimized code in libraries (or modules as they are called in Python) such as scipy.integrate, which is part of SciPy.

Class Material

You can follow the lecture in the slides 07_integration.ipynb.

Additional resources

  • Computational Physics: Ch 5.7 – 5.22
  • scipy.integrate for high performance integration algorithms for Python