pythonscipyinterpolationsplinehermite

Cubic hermit spline interpolation python


I would like to calculate a third-degree polynomial that is defined by its function values and derivatives at specified points.

https://en.wikipedia.org/wiki/Cubic_Hermite_spline

I know of scipy's interpolation methods. Specifically

splprep to interpolate a N-dimensional spline and splev to eveluate its derivatives.

Is there a python routine that takes function values f(x) and derivatives f'(x) corresponding to values x and calculates a spline representation that fits the given data.

To give an example:
I have two object positions in space defined by the coordinates x,y,z and I know the velocity x',y',z' of the object at these positions. Can I now interpolate the path that the object takes between the two points over time t. Taking all the given parameters into account.


Solution

  • You can use BPoly.from_derivatives. The result is a polynomial in the Bernstein basis.