Coefficient Matrix Of Cubic Spline Interpolation.

Click For Summary
The discussion focuses on deriving the coefficient matrix for a parabolically terminated cubic spline, specifically the matrix of coefficients a_i. The coefficients are determined using a set of linear equations, with the need for additional equations to solve the system due to having n coefficients and n - 2 equations. For natural cubic splines, the boundary conditions are a_1 = 0 and a_n = 0, leading to a specific structure for the matrix M and vector d. The user inquires about how these structures change when the boundary conditions are modified to -a_1 + a_2 = 0 and -a_{n-1} + a_n = 0, ultimately concluding that they have resolved their question.
SherlockOhms
Messages
309
Reaction score
0

Homework Statement


I'm trying to derive the coefficient matrix (a) of a parabolically terminated cubic spline. This is the matrix of coefficients ##a_i \rightarrow a_n## where n is the number of data points provided.

With this matrix you can find all the other coefficients (b and c) that define the spline using: $$b_i = \frac{y_i}{h_i} - a_i h_i$$ where ##y_i## is the corresponding value of the given set of y values and ##h_i## is defined as ##x_{i + 1} - x_i##.

The ##a## coefficients (n in total) satisfy the following n - 2 linear equations: $$h_1 a_i + 2(h_{i + 1} + h_i)a_{i + 1} + h_{i + 1}a_{i + 1} = \frac{y_{i + 2} - y_{i + 1}}{h_{i + 1}} - \frac{y_{i + 1} - y_i}{h_i}$$

So, you have n coefficients and n - 2 equations. Therefore, you need 2 extra equations to be able to solve the system.

For a natural cubic spline these end conditions are ##a_1## = 0 and ##a_n## = 0. So, you can then write the system in the form: ##Ma = d##. Where, ##M## is a tridiagonal matrix of ##h_i## along it's sub diagonal (n - 1 in length), ##h_{i + 1}## along it's super diagonal (n - 1 in length) and ## 2(h_{i + 1} + h_i)## along it's main diagonal (n in length). Thus an n x n matrix is produced. Then ##a## is the coefficient matrix of ##a_i \rightarrow a_n## (n x 1) and ##d## is the n x 1 vector filled with ## \frac{y_{i + 2} - y_{i + 1}}{h_{i + 1}} - \frac{y_{i + 1} - y_i}{h_i}##. Incorporating the extra conditions in, the first and last rows of matrix M will be 1 0 0 ... and ...0 0 0 1 respectively. As well as the first and last rows of the vector ##d## being 0. This ensures that ##a_1## and ##a_n## = 0.

So, my question is, when writing this linear system for a parabolically terminated cubic spline in matrix form, who's end conditions are ##-a_1 + a_2 = 0## and ##-a_{n-1} + a_n = 0##, how do the first and last rows of M and d change? I've outlined above how the matrices are set up for the given conditions ##a_1## = 0 and ##a_n## = 0, and I just wnat to know how they change with these new conditions.



Homework Equations


All above.


The Attempt at a Solution


All above.
 
Physics news on Phys.org
SherlockOhms said:

Homework Statement


I'm trying to derive the coefficient matrix (a) of a parabolically terminated cubic spline. This is the matrix of coefficients ##a_i \rightarrow a_n## where n is the number of data points provided.

With this matrix you can find all the other coefficients (b and c) that define the spline using: $$b_i = \frac{y_i}{h_i} - a_i h_i$$ where ##y_i## is the corresponding value of the given set of y values and ##h_i## is defined as ##x_{i + 1} - x_i##.

The ##a## coefficients (n in total) satisfy the following n - 2 linear equations: $$h_1 a_i + 2(h_{i + 1} + h_i)a_{i + 1} + h_{i + 1}a_{i + 1} = \frac{y_{i + 2} - y_{i + 1}}{h_{i + 1}} - \frac{y_{i + 1} - y_i}{h_i}$$

So, you have n coefficients and n - 2 equations. Therefore, you need 2 extra equations to be able to solve the system.

For a natural cubic spline these end conditions are ##a_1## = 0 and ##a_n## = 0. So, you can then write the system in the form: ##Ma = d##. Where, ##M## is a tridiagonal matrix of ##h_i## along it's sub diagonal (n - 1 in length), ##h_{i + 1}## along it's super diagonal (n - 1 in length) and ## 2(h_{i + 1} + h_i)## along it's main diagonal (n in length). Thus an n x n matrix is produced. Then ##a## is the coefficient matrix of ##a_i \rightarrow a_n## (n x 1) and ##d## is the n x 1 vector filled with ## \frac{y_{i + 2} - y_{i + 1}}{h_{i + 1}} - \frac{y_{i + 1} - y_i}{h_i}##. Incorporating the extra conditions in, the first and last rows of matrix M will be 1 0 0 ... and ...0 0 0 1 respectively. As well as the first and last rows of the vector ##d## being 0. This ensures that ##a_1## and ##a_n## = 0.

So, my question is, when writing this linear system for a parabolically terminated cubic spline in matrix form, who's end conditions are ##-a_1 + a_2 = 0## and ##-a_{n-1} + a_n = 0##, how do the first and last rows of M and d change? I've outlined above how the matrices are set up for the given conditions ##a_1## = 0 and ##a_n## = 0, and I just wnat to know how they change with these new conditions.



Homework Equations


All above.


The Attempt at a Solution


All above.

You have already said how the first and last row change: instead of a1 = 0 you have a1-a2=0, and instead of a_n = 0 you have a_(n-1)-a_n = 0.
 
Think I've already got it sorted. Thanks for the reply.
 
Question: A clock's minute hand has length 4 and its hour hand has length 3. What is the distance between the tips at the moment when it is increasing most rapidly?(Putnam Exam Question) Answer: Making assumption that both the hands moves at constant angular velocities, the answer is ## \sqrt{7} .## But don't you think this assumption is somewhat doubtful and wrong?

Similar threads

  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 13 ·
Replies
13
Views
2K
Replies
8
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
9
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K