Starting from:

$35

Numerical Analysis Homework 4 Solved

I.       Consider  on [0,2]:

( p(x)          if x ∈ [0,1],

s(x) =

                                     (2 − x)3       if x ∈ [1,2].

Determine p ∈ P3 such that s(0) = 0. Is s(x) a natural cubic spline?

II.      Given fi = f(xi) of some scalar function at points a = x1 < x2 < ··· < xn = b, we consider interpolating f on [a,b] with a quadratic spline .

(a)   Why an additional condition is needed to determine s uniquely?

(b)   Define mi = s0(xi) and pi = s|[xi,xi+1]. Determine pi in terms of fi,fi+1, and mi for i = 1,2,...,n − 1.

(c)   Suppose m1         =               f0(a) is given.        Show how

m2,m3,...,mn−1 can be computed.

III.    Let s1(x) = 1+c(x+1)3 where x ∈ [−1,0] and c ∈ R. Determine s2(x) on [0,1] such that

 ,

is a natural cubic spline on [−1,1] with knots −1,0,1. How must c be chosen if one wants s(1) = −1?

IV.    Consider  with x ∈ [−1,1].

(a)   Determine the natural cubic spline interpolant tof on knots −1,0,1.

(b)   As discussed in the class, natural cubic splineshave the minimal total bending energy. Verify this by taking g(x) be (i) the quadratic polynomial that interpolates f at −1,0,1, and (ii) f(x). V. The quadratic B-spline Bi2(x).

(a)   Derive the same explicit expression of Bi2(x) as that in the notes from the recursive Definition of B-splines and the hat function.

(b)   Verify that ddxBi2(x) is continuous at ti and ti+1.

(c)   Show that only one x∗ ∈ (ti−1,ti+1) satisfies ddxBi2(x∗) = 0. Express x∗ in terms of the knots within the interval of support.

(d)     Consequently, show Bi2(x) ∈ [0,1).

(e)   Plot .

VI. We proved a theorem on constructing B-splines from truncated power functions,

Verify it algebraically for the case of n = 2, i.e.

 .

The above six problems weigh 4, 9, 4, 8, 10, and 5 points, respectively.

2        C++ programming
(a)   Write a C++ subroutine for cubic-spline interpolation of the function

on evenly spaced nodes within the interval [−1,1] with N = 6,11,21,41,81. Compute the max-norm of interpolation errors at the nodes for each N and report the errors and convergence rates with respect to the number of subintervals.

Your algorithm should follow the example of interpolating the natural logarithm in the notes and your program must use an implementation of lapack.

Plot the interpolating spline against the exact function to observe that spline interpolation is free of the wide oscillations in the Runge phenomenon.

(b)   (*) Write a Matlab subroutine to illustrate (1) by plotting the truncated power functions and building a table of divided difference where the entries are figures instead of numbers. See the hints in Section 4.

The two programming assignments weigh 14 and 6 points, respectively. Problem (b) is for extra credit. The total number of points of this homework is thus 54(+6).

More products