- #1
bremenfallturm
- 57
- 11
- Homework Statement
- Given the following points:
(-5,1.561), (-4,2) and (-3, 2.56).
Construct cubic spline interpolation polynomials between them.
- Relevant Equations
- General equations for a third-degree / cubic polynomial:
##y=ax^3+bx^2+cx+d##
##\frac{dy}{dx}=3ax^2+2bx+c##
##\frac{d^2y}{dx^2}=6ax+2b##
My attempt at a solution: We have three points, hence we will have two polynomials ##p_1(x)## for ##x\in [-5,-4]## and ##p_2(x)## for ##x\in [-4,-3]##. Define: ##p_1(x)=c_1x^3+c_2x^2+c_3x+c_4## and ##p_2(x)=c_5x^3+c_6x^2+c_7x+c_8## where the ##c_n## stuff are coefficients for the polynomial.
I came up with the following equations:
The matrix calculator gave me the following solutions:
If I try to plot it, it looks *almost* right but it's certainly not what I expected.
I assume it's a calculation problem, maybe it's even trival but I can not find it.
The plots look like below by the way, and you can find them using this link.
Many thanks for help!
I came up with the following equations:
- For ##p_1##, it must pass through the first two points:
- ##1,5610=c_1(-5)^3+c_2(-5)^2+c_3(-5)+c_4##
- ##2=c_1(-4)^3+c_2(-4)^2+c_3(-4)+c_4##
- For ##p_2##, it must pass through the middle point and the last point:
- ##2=c_5(-4)^3+c_6(-4)^2+c_7(-4)+c_8##
- ##2,56=c_1(-3)^3+c_2(-3)^2+c_3(-3)+c_8##
- 1st and 2nd order derivatives of the polynomials should be equal at the middle point, i.e. ##(-4,2)##
- ##3\cdot (-4^2)c_1+2\dot(-4)c_2+c_3-3\cdot (-4^2)c_5-2\cdot (-4)c_6-c_7=0##
- ##6c_1\cdot (-4)+2c_2-6c_5\cdot (-4)-2c_6=0##
- Finally I make the decision that the 2nd derivatives should be equal to 0 at the endpoints.
- ##6c_1\cdot (-5)+2c_2=0##
- ##6c_5\cdot (-3)+2_6 =0##
The matrix calculator gave me the following solutions:
If I try to plot it, it looks *almost* right but it's certainly not what I expected.
I assume it's a calculation problem, maybe it's even trival but I can not find it.
The plots look like below by the way, and you can find them using this link.
Many thanks for help!