# CubicSpline interpolation with $x = (0, \frac{1}{4}, \frac{1}{2}, \frac{3}{4},1)^T, y = (1, 0 , 2, -1, 1)^T$

$$x = (0, \frac{1}{4}, \frac{1}{2}, \frac{3}{4},1)^T, y = (1, 0 , 2, -1, 1)^T$$

Here is what I tried, but it looks like I have too many equations in comparison to unknowns. $$\left[0, \frac{1}{4}\right]: S_0(x) = a_0 + b_0(x-0) + c_0 (x-0)^2 + d_0(x-0)^3 \\ \left[\frac{1}{4}, \frac{1}{2}\right]: S_1(x) = a_1 + b_1(x-\frac{1}{4})+c_1(x-\frac{1}{4})^2 + d_1(x-\frac{1}{4})^3 \\ \left[\frac{1}{2}, \frac{3}{4}\right]: S_2(x) =a_2 + b_2(x-\frac{1}{2})+c_2(x-\frac{1}{2})^2 + d_2(x-\frac{1}{2})^3 \\ \left[\frac{3}{4};1\right]: S_3(x) = =a_3 + b_3(x-\frac{3}{4})+c_3(x-\frac{3}{4})^2 + d_3(x-\frac{3}{4})^3 \\S_0(0) = a_0 = 1;\ \ S_0(\frac{1}{4}) = 0 \Rightarrow \frac{1}{4}b_0 +\frac{1}{16}c_0 + \frac{1}{64}d_0 = -1 \\ S_1(\frac{1}{4}) = 0 \Rightarrow a_1 = 0 \\ S_1(\frac{1}{2}) = 2 \Rightarrow \frac{1}{4}b_1 +\frac{1}{16}c_1 + \frac{1}{64}d_1 = 2 \\ S_2(\frac{1}{2})= \frac{1}{2} \Rightarrow a_2 = \frac{1}{2} \\ S_2(\frac{3}{4})= \frac{1}{2}b_2+\frac{1}{4}c_2+\frac{1}{8}d_2 = -\frac{1}{2}-1 = -\frac{3}{2}\\ S_3(\frac{3}{4}) = -1 \Rightarrow a_3 = -1; \ \ S_3(1) = \frac{1}{4}b_3 +\frac{1}{16}c_3+\frac{1}{64}d_3 = 2 \\ S_0' = b_0 +2c_0(x-0) + 3d_0 (x-0)^2; \ \ S_1' = b_1 +2c_1(x-\frac{1}{4}) + 3d_1 (x-\frac{1}{4})^2 \\ S_2' = b_2 +2c_2(x-\frac{1}{2}) + 3d_2(x-\frac{1}{2})^2; \ \ S_3'= b_3 +2c_3(x-\frac{3}{4}) + 3d_3(x-\frac{3}{4})^2 \\ S_0'(\frac{1}{4}) = S_1'(\frac{1}{4}) \Rightarrow b_0 + \frac{1}{2}c_0 +\frac{3}{16}d_0 = b_1 \\ S_1'(\frac{1}{2}) = S_2'(\frac{1}{2}) \Rightarrow b_1 + \frac{1}{2}c_1+\frac{3}{16} = b_2 \\S_2'(\frac{3}{4}) = S_3'(\frac{3}{4}) \Rightarrow b_2 + \frac{1}{2}c_2+\frac{3}{16}d_2 = b_3 \\ S_0'' = 2c_0+6d_0(x-0); \ \ S_1'' = 2c_1 + 6d_1(x-\frac{1}{4}); \ \ S_2'' = 2c_2+6d_2(x-\frac{1}{2}) \ \ S''_3 = 2c_3+6d_3(x-\frac{3}{4}) \\ S_0''(\frac{1}{4}) = \S_1''(\frac{1}{4}) \Rightarrow 2c_0 + \frac{3}{2} d_0 = 2c_1; \\ S_1''(\frac{1}{2}) = S_2''(\frac{1}{2}) \Rightarrow 2c_1 + \frac{3}{2}d_1 = 2c_2 \\ S_2''(\frac{3}{4}) = S_3'' (\frac{3}{4}) \Rightarrow 2c_2 - \frac{3}{2}d_2 = 2c_3 \\ S''_0 (0) = 0 \Rightarrow 2c_0 = 0 \Rightarrow c_0 = 0; S''_3(1) = 0 \Rightarrow 2c_3-\frac{3}{2}d_3 = 0$$

• You are on the right track. You list 16 equations with 16 unknowns. So far, you only manager to use 4 equations and find out the value for a0, a1, a2 and a3. So, you are left with 12 unknowns and 12 equations. Keep going and you shall find your solution. – fang Jun 12 at 20:28