Interpolation and Curve Fitting

Learn about interpolation and curve fitting using SciPy.

Interpolation is a mathematical technique that is used to predict unknown data points that fall between the existing known data points. This technique can be used to approximate a complicated function with a simpler one. Interpolation is used to create smooth and realistic animations or predict values of a function or a variable based on known data points (for example, estimate the population of a country based on a sample).

Linear and spline interpolation

Interpolation can be particularly useful in optimization scenarios where the objective might be too complex to evaluate directly, or there might be missing data points. Interpolation can be used to estimate the function at these points, providing a way to navigate the function and find its optimum. In this lesson, we will discuss two types of interpolation—linear and spline.

Linear interpolation

Linear interpolation is used to construct new data points within the range of known data points. It involves estimating the value of some function, y=f(x)y = f(x), using two known values of that function at the other points, x1x_1 and x2x_2. The formula for linear interpolation is given by the following:

Get hands-on with 1400+ tech skills courses.