# Thread: Cubic Spline

1. ## Cubic Spline

I need some help with this Q.

Determine all the values of a, b, c, d, e such that the following function is a cubic spline:

f(x) = a[(x-2)^2] + b[(x-1)^3] for x in (-infi, 1]
c[(x-2)^2] for x in [1,3]
d[(x-2)^2] + e[(x-3)^2] for xin [3, infi)

2. What ideas have you had so far?

3. well, I am really stuck. I can't even tell how many equations do we need to solve this problem. I mean, I think we know there are 3 intervals and each interval might have several interpolating points and if we have several interpolating points, it's kinda hard to tell the number of equations required to solve the unknowns. But considering we have 2 unknowns in the first polynomial-namely, a and b, I think we might need 2 equations? I really dont get it

4. Well, cubic splines have certain properties namely
1. They are continuous
2. The first derivatives are continuous
3. The second derivatives are continuous

5. Thanks. Actually I know abt all the properties of the cubic spline. But I am having some problem interpreting the Intervals in this case and coming up with a reasonable estimate for the number of equations required to solvef ro all the cofficients. I was wondering if someone could get me started on this one, I'll really appreciate that.

6. There are five unknowns, a through e. I would think five equations would be appropriate. Continuity gives you two equations, continuity of first derivatives gives you two more, and continuity of second derivatives gives you two more. That's six. I would regard the extra equation as a consistency check (i.e., just make sure it holds). Follow?

7. Thanks, trying.

8. So from the continuity of the function, I get:

a = c
c = d

From the continuity of the first derivative I get:

a = c
c = d

and from the continuity o the second derivative I get:
c = d+ e
2a + 3b = 2c

so, in this 2 of the equations are same. How should I go about the fifth? Does this look right?

9. I agree with all your equations except

2a + 3b = 2c

for the second derivative. There's still an (x-1) term in the first region, because it's raised to the third power in the original function. Right?

10. right, having fixed that I still get 2a + 3b(x-1) = 2c at x=1
which gives me 2a = 2c, a=c

so basically i end up with 3 equations

Then I applied "not-a-knot" condition at the first and last interior points wherein i get 3b = 0 this implies b =0. How shd I get the 5th equation?

11. What is the not-a-knot condition?

12. http://www.me.gatech.edu/~aferri/me2...bic_spline.pdf

Here, to find the other equations, we can use "not-a-knot"a nd natural spline conditions?

13. Ah, thanks for the link. Good explanation there. You would use either the not-a-knot condition or the natural spline condition, but not both, I think. You might end up with contradictions if you impose them all. I agree with b = 0 from the not-a-knot condition.

Just going back to the OP, you might not need to nail down all the parameters. If you have the relationships between them, you might have infinitely many ways to make the function a spline.

14. so, the second part of the Q says: find parameters so that the spine interpolates:

x 0 1 4

y 26 7 25

(use the results of the previous problem to go abt it.

so basiclaly i have to use what i got from the above problem. it says find the parameters? Do I need to construct the spline here? How should I go about this one?