Chapter 5
Interpolation
The programs below provide compact reference implementations of several interpolation methods discussed in Chapter 5. Each step of the algorithms is kept explicit, making it easy to compare the same calculation in MATLAB, Python, C++, and Fortran. For larger scientific applications, tested library routines may be preferable; see the Chapter 5 Resources page for language-specific options.
| Program | MATLAB | Python | C++ | Fortran |
|---|---|---|---|---|
| Local Lagrange interpolation Lagrange interpolation of user-selected degree using neighboring data points. | Download | Download | Download | Download |
| Runge phenomenon and Chebyshev nodes Compares global Lagrange interpolants constructed from equally spaced and Chebyshev nodes, showing how node placement affects endpoint oscillations and interpolation error. | Download | Download | Download | Download |
| Cubic spline interpolation Cubic spline construction and evaluation, with the coefficients obtained by solving the corresponding tridiagonal linear system. | Download | Download | Download | Download |