Graphics Programs Reference
In-Depth Information
EXAMPLE 3.6
Sometimes it is preferable to replace oneorboth of the end conditions of the cu-
bicspline with something other than the naturalconditions. Use the end condition
f
1
,
2
(0)
0(zero slope), rather than
f
1
=
2
(0)
=
0(zerocurvature), to determine the cubic
,
spline interpolant at
x
=
2
.
6based on the datapoints
x
0
1
2
3
y
1
1
0
.
5
0
Solution
Wemust firstmodifyEqs. (3.12)toaccountfor the newend condition. Setting
i
=
1inEq. (3.10) and differentiating, we get
3
(
x
x
2
)
3
(
x
x
2
)
x
2
)
2
x
1
−
x
1
)
2
x
1
−
k
1
6
−
k
2
6
−
y
1
−
y
2
f
1
,
2
(
x
)
=
x
2
−
(
x
1
−
−
x
2
−
(
x
1
−
+
x
1
−
x
2
Thus the end condition
f
1
,
2
(
x
1
)
=
0 yields
k
1
3
(
x
1
−
k
2
6
(
x
1
−
y
1
−
y
2
x
2
)
+
x
2
)
+
x
2
=
0
x
1
−
or
y
1
−
y
2
2
k
1
+
k
2
=−
6
(
x
1
−
x
2
)
2
From the givendatawe see that
y
1
=
y
2
=
1,sothat the last equationbecomes
2
k
1
+
k
2
=
0
(a)
The other equations in Eq. (3.12) are unchanged. Noting that
k
4
=
=
0 and
h
1, we
have
k
1
+
4
k
2
+
k
3
=
6
[
1
−
2(1)
+
0
.
5
]
=−
3
(b)
k
2
+
4
k
3
=
−
.
+
=
6 [1
2(0
5)
0]
0
(c)
The solution of Eqs. (a)-(c) is
k
1
=
2308.
The interpolantcan nowbeevaluated fromEq. (3.10).Substituting
i
0
.
4615,
k
2
=−
0
.
9231,
k
3
=
0
.
=
3 and
x
i
−
x
i
+
1
=−
1
,
weobtain
6
−
x
4)
−
6
−
x
3
)
k
3
k
4
x
4
)
3
x
3
)
3
f
3
,
4
(
x
)
=
(
x
−
+
(
x
−
(
x
−
+
(
x
−
−
y
3
(
x
−
x
4
)
+
y
4
(
x
−
x
3
)
Therefore,
.
−
4)
+
0
2308
6
4)
3
y
(2
.
6)
=
f
3
,
4
(2
.
6)
=
(
−
0
.
+
(
−
0
.
0
−
0
.
5(
−
0
.
4)
+
0
=
0
.
1871
Search WWH ::
Custom Search