Interpolation

We present the formulae relating to different types of interpolation methodologies.

Piecewise Cubic Hermite Interpolation

This method requires the value of the first derivative in addition to the ordinate (or function value) at each of the given abscissa. Our generic data point becomes \( (t_i,f_i, f^{\prime}_i)\). Usually, the derivative value is not known, and hence at the end of this section, we also give formula for numerically computing the derivative.

The method assumes that the interpolating function is cubic polynomial, and it imposes the following requirements/structures:

  • The function values and its derivatives at the given points \(t_0\) to \(t_n\) matches the given ordinates and derivatives, giving us 2(n+1) conditions.
  • The function and its first derivative are continuous, giving us additional 2(n-1) conditions. That is, at each of the interior points \(t_1 \) to \( t_{n-1}\), the following holds:

$$ P_{i}(t_i)= P_{i-1}(t_i) $$ $$ P_{i}^{\prime}(t_i)= P_{i-1}^{\prime}(t_i) $$

As a cubic polynomial has 4 parameters, and we have n polynomials to fit, we need to determine 4n variables. The requirements we imposed give us exactly 4n conditions: \(4n=2(n+1)+2(n-1)\). We can thus solve the system using algebra; however, there is a more elegant way to determine the coefficients which take advantage of the structure of the conditions.

The Interpolating Cubic Polynomial

The cubic polynomial interpolating function for a generic interval can be written as:

$$ P_{i}(t)= a_i + b_i (t-t_i)+c_i (t-t_i)^2 + d_i (t-t_i)^3 $$

Where \(a_i\), \( b_i \), \(c_i\), and \(d_i\) are constants to be determined. The derivative of the polynomial is:

$$ P^{\prime}_{i}(t)= b_i + 2 c_i (t-t_i) + 3 d_i (t-t_i)^2 $$

We require that the value of the interpolating polynomial matches the value of the given ordinate, and its first derivative also matches the given derivative, at both ends of the interval:

$$ P_{i}(t_i)=f_i$$ $$ P_{i}(t_{i+1})=f_{i+1}$$ $$ P^{\prime}_{i}(t_i)=f^{\prime}_i$$ $$ P^{\prime}_{i}(t_{i+1})=f^{\prime}_{i+1} $$

Equating the values and the first derivatives at the left end (substituting \(t_i\) for t ), we get solution of \( a_i \) and \( b_i \):

$$ P_{i}(t_i)=f_i \quad \Rightarrow \quad a_i=f_i $$ $$ P^{\prime}_{i}(t_i)=f^{\prime}_i \quad \Rightarrow \quad b_i=f^{\prime}_i $$

Now equating the values and the first derivatives at the right end, we get:

$$ P_{i}(t_{i+1})=f_{i+1} \quad \Rightarrow \quad a_i + b_i (t_{i+1}-t_i)+c_i (t_{i+1}-t_i)^2 + d_i (t_{i+1}-t_i)^3 =f_{i+1} $$ $$ P^{\prime}_{i}(t_{i+1})=f^{\prime}_{i+1} \quad \Rightarrow \quad b_i + 2 c_i (t_{i+1}-t_i) + 3 d_i (t_{i+1}-t_i)^2=f^{\prime}_{i+1} $$

Substituting for \(a_i\) and \(b_i\) and rearranging, we are left with two equations in two unknowns:

$$ c_i (t_{i+1}-t_i)^2 + d_i (t_{i+1}-t_i)^3 =f_{i+1} - f_i - f^{\prime}_i (t_{i+1}-t_i) $$ $$ 2 c_i (t_{i+1}-t_i) + 3 d_i (t_{i+1}-t_i)^2=f^{\prime}_{i+1}- f^{\prime}_i $$

Which we can solve to get \(c_i \) and \( d_i\):

$$ c_i (t_{i+1}-t_i)^2 =3 f_{i+1} - 3 f_i - 3 f^{\prime}_i (t_{i+1}-t_i)-f^{\prime}_{i+1} (t_{i+1}-t_i) + f^{\prime}_i (t_{i+1}-t_i) $$ $$ \Rightarrow c_i =\frac{3 (f_{i+1} - f_i )}{(t_{i+1}-t_i)^2}- \frac{ f^{\prime}_{i+1} + 2 f^{\prime}_i}{t_{i+1}-t_i} $$ $$ d_i (t_{i+1}-t_i)^3 = f^{\prime}_{i+1} (t_{i+1}-t_i) - f^{\prime}_i (t_{i+1}-t_i) - 2 f_{i+1} + 2 f_i + 2 f^{\prime}_i (t_{i+1}-t_i) $$ $$ \Rightarrow d_i = \frac{f^{\prime}_{i+1} + f^{\prime}_i}{ (t_{i+1}-t_i)^2 } - \frac{ 2(f_{i+1} -f_i )}{ (t_{i+1}-t_i)^3 } $$

Substituting the \(a_i\), \( b_i \), \(c_i\), and \(d_i\) into the cubic polynomial gives the interpolating polynomials in terms of the input data:

$$ P_{i}(t)= a_i + b_i (t-t_i)+c_i (t-t_i)^2 + d_i (t-t_i)^3 $$ $$ \quad= f_i + f^{\prime}_i (t-t_i)+ \left( \frac{3 (f_{i+1} - f_i )}{(t_{i+1}-t_i)^2}- \frac{ f^{\prime}_{i+1} + 2 f^{\prime}_i}{t_{i+1}-t_i}\right) (t-t_i)^2 + \left( \frac{f^{\prime}_{i+1} + f^{\prime}_i}{ (t_{i+1}-t_i)^2 } - \frac{ 2(f_{i+1} -f_i )}{ (t_{i+1}-t_i)^3 }\right) (t-t_i)^3 $$

Computing the Derivative

In most applications, we do not have the derivative of the input functions as interpolation is normally employed in situations where we are given abscissae and ordinates only. A popular approach uses parabola through three data points:

$$ P_{i}(x)= f_{i-1} + (x-x_{i-1}) m_{i-1} + (x-x_{i-1})(x-x_i) \frac{m_i-m_{i-1}}{\Delta x_{i-1} + \Delta x_i} $$

Where:

$$ m_{i}= \frac{f_{i+1}-f_i}{\Delta x_i} $$

The first derivative of the parabolic function can be easily calculated:

$$ P^{\prime}_{i}(x)= m_{i-1} + \frac{m_i-m_i}{\Delta x_{i-1} + \Delta x_i} (2x-x_{i-1}-x_i ) $$ $$ \Rightarrow P^{\prime}_{i}(x_i)= m_{i-1} + \frac{m_i-m_{i-1}}{\Delta x_{i-1} + \Delta x_i} (x_i-x_{i-1}) $$ $$ \quad \quad \quad= \frac{m_{i-1} \Delta x_{i-1} + m_{i-1} \Delta x_i + m_i \Delta x_{i-1}-m_{i-1} \Delta x_{i-1}}{\Delta x_{i-1} + \Delta x_i} $$ $$ \quad \quad \quad= \frac{m_{i-1} \Delta x_i + m_i \Delta x_{i-1}}{\Delta x_{i-1} + \Delta x_i} $$