Solutions of Homework 6: CS321, Fall 2010

Solutions of Homework 6: CS321, Fall 2010
Solutions of Homework 6: CS321, Fall 2010
Please show all steps in your work. Please be reminded that you should do your homework
independently.
1. (10 points) Let S be a cubic spline that has knots t0 < t1 < · · · < tn . Suppose that
on the two intervals [t0 , t1 ] and [t2 , t3 ], S reduces to linear polynomials. What does
the polynomial S look like on the interval [t1 , t2 ] (linear, quadratic, or cubic)?
Solution. Let S0 (x) = c0 x + d0 be the linear polynomial defined on [t0 , t1 ], and
S2 (x) = c2 x + d2 the linear polynomial defined on [t2 , t3 ]. We have
S0′ (x) = c0 ,
S2′ (x) = c2 ,
S0′′ (x) = 0,
S2′′ (x) = 0.
and
Assume the cubic spline polynomial defined on [t1 , t2 ] to be S1 (x) = a1 x3 + b1 x2 +
c1 x + d1 . It follows that
S1′ (x) = 3a1 x2 + 2b1 x + c1 ,
and
S1′′ (x) = 6a1 x + 2b1 .
Since S, S ′ and S ′′ have to be continuous on [t0 , t3 ], we must have
S0′′ (t1 ) = S1′′ (t1 ),
S1′′ (t2 ) = S2′′ (t2 ).
6a1 t1 + 2b1 = 0,
6a1 t2 + 2b1 = 0.
Hence
(1)
These two equations lead to
6a1 (t1 − t2 ) = 0.
Since t1 6= t2 , we have a1 = 0. From Eq. (1), we have b1 = 0.
We can now conclude that S1 (x) = c1 x + d1 , so S is also a linear polynomial on
[t1 , t2 ].
2. (10 points) Find a quadratic spline interpolant for these data
x −1 0 1/2 1 2 5/2
y 2 1 0 1 2 3
Solution. Suppose the quadratic spline interpolant has the following form

Q0 (x),






 Q1 (x),
x ∈ [−1, 0]
x ∈ [0, 1/2]
Q(x) =
Q2 (x), x ∈ [1/2, 1]




Q
3 (x), x ∈ [1, 2]



Q4 (x), x ∈ [2, 5/2]
′
Define zi = Qi (ti ), the following is the formula for Qi
zi+1 − zi
(x − ti )2 + zi (x − ti ) + yi .
Qi (x) =
2(ti+1 − ti )
It follows that
zi+1 = −zi + 2
yi+1 − yi
,
ti+1 − ti
(0 ≤ i ≤ n − 1).
By setting z0 = 0, we can compute recursively,
1−2
= −2,
0 − (−1)
0−1
= −2,
= −(−2) + 2
1/2 − 0
1−0
= −(−2) + 2
= 6,
1 − 1/2
2−1
= −4,
= −6 + 2
2−1
3−2
= −(−4) + 2
= 8.
5/2 − 2
z1 = −0 + 2
z2
z3
z4
z5
Hence, the quadratic spline interpolant is
Q(x) =

Q0 (x) = −(x + 1)2 + 2,






 Q1 (x) = −2x + 1,







x ∈ [−1, 0]
x ∈ [0, 1/2]
Q2 (x) = 8(x − 1/2)2 − 2(x − 1/2), x ∈ [1/2, 1]
Q3 (x) = −5(x − 1)2 + 6(x − 1) + 1, x ∈ [1, 2]
Q4 (x) = 12(x − 2)2 − 4(x − 2) + 2, x ∈ [2, 5/2]
3. (10 points) Determine if this function is a quadratic spline? Explain why or why
not.


−∞ < x ≤ 1
 x
2
Q(x) =
x
1≤x≤2


4
2≤x<∞
Solution. Q(x) is not a quadratic spline. The domain of definition is (−∞, ∞)
which is not finite. Furthermore,
lim Q′ (x) = lim 1 = 1,
x→1−
x→1−
′
lim Q (x) = lim+ 2x = 2.
x→1+
x→1
It follows that Q′ (x) is not continuous at x = 1, which violates the definition of a
quadratic spline.
4. (10 points) Determine the parameters a, b, c, d and e so that S is a natural cubic
spline
(
a + b(x − 1) + c(x − 1)2 + d(x − 1)3
x ∈ [0, 1]
S(x) =
3
2
(x − 1) + ex − 1
x ∈ [1, 2]
Solution. We first compute the derivatives of the individual functions
S0′ (x) = b + 2c(x − 1) + 3d(x − 1)2
S0′′ (x) = 2c + 6d(x − 1)
S1′ (x) = 3(x − 1)2 + 2ex
S1′′ (x) = 6(x − 1) + 2e
We will make use of the continuity condition and the definition of the natural cubic
spline.
From S0 (1) = S1 (1), we have a = c − 1.
From S0′ (1) = S1′ (1), we have b = 2e.
From S0′′ (1) = S1′′ (1), we have 2c = 2e, with c = e.
We also have
S0′′ (0) = S ′′ (2) = 0
2c − 6d = 0,
2e + 6 = 0,
we have e = −3, c = −3. Then a = e − 1 = −4, b = 2e = −6, and d = c/3 = −1.
5. (10 points) Determine the coefficients so that the function
S(x) =
(
x2 + x3
a + bx + cx2 + dx3
0≤x≤1
1≤x≤2
is a cubic spline and has the property S1′′′ (x) = 12.
Solution. The derivatives are
S0′ (x) = 2x + 3x2
S0′′ (x) = 2 + 6x
S1′ (x) = b + 2cx + 3dx2
S1′′ (x) = 2c + 6dx
S1′′′ (x) = 6d
Given the condition S1′′′ (x) = 12, we have d = 2.
By continuity, we have S0′ (1) = S1′ (1), which yields 5 = b + 2c + 3d.
From S0′′ (1) = S1′′ (1), we have 8 = 2c + 6d.
We can solve the above two equations and get c = −2 and b = 3.
From S0 (1) = S1 (1), we have 2 = a + b + c + d, which gives us a = −1.
6. (10 points) List all the ways in which the following function fails to be a natural
cubic spline:
(
x3 + x − 1 (−1 ≤ x ≤ 0)
f (x) =
x3 − x − 1 (0 ≤ x ≤ 1)
Solution. S ′ (x) is not continuous at x = 0. S ′′ (x) is not equal to zero at x = −1, 1.
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement