Codes
Source codes are organized by chapter and by numerical method or computational example. Where available, matching implementations are provided in MATLAB, Python, C++, and Fortran.
The same descriptive filename stem is used across programming languages whenever the implementations correspond to the same code.
Chapter 7
Numerical Integration
| Program | MATLAB | Python | C++ | Fortran |
|---|---|---|---|---|
| Composite trapezoidal and Simpson rules Comparison of two basic composite Newton–Cotes methods on successively finer grids. | Download | Download | Download | Download |
| Gauss–Legendre quadrature General n-point Gauss–Legendre integration with nodes and weights generated numerically. | Download | Download | Download | Download |
| Adaptive Simpson integration Adaptive Simpson integration using non-recursive interval subdivision and an error estimate. | Download | Download | Download | |
| Gauss–Kronrod adaptive integration (G7–K15 and G10–K21) Adaptive integration using two embedded Gauss–Kronrod quadrature pairs. | Download | Download | Download | Download |
| QUANC8 adaptive integration Adaptive 8-panel Newton–Cotes integration. | Download | Download | Download | Download |
| Improper integral: infinite interval Maps a semi-infinite domain to a finite interval and applies Gauss–Legendre quadrature. | Download | Download | Download | Download |
| Cauchy principal-value integral Analytical subtraction of a simple pole followed by Gauss–Legendre quadrature. | Download | Download | Download | Download |
| Rapidly oscillating integral Comparison of composite Simpson and quadratic Filon integration for a rapidly oscillating function. | Download | Download | Download | Download |
| Nested Simpson integration in two dimensions Nested one-dimensional Simpson integrations for a two-dimensional problem with a variable inner limit. | Download | Download | Download | |
| Two-dimensional Gauss–Legendre product rule Tensor-product Gauss–Legendre quadrature for a smooth function on a rectangular domain. | Download | Download | Download | Download |