From: kovarik@mcmail.cis.McMaster.CA (Zdislav V. Kovarik) Subject: Re: Natural Cubic Spines Date: 11 Dec 1999 22:16:06 -0500 Newsgroups: sci.math.num-analysis Keywords: elementary construction of cubic splines In article <38530C4A.CAE1B3AF@hotmail.com>, Mike wrote: :Hey everyone .... I need some help solving this problem : : :I need to find a formula to replace ????, so that the resulting function : :s(x) is a natural cubic spline on the interval [-3,1] with knots :-3,-2,-1,-,1. : :s(x) = { : 1 - 2x + 9x^2 + x^3 x is in [-3,-2] : 9 + 10x + 15x^2 + 2x^3 x is in [-2,-1] : 6 + x + 6x^2 - x^3 x is in [-1,0] : ???? x is in [0,1] : } : :If you can point me in the right direction, I'd appreciate it!! You need a cubic polynomial in [0,1], best represented by a Taylor expansion a + b * x + c * x^2 + d * x^3 and you need 4 conditions to get a, b, c, d. The left limit at 0 should equal the right limit at 0, which is a. The left derivative at 0 should equal the right derivative at 0, which is b. Similarly for the second derivative (left, right) at 0 (i.e. 2*c) And for the final touch, the fourth condition: being a natural spline means having the endpoint second derivative equal to 0. That is, 2 * c + 6 * d = 0 (check it!) (The graph is like a railroad track with no sudden changes in direction and curvature, so that the cargo doesn't get tossed around by centrifugal force. And past the end of the winding path, it should continue straight.) Good luck, ZVK(Slavek).