Namespace: MathNet.Numerics.Interpolation
Interpolation is a two-phased operation in Math.NET Numerics:
- Create an interpolation scheme for the chosen algorithm and optimized for the given sample points. You get back a class that implements the IInterpolation interface.
- Use this scheme to compute values at arbitrary points. Some interpolation algorithms also allow you to compute the derivative and the indefinite integral at that point.
The static Interpolate
class provides simple factory methods to create the interpolation scheme in a simple method call:
- RationalWithoutPoles, creates a Floater-Hormann barycentric interpolation
- RationalWithPoles, creates a Bulirsch & Stoer rational interpolation
- LinearBetweenPoints, creates a linear spline interpolation
If unsure, we recommend using RationalWithoutPoles for most cases.
Alternatively you can also use the algorithms directly, they're publicly available in the Algorithms sub-namespace for those who want to use a specific algorithm. The following algorithms are available:
- Polynomial: Barycentric Algorithm
- Rational pole-free: Barycentric Floater-Hormann Algorithm
- Rational with poles: Bulirsch & Stoer Algorithm
- Neville Polynomial: Neville Algorithm. Note that the Neville algorithm performs very badly on equidistant points. If you need to interpolate a polynomial on equidistant points, we recommend to use the barycentric algorithm instead.
- Linear Spline
- Cubic Spline with boundary conditions
- Natural Cubic Spline
- Akima Cubic Spline
- Monotone Cubic Spline: Monotone-preserving piecewise cubic Hermite interpolating polynomial (PCHIP), based on Fritsch & Carlson (1980).
- Generic Barycentric Interpolation, requires barycentric weights
- Generic Spline, requires spline coefficients
- Generic Cubic Hermite Spline, requires the derivatives