You are on page 1of 3

Exam in Numerical Analysis FMN050/FMNF10

2018–04–05
Exam duration 8:00–12:00. In order to pass, a minimum of 15 points is
required on the exam. The (preliminary) grade requirements are
grade 3 ≥ 15 p, grade 4 ≥ 21 p and grade 5 ≥ 26 p.

You are allowed to use a pocket calculator, but no other material of any
kind. Please answer the problems in Swedish or English.

Problems
1. Consider the linear system Ax = b, where the matrix A has the LU -
decomposition
  
1 0 0 1 2 1
A = LU =  −2 1 0  0 1 2 
3 −1 1 0 0 1

Solve Ax = b, with b = (1, 0, 1)T , by performing one forward and one back-
ward substitution. (2p)

2. Let
   
1 2 1 −6 1 3
B =  −2 −3 0  and B −1 =  4 −1 −2 
3 5 2 −1 1 1

a) Compute the condition number of B with respect to the max norm.


(1p)

b) Your friend has written a code for solving the linear system Bx = b,
with b = (1, 0, 1)T . The code has a bug and 0.001 is added to every
entry in the matrix B. Give a bound of the solution’s relative error
kδxk∞ /kx + δxk∞ caused by the bug. (2p)

3. Consider the equation

x = (x + 3)1/3 , 1 ≤ x ≤ 3.

In order to approximate a solution, we will use a fixed point iteration.

a) Write down the formula for the fixed point iteration and perform six
iterations with x0 = 2 as starting value. (1p)

b) Prove that your fixed point iteration is convergent. (2p)

1
4. Construct the Lagrange interpolation polynomial that interpolates the
data below. (3p)

x -1 0 1 2
y 2 0 0 -1

5. We would like to fit a straight line y(x) = c0 +c1 x to the data in Problem 4
by using the least squares method.

a) Derive the overdetermined system Ac ≈ b which the coefficients c =


(c0 , c1 )T need to fulfill. (1p)

b) Approximate a solution to the overdetermined system by the least


squares method. (2p)

6. Consider the integral Z 1


1
dx.
0 1 + x3
a) Approximate the integral by employing the trapezoidal rule and divid-
ing the interval [0, 1] into N = 4 equally sized intervals. (2p)

b) How does the error of the trapezoidal rule decrease as the number of
intervals N tends to infinity? (1p)

7. We want to solve the two-point boundary value problem

y 00 (x) + 1 + x2 y 0 (x) + y(x) = 0,




with boundary values y(0) = 1 and y(1) = 2. Introduce a suitable notation


and discretize the problem by a standard second order method, i.e., the
derivatives should be discretized as in Project 2. Construct the linear system
(in matrix-vector form) that has to be solved, and make sure to include the
boundary conditions. All details, such as matrix dimensions, vector lengths,
grid, step size ∆x, etc., must be clearly stated. (5p)

8. Consider the initial value problem

y 0 (t) = −50 y(t) + Ce−2t , t > 0,

with the initial value y(0) = 2. Here, C is a given parameter.

a) Set C = 1 and approximate y(0.1) by using the implicit Euler method


with the time step ∆t = 0.1. (2p)

2
b) How does the global error of the implicit Euler method decrease as ∆t
tends to zero? (1p)

c) Your friend (again) has a code for approximating the initial value prob-
lem. With C = 0 and ∆t = 1/24, the code produces the graph below.
The full line is the exact solution y(t) and the circles are the approxi-
mations of y(n∆t). Has your friend used the implicit Euler method in
the code? Motivate your answer. (2p)

15

10

0
y

-5

-10

-15
0 0.2 0.4 0.6 0.8 1
t

9. Consider the Matlab code below.

b = [1 2 1]’
L = [0 0 0; 1 0 0; 1 2 0]
U = [0 0 -1; 0 0 0; 0 0 0]
D = [10 0 0; 0 12 0; 0 0 -9]
x = [0 0 0]’
N = 12
for n = 1:N
x = -inv(D)*(L+U)*x+inv(D)*b
end
x_out = x

Which numerical method is implemented in the code? What does the vector
x_out approximate? (3p)

Lycka till!

You might also like