# Cubic Splines

1. Sep 26, 2013

### RacingFan

Hi,

I was wondering if anyone could help me with this problem on a closed natural cubic spline.
given the equations below i need to compute the 0,1 and 2nd order derivatives lets say for X(0) in t = 0 and t =1

xi (t) = ai,x + bi,xt + ci,xt2 + di,xt3
yi (t) = ai,y + bi,yt + ci,yt2 + di,yt3

from that, i get the linear system of (below) for all i segments
x1 (1) = a1 + b1 + c1 + d1 = aN = xN (0)
x'1(1) = b1 + 2c1 + 3d1 = bN = x'N (0)
x''1(1) = 2c1 + 6d1 = 2cN = x''N (0)
.
.
.
xi (1) = ai + bi + ci + di = ai−1 = xi−1 (0)
x'i(1) = bi + 2ci + 3di = bi−1 = x'i−1(0)
x''i(1) = 2ci + 6di = 2ci−1 = x''i−1(0)
.
.
.
xN (1) = aN + bN + cN + dN = aN−1 = xN−1 (0)
x'N (1) = bN + 2cN + 3dN = bN−1 = x'N−1(0)
x''N (1) = 2cN + 6dN = 2cN−1 = x''N−1(0)

It is the next step that i do not understand where i am supposed to exploit these three groups of equations to get rid of b_i and d_i.

let's check if it is possible: we have 3xN equations and 3xN variables (a_i aren't actually variables!) so it's ok.
- look at the first three eq. we can easily get rid of of d_N and b_N by substitution...but we have only one b_0....
- how can we do? we can exploit the equations between x_0 and x_1 ! express b_0 in function of a_0,a_1,c_0,c_1 and substitute it back in the first three equations
- we have now N equations that involves only a_i and c_i variables... just take all a_i terms to the right, the c_i to the left and express everything in matricial form.
- we are done.

this leaves me with the matrix of
-4/3 -1/3 -1/3
-1/3 -4/3 -1/3
-1/3 -1/3 -4/3

I do not understand how they arrive at this matrix?

ANy help would be greatly appreciated