Typical cubic spline calculation involves finding the 2nd derivatives at the interior points such that each interval is defined as
$$ y_i(x) = \left[ \matrix{ 1-\zeta & \zeta & -\frac{h^2}{6} \zeta ( \zeta^2-3 \zeta+2) & \frac{h^2}{6} \zeta (\zeta^2-1)} \right] \pmatrix{y_i \\ y_{i+1} \\ \ddot{y}_i \\ \ddot{y}_{i+1} } $$
where $\zeta = \frac{x-x_i}{h}$ and $h=x_{i+1}-x_{i}$. This formulation leads to a computationally simpler system of equations.
In this case, since we have all the 1st derivatives at hand it might be simpler to transform the 2nd derivative coefficients $\pmatrix{y_i \\ y_{i+1} \\ \ddot{y}_i \\ \ddot{y}_{i+1}}$ to the slopes $\pmatrix{y_i \\ y_{i+1} \\ \dot{y}_i \\ \dot{y}_{i+1}}$. The end result is
$$ y_i(x) = \left[ \matrix{ (1-\zeta)^2 (2\zeta+1) & \zeta^2 (3-2\zeta) & h \zeta (1-\zeta)^2 & -h \zeta^2 (1-\zeta)} \right] \pmatrix{y_i \\ y_{i+1} \\ \dot{y}_i \\ \dot{y}_{i+1} } $$
You have 3 nodes and 2 intervals:
- 1st Interval
- $x_i=0$, $x_{i+1}=0.05$, $h=0.05$
- $y_i=1$, $y_{i+1}=\mathrm{e}^{0.01}$
- $\dot{y}_i=2$, $\dot{y}_{i+1}=2 \mathrm{e}^{0.01}$
$$y_1(x) = \left[ \matrix{(1-20x)^2(40x+1) & 400x^2(3-40x) & x (1-20x)^2 & -20x^2 (1-20x)} \right] \pmatrix{1 \\ \mathrm{e}^{0.01} \\ 2 \\ 2 \mathrm{e}^{0.01} } $$
- 2nd Interval
- $x_i=0.05$, $x_{i+1}=0.1$, $h=0.05$
- $y_i=\mathrm{e}^{0.01}$, $y_{i+1}=\mathrm{e}^{0.02}$
- $\dot{y}_i=2 \mathrm{e}^{0.01}$, $\dot{y}_{i+1}=2 \mathrm{e}^{0.02}$
$$y_1(x) = \left[ \matrix{4(1-10x)^2(40x-1) & 5(1-8x)(20x-1) & \frac{1}{5} (10x-1)^2 (20x-1) & \frac{1}{10} (10x-1)(1-20x)^2 } \right] \pmatrix{1 \\ \mathrm{e}^{0.01} \\ 2 \\ 2 \mathrm{e}^{0.01} } $$
So this is the way I would approach this type of problem, since all the slopes are known. No need to solve a system of equations.
But if you are required to solve this using a system of equations then I would use the following rules:
- Beginning Slope - beginning slope is known as $\dot{y}_i$
$$ \dot{y}_1 = \left[ \matrix{-\frac{1}{h}& \frac{1}{h}} \right] \pmatrix{y_1 \\ y_{2} }+ \left[ \matrix{ -\frac{h}{3} & -\frac{h}{6} }\right] \pmatrix{ \ddot{y}_1 \\ \ddot{y}_{2}}$$
- Ending Slope - the ending slope is known as $\dot{y}_{n}$
$$ \dot{y}_{n} = \left[ \matrix{-\frac{1}{h} & \frac{1}{h}} \right] \pmatrix{y_{n-1} \\ y_{n} }+ \left[ \matrix{ \frac{h}{6} & \frac{h}{3} }\right] \pmatrix{ \ddot{y}_{n-1} \\ \ddot{y}_{n}}$$
- Intermediate Slope Matching - on node $i$ the slopes match when
$$ 0 = \left[ \matrix{\frac{1}{h}&-\frac{2}{h}&\frac{1}{h}} \right] \pmatrix{y_{i-1} \\ y_i \\ y_{i+1} } + \left[ \matrix{-\frac{h}{6}&-\frac{2 h}{3}& -\frac{h}{6}} \right] \pmatrix{\ddot{y}_{i-1} \\ \ddot{y}_i \\ \ddot{y}_{i+1} } $$
With $n$ nodes (points) and $n-1$ intervals the above equations are $2+(n-2)=n$ equations also. Each node has an unknown 2nd derivative $\ddot{y}_i$ so the above is a system of $n$ equations with $n$ unknowns.
Specifically with this problem there are 3 nodes and 2+1 equations
$$ \begin{bmatrix}
\frac{h}{3} & \frac{h}{6} & 0 \\
\frac{h}{6} & \frac{2 h}{3} & \frac{h}{6} \\
0 & \frac{h}{6} & \frac{h}{3}
\end{bmatrix}
\pmatrix{\ddot{y}_1 \\ \ddot{y}_2 \\ \ddot{y}_3 } = \begin{bmatrix}
- \frac{1}{h} & \frac{1}{h} & 0 \\
\frac{1}{h} & -\frac{2}{h} & \frac{1}{h} \\
0 & \frac{1}{h} & -\frac{1}{h}
\end{bmatrix}
\pmatrix{{y}_1 \\ {y}_2 \\ {y}_3 } + \pmatrix{-\dot{y}_1 \\ 0 \\ \dot{y}_3 }
$$