Solving $c_j$ system of equations for cubic splines?

317 Views Asked by At

The problem is like this :

There are $N$ points $(x_0,y_0),(x_1,y_1),\dots,(x_{N-1},y_{N-1}) \in \mathbb{R}^2$ where $x_0 < x_1 < \cdots < x_{N-1}$. Cubic spline interpolation should give $N-1$ polynomials

$$ S_j(x) = a_j+b_j(x-x_j)+c_j(x-x_j)^2+d_j(x-x_j)^3 $$

where $j \in \{0,1,\dots,N-2\}$

In my text book in the section "Construction of a Cubic Spline"

the author converts a system of $4(n-1)$ (all variables) equations to a system of $(n-1)$ (only$c_i$ variables) by substituting other variables by help of equations taken from conditions

  1. $S_i(x_i) = S_{i+1}(x_i)=y_i$ for $i \in \{0,1,\dots,N-1\}$
  2. $S_i(x_{i+1}) = S_{i+1}(x_{i+1})$ for $i \in \{0,1,\dots,N-1\}$
  3. $S_i^\prime(x_{i+1}) = S^\prime_{i+1}(x_{i+1})$ for $i \in \{0,1,\dots,N-2\}$
  4. $S_i^{\prime\prime}(x_{i+1}) = S^{\prime\prime}_{i+1}(x_{i+1})$ for $i \in \{0,1,\dots,N-2\}$
  5. $S_0^{\prime\prime}(x_{0}) = S^{\prime\prime}_{n-1}(x_{n}) = 0$

My problem is when the text goes on to applying the condition 4 . it says :

"Another relationship between the coefficients of $S_j$ is obtained by defining $c_n = S_i^{\prime\prime}(x_n)/2$ and applying condition (4). Then, for each j = 0, 1,... , n − 1," $$c_{j+1} = c_j + 3 d_j h_j$$

assuming $h_j = x_{j+1} - x_{j}$

The part where it says we define $c_n = S_i^{\prime\prime}(x_n)/2$ does not make sense. Where did the idea of this definition came from? Obviously it did not came from an equation since we have only $s_0$ till $s_{n-1}$ so $c_n $does not exists in any of them.

And how is it compatible with our other assumptions? I mean I could have defined $d_n = S_i^{\prime\prime}(x_n)/2$ or etc. but then I need to justify my choice and say how it is compatible with other parts of the problem.

Actually I was expecting to see the text use condition 5 to get the equation $c_{n-1} = 3 d_{n-1} h_{n-1}$with variables $c_{n-1}$ and $d_{n-1}$ and some how eliminate $d_{n-1}$ and solve the whole system.

1

There are 1 best solutions below

0
On

As you can see, you have $n-1$ equations, and $n+1$ unknowns, so you need to make up two more equations, somehow. There are several ways to do this have some reasonable justification. See the answer to this question for a bit more info.

I agree with you that the two extra equations suggested in your book look like arbitrary magic. Maybe there is some way to make sense of them, but it's not clear without some further explanation.

Possibly the only justification is that this definition of $c_n$ makes the set of equations tidy and easily solvable. In other words, it's just an algebraic trick to makes things look nicer.