The cubic Hermitian interpolation algorithm uses a cubic polynomial to interpolate between 2 points with given slope at both points. In case the slope at each point is given, this algorithm can interpolate a smooth shape between random numbers of supporting points without big tendency to oscillate. That can be quite useful in some cases.
In some descriptions they are talking about a Lagrange function in relation to this interpolation algorithm. I wonder where they found that. At least for the cubic version I cannot see any reference to a Lagrange function here
If the cubic function for the interpolation is
The derivation of this is:
With two simple points: One at x = 0 and the other one at x = 1, we get:
and
And with the given function values y1 and y2 and the slopes p1 and p2
and
And with these inserted in the upper formulations
or a bit reformed
This matrix equation for c2 and c3 can be resolved for c2:
And with this inserted in the upper equation again:
And with
We get for the entire function
Or sorted for y1 and y2 and the slopes p1 and p2
or
That’s how it is usually written
With two supporting points (0;1) and (1;1.05) and p1= -0.1 and p2=0.12 that would look like:
An interesting view is the comparison of the weight of each value in this graph:
Now, if there is an interval not from 0 to 1 but from a to b, x just has to be substituted by
That’s all. And there is nothing of a Lagrange function in it
The demo project consists of one window:
I entered 6 supporting points (x_k, y_k) with their slope p_k. These values can be edited and the recalculation of the interpolated shape shows immediately the effect.
The algorithm is quite simple but in my opinion it has one big disadvantage: You have to know the slopes in each supporting point and this is not always given