We use cookies to enhance your experience on our website. By continuing to use our website, you are agreeing to our use of cookies. You can change your cookie settings at any time. Find out more
Oxford University Press
  OUP Worldwide
Search:
Advanced Search
Printer-Friendly View

Companion Website

Boudreau and Swanson: Applied Computational Physics

Chapter 05: Numerical Quadrature

example code (.tgz)

  • SIMPLEINTEGRATOR: illustrates the use of the SimpleIntegrator class to apply the trapezoid rule.
  • ROMBERGINTEGRATOR: illustrates the use of the RombergIntegrator class.
  • PLOTORDEROFCONVERGENCE: integrates several functions and plots the error as a function of the mesh spacing on a log-log plot.
  • TCHEBY: plots a Tchebyshev polynomial together with its roots using an analytic formula that happens to exist for these polynomials. The program takes command line arguments:
    ../local/bin/tcheby N=val Type=type[1/2]
    where N is the degree of the polynomial.
  • LAGUERRE: plots a Laguerre polynomial together with its roots using the three-term recurrence relation. The program takes command line arguments:
    ../local/bin/laguerre n=val a=val where n is the degree and a is the order of the polynomial.
  • COMPALG: compares the performance of various integration algorithms applied to a simple smooth function.
  • GAUSS: applies Gauss-Legendre integration to the normal distribution, integrating it on the interval [-1,1]. A single command line argument (an integer) determines the number of points used in the integration.

About this book
Price, bibliographic details, and more information on the book