algorithm 600, collected algorithms from acm. algorithm appeared in acm-trans. math. software, vol.9, no. 2, jun., 1983, p. 258-259.
quintic computes the coefficients of a quintic natural quintic spli s(x) with knots x(i) interpolating there to given function values: s(x(i)) = y(i) for i = 1,2, ..., n. in each interval (x(i),x(i+1)) the spline function s(xx) is a polynomial of fifth degree: s(xx) = ((((f(i)*p+e(i))*p+d(i))*p+c(i))*p+b(i))*p+y(i) (*) = ((((-f(i)*q+e(i+1))*q-d(i+1))*q+c(i+1))*q-b(i+1))*q+y(i+1) where p = xx - x(i) and q = x(i+1) - xx. (note the first subscript in the second expression.) the different polynomials are pieced together so that s(x) and its derivatives up to s"" are continuous.
input:
n number of data points, (at least three, i.e. n > 2) x(1:n) the strictly increasing or decreasing sequence of knots. the spacing must be such that the fifth power of x(i+1) - x(i) can be formed without overflow or underflow of exponents. y(1:n) the prescribed function values at the knots.
output:
b,c,d,e,f the computed spline coefficients as in (*). (1:n) specifically b(i) = s'(x(i)), c(i) = s"(x(i))/2, d(i) = s"'(x(i))/6, e(i) = s""(x(i))/24, f(i) = s""'(x(i))/120. f(n) is neither used nor altered. the five arrays b,c,d,e,f must always be distinct.
option:
it is possible to specify values for the first and second derivatives of the spline function at arbitrarily many knots. this is done by relaxing the requirement that the sequence of knots be strictly increasing or decreasing. specifically:
if x(j) = x(j+1) then s(x(j)) = y(j) and s'(x(j)) = y(j+1), if x(j) = x(j+1) = x(j+2) then in addition s"(x(j)) = y(j+2).
note that s""(x) is discontinuous at a double knot and, in addition, s"'(x) is discontinuous at a triple knot. the subroutine assigns y(i) to y(i+1) in these cases and also to y(i+2) at a triple knot. the representation (*) remains valid in each open interval (x(i),x(i+1)). at a double knot, x(j) = x(j+1), the output coefficients have the following values: y(j) = s(x(j)) = y(j+1) b(j) = s'(x(j)) = b(j+1) c(j) = s"(x(j))/2 = c(j+1)
d(j) = s"'(x(j))/6 = d(j+1) e(j) = s""(x(j)-0)/24 e(j+1) = s""(x(j)+0)/24 f(j) = s""'(x(j)-0)/120 f(j+1) = s""'(x(j)+0)/120 at a triple knot, x(j) = x(j+1) = x(j+2), the output coefficients have the following values: y(j) = s(x(j)) = y(j+1) = y(j+2) b(j) = s'(x(j)) = b(j+1) = b(j+2) c(j) = s"(x(j))/2 = c(j+1) = c(j+2)
d(j) = s"'((x(j)-0)/6 d(j+1) = 0 d(j+2) = s"'(x(j)+0)/6
e(j) = s""(x(j)-0)/24 e(j+1) = 0 e(j+2) = s""(x(j)+0)/24
f(j) = s""'(x(j)-0)/120 f(j+1) = 0 f(j+2) = s""'(x(j)+0)/120
Definition at line 479 of file spline.
547 double pqqr, p, q, r, s, t, u, v,
548 b1, p2, p3, q2, q3, r2, pq, pr, qr;
550 if (
fNp <= 2)
return;
561 if (q)
fPoly[1].D() = q*6.*q2/(qr*qr);
562 else fPoly[1].D() = 0;
565 for (i = 1; i < m; ++i) {
578 fPoly[i+1].D() = q3*6./(qr*qr);
579 fPoly[i].D() += (q+q)*(pr*15.*pr+(p+r)*q
581 ((p2+r2)*8.+pr*21.+q2+q2))/(pqqr*pqqr);
582 fPoly[i-1].D() += q3*6./(pq*pq);
583 fPoly[i].E() = q2*(p*qr+pq*3.*(qr+r+r))/(pqqr*qr);
584 fPoly[i-1].E() += q2*(r*pq+qr*3.*(pq+p+p))/(pqqr*pq);
585 fPoly[i-1].F() = q3/pqqr;
590 if (r)
fPoly[m-1].D() += r*6.*r2/(qr*qr);
595 for (i = 1; i <
fNp; ++i) {
604 for (i = 2; i <
fNp; ++i) {
622 for (i = 2; i < m; ++i) {
635 for (i=
fNp-3; i > 0; --i)
651 if (q)
fPoly[0].F() = v/q;
652 else fPoly[0].F() = 0;
653 for (i = 1; i < m; ++i) {
656 if (i != m-1) r =
fPoly[i+2].X()-
fPoly[i+1].X();
669 if (q)
fPoly[i].F() = v/q;
674 p3-(v+
fPoly[i].E())*q3)/pq;
685 s =
fPoly[0].F()*p*p*p;