1
$\begingroup$

A practice problem (not homework/assignment).

Given a natural spline S(x) where

a1 + 25x + 9x^2 + x^3 where x is [-3, -1]

26 + a2x + a3x^2 - x^3 where x is [-1, 0]

26 + 19x + a4x^2 + a5x^3 where x is [0, 3]

-163 + 2-8x - 60x^2 + a6x^3 where x is [3,4]

determine the values of a1, a2, ..., a6.

The approach I took to doing this equation was that since I know all the functions need to be connected to each other in this natural spline, I know that the first equation when subbed in with -1, and the second equation when subbed in with -1 will need to equal.

So I get some equation which looks like a1 + a2 - a3 = 6. But then since these are unknowns, I'll probably need to stick it in an augmented matrix to solve for a1..a6. But my question is that for the second and third equation, I acutally get something where everything cancels out, (because of the 0) and I get 26 = 26 which makes me think that there is a free variable in the matrix or I'm doing something wrong.

1 Answers 1

1

Let's denote the 4 cubic polynomials as $f_1(x)$, $f_2(x)$, $f_3(x)$ and $f_4(x)$. For S(x) to be a natural spline, it needs to satisfy the following equations:

$f_1(-1)=f_2(-1)$,
$f_2(0)=f_3(0)$,
$f_3(3)=f_4(3)$,
$f_1'(-1)=f_2'(-1)$,
$f_2'(0)=f_3'(0)$,
$f_3'(3)=f_4'(3)$,
$f_1''(-1)=f_2''(-1)$,
$f_2''(0)=f_3''(0)$,
$f_3''(3)=f_4''(3)$,
$f_1''(-3)=0$, and
$f_4''(4)=0$

Since you only have 6 unknowns, it is natural that you will not need all 11 equations to solve for the 6 unknowns. Therefore, having 26=26 (from $f_2(0)=f_3(0)$) does not mean you cannot solve for the 6 unknowns. Just try to use other equations to solve for the 6 unknowns and then plug in the values to make sure all 11 equations are satisfied.