Skip to content

Files

Latest commit

2ba8c94 · Aug 8, 2021

History

History
54 lines (37 loc) · 2.3 KB

Interpolation.md

File metadata and controls

54 lines (37 loc) · 2.3 KB
[hide]
#I "../../out/lib/net40"
#r "MathNet.Numerics.dll"
#r "MathNet.Numerics.FSharp.dll"
open System.Numerics
open MathNet.Numerics
open MathNet.Numerics.Interpolation

Interpolation

Namespace: MathNet.Numerics.Interpolation

Interpolation is a two-phased operation in Math.NET Numerics:

  1. 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.
  2. 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:

Interpolation on equidistant sample points

  • Polynomial: Barycentric Algorithm

Interpolation on arbitrary sample points

  • 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).

Interpolation with additional data

  • Generic Barycentric Interpolation, requires barycentric weights
  • Generic Spline, requires spline coefficients
  • Generic Cubic Hermite Spline, requires the derivatives