Interpolation: Cubic Splines Implementation
Given: \(x_i\), \(y_i\), \(i = 0, 1, \dots, n\).
These lead to a tridiagonal system of equations.
\[ \begin{bmatrix} 1 & 0 & 0 & & & & & \\ h_1 & 2\delta_1 & h_2 & & & & & \\ &h_2 & 2\delta_2 & h_3 & & & & \\ & & \ddots & \ddots & \ddots & & & \\ & & & h_{i} & 2\delta_i & h_{i+1} & & \\ & & & & \ddots & \ddots & \ddots & \\ & & & & & h_{n-1} & 2\delta_{n-1} & h_{n} \\ & & & & & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} z_0\\z_1\\z_2\\\vdots\\z_i\\\vdots\\z_{n-1}\\z_n \end{bmatrix} = \begin{bmatrix} 0\\B_1\\B_2\\\vdots\\B_i\\\vdots\\B_{n-1}\\0 \end{bmatrix} \]
\[ \begin{bmatrix} 1 & h'_1 & & & & & & \\ & 1 & h'_2 & & & & & \\ & & 1 & h'_3 & & & & \\ & & & \ddots & \ddots & & & \\ & & & & 1 & h'_{i+1} & & \\ & & & & & \ddots & \ddots & \\ & & & & & & 1 & h'_{n} \\ & & & & & & & 1 \end{bmatrix} \begin{bmatrix} z_0\\z_1\\z_2\\\vdots\\z_i\\\vdots\\z_{n-1}\\z_n \end{bmatrix} = \begin{bmatrix} \beta_0\\\beta_1\\\beta_2\\\vdots\\\beta_i\\\vdots\\\beta_{n-1}\\\beta_n \end{bmatrix} \]
What are the “inputs”?
What are the indices of \(h_i\)s and \(\delta\)s?
Come up with an example of input data and output data.
What are the “inputs”?
What are the indices of \(s_i\)s and \(B_i\)s?
Come up with an example of input data and output data.
\[ \begin{bmatrix} 1 & 0 & 0 & & & & & \\ h_1 & 2\delta_1 & h_2 & & & & & \\ &h_2 & 2\delta_2 & h_3 & & & & \\ & & \ddots & \ddots & \ddots & & & \\ & & & h_{i} & 2\delta_i & h_{i+1} & & \\ & & & & \ddots & \ddots & \ddots & \\ & & & & & h_{n-1} & 2\delta_{n-1} & h_{n} \\ & & & & & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} z_0\\z_1\\z_2\\\vdots\\z_i\\\vdots\\z_{n-1}\\z_n \end{bmatrix} = \begin{bmatrix} 0\\B_1\\B_2\\\vdots\\B_i\\\vdots\\B_{n-1}\\0 \end{bmatrix} \]
Again, what are the inputs, what are the indices, give an example…
\[ \begin{bmatrix} 1 & h'_1 & & & & & & \\ & 1 & h'_2 & & & & & \\ & & 1 & h'_3 & & & & \\ & & & \ddots & \ddots & & & \\ & & & & 1 & h'_{i+1} & & \\ & & & & & \ddots & \ddots & \\ & & & & & & 1 & h'_{n} \\ & & & & & & & 1 \end{bmatrix} \begin{bmatrix} z_0\\z_1\\z_2\\\vdots\\z_i\\\vdots\\z_{n-1}\\z_n \end{bmatrix} = \begin{bmatrix} \beta_0\\\beta_1\\\beta_2\\\vdots\\\beta_i\\\vdots\\\beta_{n-1}\\\beta_n \end{bmatrix} \]
Again, what are the inputs, what are the indices, give an example…
Purpose of these is to solve the tridiagonal system of equations:
\[ \begin{bmatrix} 1 & 0 & 0 & & & & & \\ h_1 & 2\delta_1 & h_2 & & & & & \\ &h_2 & 2\delta_2 & h_3 & & & & \\ & & \ddots & \ddots & \ddots & & & \\ & & & h_{i} & 2\delta_i & h_{i+1} & & \\ & & & & \ddots & \ddots & \ddots & \\ & & & & & h_{n-1} & 2\delta_{n-1} & h_{n} \\ & & & & & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} z_0\\z_1\\z_2\\\vdots\\z_i\\\vdots\\z_{n-1}\\z_n \end{bmatrix} = \begin{bmatrix} 0\\B_1\\B_2\\\vdots\\B_i\\\vdots\\B_{n-1}\\0 \end{bmatrix} \]
What are the inputs?
What are the outputs?
How do we evaluate the output?