Graphics Programs Reference
In-Depth Information
the polynomialhave been found, the polynomial and its first two derivatives can be
evaluated efficientlybythe function
evalpoly
listedinArt. 4.7.
Cubic Spline Interpolant
Duetoits stiffness, cubicspline is agoodglobal interpolant;moreover, it iseasy to
differentiate. The first stepistodetermine the second derivatives
k
i
of the spline at
the knots by solving Eqs. (3.12). Thiscan be done with the function
splineCurv
as
explainedinArt. 3.3. The first and second derivatives are then computed from
3(
x
x
i
+
1
)
x
i
+
1
)
2
k
i
6
−
f
i
,
i
+
1
(
x
)
=
−
(
x
i
−
x
i
−
x
i
+
1
3(
x
x
i
+
1
)
k
i
+
1
6
−
x
i
)
2
y
i
−
y
i
+
1
−
x
i
+
1
−
(
x
i
−
+
(5.10)
x
i
−
x
i
−
x
i
+
1
k
i
x
−
x
i
+
1
x
−
x
i
f
i
=
x
i
+
1
−
1
(
x
)
k
i
+
1
(5.11)
,
i
+
x
i
−
x
i
−
x
i
+
1
which areobtainedbydifferentiation of Eq. (3.10).
EXAMPLE 5.4
Given the data
x
1
.
5
1
.
9
2
.
1
2
.
4
2
.
6
3
.
1
f
(
x
)
1
.
0628
1
.
3961
1
.
5432
1
.
7349
1
.
8423
2
.
0397
compute
f
(2) and
f
(2) using (1) polynomial interpolation over three nearest-
neighborpoints, and (2) naturalcubicspline interpolantspanning all the datapoints.
Solution of Part (1)
Let the interpolant passing through the points at
x
=
1
.
9, 2
.
1 and
a
3
x
2
. The normalequations, Eqs. (3.23), of the least-squares
2
.
4 be
P
2
(
x
)
=
a
1
+
a
2
x
+
fit are
⎡
⎣
⎤
⎦
⎡
⎣
⎤
⎦
=
⎡
⎣
⎤
⎦
x
i
x
i
y
i
y
i
x
i
y
i
x
i
n
a
1
a
2
a
3
x
i
x
i
x
i
x
i
x
i
x
i
After substituting the data, we get
⎡
⎣
⎤
⎦
⎡
⎣
⎤
⎦
=
⎡
⎣
⎤
⎦
3
6
.
4
13
.
78
a
1
a
2
a
3
4
.
6742
6
.
4
13
.
78
29
.
944
10
.
0571
13
.
78 29
.
944 65
.
6578
21
.
8385
Search WWH ::
Custom Search