Determining polynomial coefficients for a Catmull-Rom Hermite spline?

110 Views Asked by At

In a quantitative finance textbook I am using, Catmull-Rom splines are presented as follows:

$$\begin{align} y(x)&=\mathbf{D}_i(x)^\intercal\mathbf{A}_i\begin{pmatrix}y_{i-1}\\y_i\\y_{i+1}\\y_{i+2}\end{pmatrix}\mathpunct{,} i=1,\ldots,N-1\mathpunct{,}x\in[x_i,x_{i+1}]\mathpunct{,}y_i=y(x_i) \\h_i&=x_{i+1}-x_i \\\mathbf{D}_i(x)&=\begin{pmatrix}d_i^3\\d_i^2\\d_i^1\\1\end{pmatrix},d_i=\frac{x-x_i}{h_i} \\\mathbf{A}_i&=\begin{pmatrix} -a_i&2-b_i&2+a_i&b_i\\ 2a_i&b_i-3&3-2a_i&-b_i\\ -a_i&0&a_i&0\\ 0&1&0&0 \end{pmatrix}\mathpunct{,}a_i=\frac{h_i}{h_i+ h_{i-1}}\mathpunct{,}b_i=\frac{h_i}{h_{i+1}+h_i}\mathpunct{,}i=2,\ldots\,N-2 \end{align}$$

Ignore for a second the edge conditions $i=1,i=N-1$ (which require modified $\mathbf{A}_i$), and assume that I'm given the following vector (which is a component of the vector $\mathbf{D}_i$ above):

$\mathbf{x}=\begin{pmatrix} (x-x_i)^3 \\(x-x_i)^2 \\(x-x_i)^1 \\1 \end{pmatrix}$

I'm wondering how I create the piecewise 4x1 polynomial coefficient matrix from the following 3 pieces: $$\begin{align} \mathbf{h}&= \begin{pmatrix} h_i^{-3} \\h_i^{-2} \\h_i^{-1} \\1 \end{pmatrix}\mathpunct{,}\mathbf{A}_i{,}\begin{pmatrix}y_{i-1}\\y_i\\y_{i+1}\\y_{i+2}\end{pmatrix} \end{align}$$

The dimensions seem off, as $\mathbf{h}^\intercal\mathbf{A}_i\begin{pmatrix}y_{i-1}\\y_i\\y_{i+1}\\y_{i+2}\end{pmatrix}$ leaves me with a scalar, not a 4x1 vector. I expect that somewhere I'll need to use the diagonal of a 4x4 matrix, but am not sure where.

1

There are 1 best solutions below

0
On

Worked it out by hand. The answer is

$\mathbf{diag}(\mathbf{A}_i\cdot\mathbf{ylag}\cdot\mathbf{h}^\intercal)$