0% found this document useful (0 votes)
17 views

Assignment 06

Uploaded by

Relja Glisic
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Assignment 06

Uploaded by

Relja Glisic
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Prof. Ch.

Schwab Autumn Semester 2024 ETH Zürich


Fabian Rohner Numerische Mathematik I D-MATH

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.

(6.1d) For n ∈ N consider the matrix An ∈ Rn×n such that




 3 if i = j,

2 if j = i + 1,
(An )i,j = (6.1.1)


 1 if i = j + 1 or j = i + 2,

0 otherwise.

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.

Exercise Sheet 6 Page 1 Numerische Mathematik I


Exercise 6.2 Lagrange Polynomials
Set n ∈ N0 and let {xi }ni=0 ⊂ R be a given set of n + 1 pairwise distinct nodes satisfying
x0 < x1 < · · · < xn−1 < xn . We consider the following polynomial interpolation problem:
find pn ∈ Pn such that pn (xi ) = yi , for i = 0, . . . , n, (6.2.1)
where {yi }ni=0 ⊂ R are given values.

(6.2a) We denote by li ∈ Pn , i = 0, . . . , n, the (n + 1) Lagrange interpolation polynomials. Let


Yn
us define the Knotenpolynom ωn+1 (x) := (x − xj ) ∈ Pn+1 and the quantities
j=0
n
Y 1
λi := , for i = 0, . . . , n.
x − xj
j=0 i
j̸=i

′ λ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

Exercise 6.3 Hermite Interpolation [Exam Winter 2021]


Given −∞ < a < b < ∞, let I[a,b] : C 1 ([a, b]) → P2 be the Hermite interpolation operator
(“Hermite interpolant”) defined, for f ∈ C 1 ([a, b]), as the solution of the following problem: find
I[a,b] [f ] ∈ P2 satisfying the following three conditions:
′
I[a,b] [f ] (b) = f ′ (b).
 
I[a,b] [f ] (a) = f (a), I[a,b] [f ] (b) = f (b), and (6.3.1)
As a norm in C 0 ([a, b]) we use ∥f ∥∞,[a,b] := max |f (x)|.
x∈[a,b]

(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.

Exercise Sheet 6 Page 2 Numerische Mathematik I


(6.3d) Let −∞ < a < b < ∞ be arbitrary but fixed. Consider the affine transformation
T : [0, 1] → [a, b] given by T (ζ) = a + ζ(b − a). Prove that for f ∈ C 3 ([a, b]) it holds:

i) I[0,1] [f ◦ T ] = I[a,b] [f ] ◦ T , and

ii) (f ◦ T )(3) = (b − a)3 f (3) ◦ T .

Here, (3) denotes the third derivative.

(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.

Exercise 6.4 Horner’s scheme for matrix polynomials


(6.4a) In this question we investigate the cost (in terms of FLOPs) of evaluating a matrix poly-
nomial with matrix valued coefficients.
Let m ∈ N and denote by R := Mm (R)[X] the polynomial ring over the ring of all m × m
real-valued square matrices Mm (R). For n ∈ N, let pn ∈ R be a polynomial of degree n with
coefficients A0 , . . . , An ∈ Mm (R).
We define by pn,R : R → R the associated polynomial function by letting

pn,R (X) = pn (X) = A0 + A1 X + · · · + An Xn , for all X ∈ Mm (R).

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)?

Published on October 23, 2024.


To be submitted on October 30, 2024.
Submit all files via Moodle. Matlab: Include the files that generate the plots. Label all your
plots. Include commands to run your functions. Comment on your results.

References
[NMI] Lecture notes for the course “Numerische Mathematik I”.

Last modified on Wednesday 23rd October, 2024

Exercise Sheet 6 Page 3 Numerische Mathematik I

You might also like