for purposes of "smoothly" approximating a given set of data dep.ends strongly on the proper ... given function u by cubic splines with a fixed number of knots.
Least Squares Cubic Spline Approximation I Fixed Knots Carl de Boor and John R . Rice April 1963 CSD TR 20
Least Squares Cubic Spline Approximation I - Fixed Knots Carl de Boor" and John R . Rice
Introduction.
Spline functions, a n d , m o r e generally, piecewise
polynomial functions are the most successful approximating in use today.
functions
They combine ease of handling in a computer with great
flexibility, a-nd are therefore particularly suited for the approximation of experimental data or design curve m e a s u r e m e n t s . For a rather complete list of the recent literature on s p l i n e s , the reader >«
referred
to the bibliography of [ 8 ] .
This paper presents an algorithm for tbe computatioR of the leastsquares approximation to a given function a given fixed set of k n o t s .
u
by
cubic splines with
But since the successful use of splines•
for purposes of "smoothly" approximating a given set of data dep.ends strongly on the proper placement of the knots,
the algorithm is written
ss a s to facilitate experimentation with various knot sets in as economical a fashion as possible.
In [ 2 ] , use is made of this in a pro-
gram which attempts to compute the least-squares-approximation given function
u
to a
by cubic splines with a fixed number of k n o t s .
As a c o n s e q u e n c e , the algorithm is somewhat more complex than seems warranted for the mere calculation of the u
l^-approximation to
hv a )inear family of functions.
— i• . . — T *This work was initiated at the Genferal Motors Research Laboratories. The final stages were partially supported b y NSF grant G P - 7 1 6 3 . We wish to thank John Iloff for assistance in preparing preliminary versions o f this algorithm. +This author was also partially supported b y NSF grant GP-4052.
2.
Ma thematica1 backg round. (a)
Definition of spl ines.
Let
a partition of the interval [ a , b 1 . degree
n
£n
TT
polynomial of degree
< n.
We denote by
S
(2.0
(*-?); =
TT
-,
s(x)
{
i = 0,...,k, reduces to a
The points
( x
"0
5 , n
s(x) = S | A g x )
=
be
E C , b T .
are called knots (or, joints)
R the linear space of all such functions.
two sets of parameters, ^
Define
:
s e s"
ji• ••
is uniquely represented by ar)
d A = {a ^,...
, where
a . ( x - g . ) ; + fiQ a ^ . ^ x * .
a
Apparently, the boundary "knots'" representation.
^ S x . < x_ + with k+n+1 Here, f(5j,...-, 5 i + n + j ) denotes the (n+l)st divided difference of the function
f(s) on the points
^i+n+l"
It is not difficult to see that B ^ x ) > 0 with equality iff x $ fc., ? i + n + | ) ,
Z
B. (x) - I. all
x e [?o, ?k+1],
I— n
This representation is particularly useful for the study and computational handling of splines with repeated knots as the limit of splines with pairwise distinct knots defined a b o v e . (c)
Least-squares approximation.
inner product
S
M
be a linear space with
and associated norm
IM l Let
Let
=
( 0 , the program proceeds, after
JA00 - JADD-2, ADDXl(i) - ADDXI(i+2), i=l as for
UERROR
M9DE = 1.
approximation to
JADD,
Otherwise, the L.-S. error of the current L.-S. u
is computed as
FXDKNT - cUERROR,UERRQR>/(XX (LX)-XX(1)) and FXDKNT is terminated.
15.. MODE = 1,2: JADD
If
KNOT > KN9TSV, K N 9 T is set equal to KN6TSV, and
successive calls to NUBAS produce the L.-S. approximation to
by cubic splines having the knots introduced earlier and additional ADDXl(i), i=l
u knots
JADD.
If KN6T < KN6TSV, this action is preceded by the following: The (KN9TSV-KN0T) knots introduced last into the current knot set by a preceding call or calls are removed from it.
The various arrays such
as UERROR are restored to the stage where we had just computed the L.-S. approximation to
u
using just the first KN6T knots.
In either case, the program returns the square of the L.-S. e r r o r , FXDKNT, of the current b . approximation to M8DE = 3 . 3
(HflDEJ^FALSE),
M0DE = 2
with
ARG is taken as the value of an additional FXDKNT is saved in
But the component Y
i l a s t
ERBUTl, and a call to
knot. NUBAS
XKN9T - ARG produces, as described earlier, an
increased knot set, an additional
respect to
computed as in K0DE « 0 .
If the previous call to FXDKNT was in a mode other than
The current value of in
u
a n d
^jusf
BC(ILAST)* Y
I L A S T
is not taken out of
BC(ILAST)
of
u
UERROR.
(
(or, UERROR), with Rather, FXDKNT is
computed as FXDKNT - ERBUTl - (BC (I LAST)**2)/(XX (LX)-XX (1)) , ILAST using the well known fact that if
||u-u*|{ = !!u[|
2
u* =
-
= ERBUTl -
BC(i)¥j, then
2
^ ( B C U ) ) i=l 2
(BC(ILAST)) .
If the previous call to FXDKNT was in M0DE - 3 (MSDE3-TRUE). ARG is taken as a new value for the additional knot introduced in the first in 5'jch C^li-i.
>
OP OCCURS AT >'X ( L V \ X )
IF
RG= 1 , FCTL(L) CONTAINS THE CURRENT K A B TO U AT XX (LJ COEFL ( I »t ) CC ' T I •'•ISTHE FOL-C^nF* QV I-TH I>'TERV*L FOR VORDLdj.) CONTAINS VALUE AND DERIVo OF ^ . A , AT X I L ( I ) CO /.ON/ C-ASI5 /FCTllv E3 > TRUE, OR ^ALSE UIP- OM '/HilT^ER ,JR?Vy CALL /AS IV C •"• ' . M0DE=3 OR MOT EQUIVALENCE -.( I PR I NT , C,JANGE ) C ARG IS .EITHER ;FIXED POINT (-'.ODE >NE.3) TO PICK PRINT-OUT OPTIOr C-' - 0!< -TS -,FLOATI;'S!6 ;o.i;I/-IT T(. ;OOE = 3 ) TO- GIVE NE" VALUE OF V^-RIEL . - -CHANGE • = -ARG . •. -- -i - -. - • IF (MODE^GToO): GO TO 29 c C C
"IODE = U"R COMPUTE-PAS I S F C T 1 THROUGH 4 THEN S E T MODE = 1 AND PUT UERROR INTO U . . X-SCALE = XX ( LX ) - XX ( ] ) DO 10 I = 5 i 30 LU I MS T R T ( I ) = D
.
•TO V '. R ' 'RTO ' THES
* U E R (L) 80 DDOT = 'J .DO DO 81 L = 2 »LX 01 D D O T = D D O T + (G(L-l) + G ( L ) ) *TRPZV.'T ( L) C DOT = D D O T
•C C
•
OR
s , V
RETURN
FMD C
« *
*
if- -s-K-*