HermiteInterpolation
See project page at HermiteInterpolation for more examples.
HermiteInterpolation.fit
— Functionfit(x, y, [y′, y″, ...])
Builds a polynomial fit to the sample points $x$ with labels $y$. The remaining, optional arguments may provide derivative data, $dⁿy/dxⁿ$ for $n = 1, … m-1$. The Hermite interpolation procedure returns a unique polynomial of degree less than $m n$. Absent derivative data ($m = 1$) the method reduces to Lagrange interpolation.
As an example, one can infer the function $y = x²$ from three labeled points:
f = HermiteInterpolation.fit([0, 1, 2], [0, 1, 4])
@assert f(3) ≈ 9
Or from a single point with derivative and curvature data:
f = HermiteInterpolation.fit([0], [0], [0], [2])
@assert f(3) ≈ 9
The fitting algorithm involves building a divided difference table, as described on Wikipedia.