## Interpolation

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

### Linear Interpolation

We start with linear interpolation, which fits a polynomial of degree 1 (or linear function) in each interval. By definition, the interpolated values will change linearly within each interval (between two consecutive data points), and at each intermediate $$t_i$$ from $$t_1$$ to $$t_{n-1}$$, the left and right polynomials will meet.

We explain the approach using a generic interval- say, the interval between the data points $$(t_i, f_i)$$ and $$(t_{i+1}, f_{i+1})$$. You may remember the linear equation as:

$$P_{i}(t)= a_i + b_i (t-t_i)$$

Where $$a_i$$ and $$b_i$$ represent the intercept and the slope, respectively; and $$P_{i}(t)$$ represent the interpolating polynomial for the interval $$t_i$$ to $$t_{i+1}$$ (We will have n such functions to cover the whole range from $$t_0$$ to $$t_n$$). We can solve this equation for $$a_i$$ and $$b_i$$ using the two known values at both ends of the interval. However, we present the interpolating function in an alternative form in the spirit of Langrange polynomial:

$$P_{i}(t)= a_i (t_{i+1}-t) + a_{i+1} (t-t_i)$$

We require that the value of the interpolating polynomial matches the value of the function at both ends of the interval:

$$P_{i}(t_i)=f_i$$ $$P_{i}(t_{i+1})=f_{i+1}$$

Equating the values, we get solution of $$a_i$$ and $$a_{i+1}$$:

$$P_{i}(t_i)=f_i \quad \Rightarrow \quad a_i (t_{i+1}-t_i) =f_i \quad \Rightarrow \quad a_i = \frac{1}{(t_{i+1}-t_i)} f_i$$ $$P_{i}(t_{i+1})=f_{i+1} \quad \Rightarrow \quad a_{i+1} (t_{i+1}-t_i) =f_{i+1} \quad \Rightarrow \quad a_{i+1} = \frac{1}{(t_{i+1}-t_i)} f_{i+1}$$

Substituting for $$a_i$$ and $$a_{i+1}$$ and rearranging, we get our linear interpolation formula:

$$P_{i}(t)= a_i (t_{i+1}-t) + a_{i+1} (t-t_i)$$ $$\quad = \frac{(t_{i+1}-t)}{(t_{i+1}-t_i)} f_i + \frac{(t-t_i)}{(t_{i+1}-t_i)} f_{i+1}$$

This is the linear interpolation formula. Now to find interpolated value for a given t, we just need to find the interval that brackets the given t, and then calculate the interpolated value using the above formula.