Introduction
- Given a set of points:
- We define two functions f1 and f2 that will be our quadratic splines:
Solving the unknowns
- We can solve the unknowns in these equations.
- First we plug in our known values:
- This gives us a system of linear equations:
- Which simplifies to:
- An extra contraint we can add to this system is that the gradient of the two splines should be equal at the point they meet:
- First we find the derivitives of our two functions:
- And then solve them at x = 0.5:
- And finally set them equal to each other and re-arrange
- We now have 5 equations, but 6 unknowns
- So it's not quite solvable yet
- However we can rewrite each of the terms with respect to a1:
Solving a1
- There are several different options for solving a1
- But in order to compare them, let's start with a more complex problem:
- Given a new set of points:
- We can perform the same steps as above to produce a set of coefficients for our 4 splines:
a1 = 0
- One simple solution is to set a1 to 0:
- This system is now solvable, giving:
- Which produces splines of:
- Setting a1 to 0 makes it easy and efficient to compute the splines.
- However the first spline is a straight line.
- And all other splines have large gradients.
a1 = a2
- Another simple solution would be to set a1 to a2
- The system is now solvable, giving:
- Which produces splines of:
- The first two splines are equal
- The average gradient of the splines is less than for a1 = 0
Minimizing the gradients of the splines
- An ideal interpolation minimizes the amount that each spline curves
- We can describe this mathematically as minimizing the mean squared error of the a terms:
- First we get all the a terms with respect to a1:
- Then the error function contains a single term:
- We can find its minimum by finding the derivitive:
- And solving for 0:
- If we now use a1 = 5.7 as an extra equation in our system, it solves as:
- Which produces splines of:
- The average gradient of the splines is minimized
- However solving a1 was complicated and required finding the derivative of the error function
Comparison
- The value we choose for a1 makes a big difference for subsequent splines
- using mean square error (mse) to minimize the average gradient produces splines that have the least deviation against a linear interpolation
- However it is by far the most complex option
- If we increase the number of points we are interpolating, the changes get even more pronounced: