Find the coefficients of a cubic spline

208 Views Asked by At

Let $S_3 : [x_0,x_n] \to \mathbb{R}$ be a cubic spline on $I_i=[x_i, x_{i+1}]$ such that $S_3(x_i)=y_i$ and $S_3'(x_i)= z_i, i=0,...,n$
we consider $S_{3,i}$ the restriction of $S_3$ on each interval $I_i$ such that it has the expression : $$S_{3,i}(x)=a(x-x_i)+b(x-x_{i+1})+(x-x_{i})(x-x_{i+1})(\alpha(x-x_{i})+\beta (x-x_{i+1}))$$ So my question is how can i find $a,b,\alpha,\beta$ ?
I've used the Newton and Lagrange methods but still can't find the expression.

1

There are 1 best solutions below

2
On BEST ANSWER

Notice how things cancel out really nicely when you plug your points in. Firstly, we have that

$$S_{3,i}(x_i)=b(x_i-x_{i+1})=y_i$$

and

$$S_{3,i}(x_{i+1})=a(x_{i+1}-x_{i})=y_{i+1},$$

which give us that

$$a=\frac{y_{i+1}}{x_{i+1}-x_i}\quad\text{and}\quad b=-\frac{y_i}{x_{i+1}-x_i}.$$

Now do a similar thing with the derivative $S_{3,i}'$ to find $\alpha$ and $\beta$ (I'll leave the details to you).