Given a function \(f\) and a set of values \(x_i\), interpolation is the creation of a curve that passes through the points \(\left(x_i, f\left(x_i\right)\right)\) which is used to approximate the function within the intervals defined by adjacent pairs of the values, typically because only a sample of the function is known.

One of the simplest approaches is linear interpolation in which the adjacent points are connected by straight lines
\[ f(x) \approx f(x_i) + \frac{x-x_i}{x_{i+1}-x_i}\left(f\left(x_{i+1}\right)-f\left(x_i\right)\right) \]
for \(x\) in \(\left[x_i, x_{i+1}\right]\).