# Interpolation

Given a set of points, we want to model the general trend of the points by finding a smooth curve that fits the dataset. This is actually what we do in machine learning.

Problem Formulation

Given . estimate for any point such that .

### CS370

2 ways to go about interpolation:

When there are very few points (<6), we do Polynomial Interpolation

However, then, when there are lots of points, your 1 function might be of degree too high and it wonβt be as smooth anymore. Therefore, a better strategy is to use Piecewise Interpolation

There also is another category of interpolation called Hermite Interpolation, where we want to set the derivatives at control points.

### Polynomial Interpolation

If we have 5 points, we can find a polynomial of degree 4 passing through these points.

We use the equation below:

Now, it looks very complicated at first, but we can calculate the finite differences very easily. Use the triangular table:

### Interpolation in Python

Thereβs logic for interpolating racing lines.

I need to reference both the TUFTM, and some implementation that the guys at F1TENTH did.

But thereβs this Scipy function for interpolation: