1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Coefficient Matrix Of Cubic Spline Interpolation.

  1. Nov 20, 2013 #1
    1. The problem statement, all variables and given/known data
    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.



    2. Relevant equations
    All above.


    3. The attempt at a solution
    All above.
     
  2. jcsd
  3. Nov 20, 2013 #2

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
  4. Nov 21, 2013 #3
    Think I've already got it sorted. Thanks for the reply.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Coefficient Matrix Of Cubic Spline Interpolation.
  1. Cubic Splines (Replies: 1)

  2. Cubic spline question (Replies: 8)

Loading...