Assignment 06
Assignment 06
Exercise Sheet 6
Exercise 6.1 Solving linear systems [Exam Winter 2018: Part II]
This is the second part of Exercise 3.1.
Bandmatrices:
For p, q ∈ N ∪ {0} we consider (p, q)-band matrices, i.e. matrices A ∈ Rn×n s.t. Aij = 0 if
i > p + j or j > q + i.
(6.1a) Complete the template band_lu.m: Input is the (p, q)-band matrix A ∈ Rn×n (which
allows an LU-decomposition) as well as p, q ∈ N ∪ {0}. Output is the (p, 0)-band matrix L ∈
Rn×n and the (0, q)-band matrix U ∈ Rn×n , such that A = LU is the LU-decomposition of A.
Implement an algorithm, whose complexity for fixed p and q does not exceed O(n) as n → ∞.
To achieve this, work with sparse matrices in Matlab.
Hint: You can create a sparse n × n zero matrix in Matlab by sparse(n,n). Also speye might
be useful.
(6.1b) Complete the template band_fbsubs.m and implement forward and backward substitu-
tion for band matrices: Input are L, U ∈ Rn×n , the vector b ∈ Rn as well as p, q ∈ N ∪ {0},
where L, U are as in (6.1a). Output is the solution x to Ax = b. Your implementation should
not exceed the computational complexity O(n) for n → ∞ (for fixed p, q). Usage of the Matlab
backslash operator is no allowed.
(6.1c) Complete the template for band_inv.m: Input is the (p, q)-band matrix A ∈ Rn×n (which
allows an LU-decomposition) as well as p, q ∈ N ∪ {0}. Output is A−1 ∈ Rn×n . Compute A−1
with the use of band_lu.m and band_fbsubs.m.
Complete the template test_band_inv.m: For every n ∈ {2j | j = 2, . . . , 8} create the matrix
An in Matlab as a sparse matrix, and invert An with band_inv.m. Plot n vs. the time your
program takes to invert An in a double logarithmic plot. The asymptotic behaviour will be O(nα )
for some α > 0 as n → ∞. What is the smallest possible α (without proof)?
Hint: Use spdiags.
′ λi
Prove that λi = 1/ωn+1 (xi ) and that ℓi (x) = ωn+1 (x) , for i = 0, . . . , n.
x − xi
(6.2b) Let pn ∈ Pn be the interpolating polynomial of degree at most n satisfying (6.2.1). Show
that pn is given by the barycentric interpolation formula
Pn λi yi
i=0 x−xi
pn (x) = Pn λi
.
i=0 x−xi
(6.3a) Prove that I[a,b] : C 1 ([a, b]) → P2 is a well-defined map, i.e. that for each f ∈ C 1 ([a, b])
there exists a unique I[a,b] [f ] ∈ P2 satisfying (6.3.1).
(6.3b) Set a = 0 and b = 1. Find polynomials h1 , h2 , h3 ∈ P2 such that for every f ∈ C 1 ([0, 1])
I[0,1] [f ] (x) = f (0)h1 (x) + f (1)h2 (x) + f ′ (1)h3 (x), x ∈ [0, 1].
(6.3.2)
Hint: Find for every i = 1, . . . , 3 conditions which hi ∈ P2 must satisfy, and use them to construct
hi .
(6.3c) Set a = 0 and b = 1. Show that for all g ∈ C 1 ([0, 1]) it holds
g − I[0,1] [g] ∞,[0,1] ≤ inf (1 + Λ1 )∥g − u∥∞,[0,1] + Λ2 ∥g ′ − u′ ∥∞,[0,1] ,
u∈P2
with the Lebesgue-type constants Λ1 := ∥|h1 | + |h2 |∥∞,[0,1] and Λ2 := ∥|h3 |∥∞,[0,1] , and where
h1 , h2 , h3 ∈ P2 are the polynomials obtained in (6.3b).
Hint: Use the existence of h1 , h2 , h3 from (6.3b), even if you did not find them.
(6.3e) Let again −∞ < a < b < ∞ be arbitrary but fixed. Show that for all f ∈ C 3 ([a, b]) it
holds
1 1
f − I[a,b] [f ] ∞,[a,b] ≤ (1 + Λ1 ) + Λ2 (b − a)3 f (3) ∞,[a,b] ,
3! 2!
where Λ1 and Λ2 are as in (6.3c).
Hint: Use the results from (6.3c) and (6.3d) even if you did not prove them.
i) What is the cost (in terms of number of floating point multiplications) of evaluating pn,R at
a point X ∈ Mm (R)?
ii) What is the cost if we instead use Horner’s scheme to evaluate pn,R at a point X ∈ Mm (R)?
References
[NMI] Lecture notes for the course “Numerische Mathematik I”.