X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/0f4556f12c8f75078501c9d1338ae7648a97f975..95f51977ddc18faa2e212f30c00a39540b39f325:/usr/src/usr.bin/spline.c diff --git a/usr/src/usr.bin/spline.c b/usr/src/usr.bin/spline.c index 09c12f02d4..df28f6e2b1 100644 --- a/usr/src/usr.bin/spline.c +++ b/usr/src/usr.bin/spline.c @@ -1,4 +1,7 @@ -static char *sccsid = "@(#)spline.c 4.2 (Berkeley) 11/27/82"; +#ifndef lint +static char *sccsid = "@(#)spline.c 4.3 (Berkeley) 9/21/85"; +#endif + #include #include @@ -17,49 +20,49 @@ float zero = 0.; /* Spline fit technique let x,y be vectors of abscissas and ordinates - h be vector of differences h9i8=x9i8-x9i-1988 + h be vector of differences hi=xi-xi-1 y" be vector of 2nd derivs of approx function If the points are numbered 0,1,2,...,n+1 then y" satisfies (R W Hamming, Numerical Methods for Engineers and Scientists, 2nd Ed, p349ff) - h9i8y"9i-1988+2(h9i8+h9i+18)y"9i8+h9i+18y"9i+18 + hiy"i-1+2(hi+hi+1)y"i+hi+1y"i+1 - = 6[(y9i+18-y9i8)/h9i+18-(y9i8-y9i-18)/h9i8] i=1,2,...,n + = 6[(yi+1-yi)/hi+1-(yi-yi-1)/hi] i=1,2,...,n -where y"908 = y"9n+18 = 0 +where y"0 = y"n+1 = 0 This is a symmetric tridiagonal system of the form - | a918 h928 | |y"918| |b918| - | h928 a928 h938 | |y"928| |b928| - | h938 a938 h948 | |y"938| = |b938| + | a1 h2 | |y"1| |b1| + | h2 a2 h3 | |y"2| |b2| + | h3 a3 h4 | |y"3| = |b3| | . | | .| | .| | . | | .| | .| It can be triangularized into - | d918 h928 | |y"918| |r918| - | d928 h938 | |y"928| |r928| - | d938 h948 | |y"938| = |r938| + | d1 h2 | |y"1| |r1| + | d2 h3 | |y"2| |r2| + | d3 h4 | |y"3| = |r3| | . | | .| | .| | . | | .| | .| where - d918 = a918 + d1 = a1 - r908 = 0 + r0 = 0 - d9i8 = a9i8 - h9i8829/d9i-18 1