Schumaker 1983
Schumaker 1983
LARRY L. SCHUMAKERS
Abstract. In this paper we discuss the design of algorithms for interpolating discrete data using
Cl-quadratic splines in such a way that the monotonicity and/or convexity of the data is preserved. The
analysis culminates in an interactive algorithm which takes full advantage of the flexibility which quadratic
splines permit.
(2.2) Slq-S2__Z2--Z1
2 t-t
(2.3) S(t)=Zl+S(t--tl)+
2(t-tl)
is a solution.
The proof is elementary. [3
Proof.
When condition (2.2) fails, it is not possible to solve Problem 2.1 using a quadratic
polynomial. We now show, however, that it can always be solved using a quadratic
spline with one (simple) knot. A quadratic spline is a function s C1(-, ) such
that for some points xx < x2 <’ < xn, s restricted to each subinterval defined by the
x’s reduces to a quadratic polynomial. The x’s are called the knots of the spline (for
a detailed treatment of splines, see e.g. Schumaker [18]).
LEMMA 2.3. For every tl << tz, there exists a unique quadratic spline s with a
(simple) knot at solving Problem 2.1. In particular, we can write
Proof.Since s’ is piecewise linear, s’(t) has one sign throughout I if and only if
sl, s2, and g all have the same sign. 71
Downloaded 12/29/12 to 132.206.27.25. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php
Proof. Since
tl <-_t <,
s"(t =t’ <=t <----t2’
[tz-’
the assertion is obvious.
Although Lemma 2.3 shows that the two-point Hermite interpolation problem
can be solved by a quadratic spline with one knot placed arbitrarily in the interval
(tl, tz), it is not possible to satisfy conditions (2.9) and (2.10) for arbitrary knot locations.
The following lemma shows exactly which knot locations lead to convex or concave
splines.
LEMMA 2.7. Let 6 (z2-z1)/(t2-tl). Then (S2--6)(Sl--6) 0 implies that s must
have an inflection point in the interval I. Suppose now that (SE-6)(sl-6)< 0. Then
the condition Is - l ISl- l implies that for all satisfying
2(tz-tl)(sz-6)
(2.11) tl<’-<: with tl +
($2--$1)
the interpolating spline s in (2.4) satisfies
s is convex on lif sl
(2.12)
s is concave on I if s
> S2.
If sis2 >- O, then s is also monotone. Similarly, if [s2-6[ > [s1-6[, then for all satisfying
2(tz-tl)(sl-6)
(2.13) _-<’<t2 with =t2+
(s-s)
the interpolating spline s satisfies (2.12). If slsz >-0, then s is also monotone.
Proof. It is easy to check that if (sz-6)(sl-6)>=O, then conditions (2.9)-(2.10)
fail, and s cannot be convex or concave on L Now for the converse, consider the case
SI<S2 and Is2-l<lSl-l. First we note that in this case tl<<t2. Now some
computation shows that if tl < "-<’, then (2.9) follows, which by Lemma 2.6 assures
that s is convex on L This, coupled with Lemma 2.5, shows that s is monotone when
sis2 => 0. The other cases are similar. !-1
3. A general curve fitting algorithm. We now describe a general curve fitting
algorithm for solving the interpolation Problem 1.1 using quadratic splines.
SHAPE PRESERVING QUADRATIC SPLINE INTERPOLATION 857
ALGORITHM 3.1.
1. (INPUT)
Downloaded 12/29/12 to 132.206.27.25. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php
When s has this property, we say that s is co-monotone with the data. It is clear that
in order to achieve co-monotonicity, we must choose the slopes to assure local
Downloaded 12/29/12 to 132.206.27.25. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php
is designed to preserve the shape of the data. While it can be used as a one pass
algorithm, it can also be integrated into an interactive package where it would serve
Downloaded 12/29/12 to 132.206.27.25. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php
as a first pass. The user then could interactively adjust the slopes and knot locations
in order to alter the shape of the interpolating curve as desired. We say more about
how to set up this interactive package later in this section.
ALGORITHM 4.1.
1. Preprocessing
For 1 step 1 until n -1,
z
Li [(ti+x ti) + (zi+ zi)2] 1/2
i (Zi+l zi)/(ti+l ti)
For 1 step 1 until n 1,
L Y, Li, where st,_1 st, s, : s,+
2. Slope calculations
For 2 step 1 until n 1,
si (Li-x6i-x + Li6i)/(Li-x + Li).
3. Left end slope
s1=(361-sz)/2
4. Right end slope
s, =(36,-1-s,-1)/2
5. Compute knots and coefficients
in this case it may happen that condition (3.3) guaranteeing local monotonicity will
fail. This can be corrected later in the interactive stage.
Downloaded 12/29/12 to 132.206.27.25. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php
-orn.er Insert
s. a corner]
,1
of s in mind"
A necessary condition for monotonicity on Ii_ is that SiSi-1 Oo
Downloaded 12/29/12 to 132.206.27.25. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php
2 3 4 5
z 2 3 2
Discussion. The data and the spline s produced by Algorithm 4.1 are shown in
Fig. 2a. Note that the slope at t3 3 has been chosen to be 0, and that s is co-monotone
with the data. In Fig. 2b we show the quadratic spline which results when the slope
at t3 is changed to 1, forcing the spline to be linear throughout [1, 3]. In this case, s
is no longer monotone on [3, 4]. Finally, in Fig. 2c we show the quadratic spline s
which results when we make the point t3 be a corner (or double knot).
Example 5.2. Let n 11, and suppose the t’s and z’s are given by
0 2 3 5 6 8 9 11 12 14 15
10 10 10 10 10.5 15 50 60 85
Discussion. This data is taken from Akima [1]. For the results of some other
spline fits, see [10]. The data and the spline s produced by Algorithm 4.1 are shown
862 LARRY L. SCHUMAKER
Downloaded 12/29/12 to 132.206.27.25. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php
a).
4 0 2 3 4 5
c).
0 2 3 4 5
0 2 3 5 6 8 9 11 12 14 15
The algorithm inserts knots at {7, 8.76, 10.977, 11.5, 13, 14.33}. Note that although
the data is monotone increasing, the spline s fails to be monotone in the interval [12,
14]. This is due to the fact that the selected slopes at 12 and 14 are too large. Also
note the slight dip in 17, 8].
In Fig. 3b we show the spline which results when the slopes at 12 and 14 are
reduced to 11 and 8, respectively. This reduction is enough to assure that (3.3) is
satisfied, and the spline becomes monotone increasing on [12, 14]. Its shape is changed
only slightly outside this interval.
Fig. 3c shows the result of setting the slope at 8 to be 10. This forces the
interpolating spline to be linear throughout the interval [0, 8].
6. Remarks.
1. Algorithm 4.1 presented here can be thought of as an alternative to the method
of McAllister and Roulier [12]-[13]. The main differencesbetween the two are in the
way in which the slopes and knots are selected. Their slope and knot assignments are
based on a geometrical argument, and the quadratic polynomial pieces are constructed
using Bernstein polynomials. Whichever algorithm is used as a first pass, the main
idea of this paper is that there is considerable flexibility in the use of quadratic splines,
and that this flexibility should be exploited in an interactive mode.
2. In [12]-[13], there is some discussion of "pathological cases" where a decision
based on comparing two numbers can make a substantial change in the shape of the
fit. Algorithm 4.1 produces a spline fit s which depends continuously on the data.
The location of a knot in an interval Ii may be a discontinuous function of the data.
SHAPE PRESERVING QUADRATIC SPLINE INTERPOLATION 863
100
Downloaded 12/29/12 to 132.206.27.25. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php
a).
50
0 2 3 5 6 8 9 10 12 14 15
100
b).
50
0 2 3 5 6 8 9 10 12 14 15
100
c).
50
0 2 3 5 6 8 9 10 12 14 15
FIG. 3. The splines in Example 5.2.
In particular, if (si-Si) and (s/1-8) are nearly the same, then the choice of a knot
in I will depend on which of these is greater, and indeed, if they are equal, no knot
will be inserted at all. Still, the final s will be nearly the same in all cases. I suggest
that in coding the algorithm that the quantities be regarded as equal whenever they
differ by no more than some prescribed small e--this saves adding knots where they
really are not needed.
3. Fritsch and Carlson [10] have published a curve fitting algorithm based on
cubic splines, which is capable of producing monotone fits to monotone data. It does
not preserve convexity, however.
4. Additional references and examples can be found in the papers listed below.
For some unusual applications of shape preserving algorithms, see [6], [15].
REFERENCES
[1] H. AKIMA, A new method of interpolation and smooth curve fitting based on local procedures, J. Assoc.
Comput. Mach., 17 (1970), pp. 589-602.
[2] C. DE BOOR, A Practical Guide to Splines, Springer-Verlag, New York, 1978.
[3] C. DE BOOR AND B. SWARTZ, Piecewise monotone interpolation, J. Approx. Theory, 21" (1977),
pp. 411-416.
864 LARRY L. SCHUMAKER
[4] J. BUTLAND, A method of interpolating reasonable-shaped curves through any data, Proc. Computer
Graphics 80, Online Publications Ltd., Middlesex, UK, 1980, pp. 409--422.
Downloaded 12/29/12 to 132.206.27.25. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php
[5] A. K. CLINE, Scalar- and planar-valued curve fitting using splines under tension, Comm. ACM, 17
(1974), pp. 218-223.
[6] L. E. DEIMEL, C. L. Doss, R. J. FORNARO, D. F. MCALLISTER AND J. A. ROULIER, Application
of shape-preserving spline interpolationto interactive editing of photogrammetric data, Proc. SIG-
GRAPH 78, 12 (1978), pp. 93-99.
[7] L. E. DEIMEL, D. F. MCALLISTER AND J. A. ROULIER, Smooth curve fitting with shape preservation
using osculatory quadratic splines, Proc. lth Annual Conference on the Interface Between
Statistics and Computer Science, 1978, pp. 343-347.
[8] R. P. DUBE, Univariate blending functions and alternatives, Computer Graphics and Image Processing,
6 (1977), pp. 394-408.
[9] T. M. R. ELLIS AND D. H. MCLAIN, Algorithm 514. A new method ofcubic curve fitting using local
data, CM Trans. Math. Software, 3 (1977), pp. 175-178.
[10] F. N. FRITSCH AND R. E. CARLSON, Monotone piecewise cubic interpolation, this Journal, 17 (1980),
pp. 238-246.
[11] D. F. MCALLISTER AND J. m. ROULIER, Interpolation by convex quadratic splines, Math. Comput.,
32 (1978), pp. 1154-1162.
[12]., An algorithm for computing a shape-preserving osculatory quadratic spline, ACM Trans. Math.
Software, 7 (1981), pp. 331-347.
[13] , Algorithm 574. Shape-preserving osculatory quadratic splines, ACM Trans. Math. Software,
7 (1981), pp. 384-386.
[14] D. F. MCALLISTER, E. PASSOW AND J. A. ROULIER, Algorithms for computing shape preserving
spline interpolations to data, Math. Comp., 31 (1971), pp. 717-725.
[15] D. F. MCALLISTER, J. A. ROULER AND M. EVANS, Generation of random numbers using shape
preserving quadratic splines, Proc. 16th Ann. Southeast Regional ACM Conf. (1978), pp. 216-218.
[16] E. PASSOW, Piecewise monotone spline interpolation, J. Approx. Th., 12 (1974), pp. 240-241.
[17] E. PASSOW AND J. A. ROULIER, Monotone and convex sptine interpolation, SIAM J. Numer. Anal.,
14 (1977), pp. 904-909.
[18] t. L. SCHUMAKER, Spline Functions: Basic Theory, Wiley-Interscience, New York, 1981.
[19] S. W. YOUNG, Piecewise monotone polynomial interpolation, Bull. Amer. Math. Soc., 73 (1967),
pp. 642-643.