structural:summarization
Linear interpolation

One of the simplest methods is linear interpolation (sometimes known as lerp). Consider the above example of estimating f (2.5). Since 2.5 is midway between 2 and 3, it is reasonable to take f (2.5) midway between f (2) = 0.9093 and f (3) = 0.1411, which yields 0.5252.

Generally, linear interpolation takes two data points, say (x, y) and (x, y), and the interpolant is given by:

This previous equation states that the slope of the new line between (x a, y a) {\displaystyle (x_{a},y_{a})} and (x, y) {\displaystyle (x,y)} is the same as the slope of the line between (x a, y a) {\displaystyle (x_{a},y_{a})} and (x b, y b) {\displaystyle (x_{b},y_{b})}

Linear interpolation is quick and easy, but it is not very precise. Another disadvantage is that the interpolant is not differentiable at the point x.

The following error estimate shows that linear interpolation is not very precise. Denote the function which we want to interpolate by g, and suppose that x lies between x and x and that g is twice continuously differentiable. Then the linear interpolation error is

In words, the error is proportional to the square of the distance between the data points. The error in some other methods, including polynomial interpolation and spline interpolation (described below), is proportional to higher powers of the distance between the data points. These methods also produce smoother interpolants.