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

Exam-TANA09-2025-January

The document outlines the exam details for the course TANA09 at Tekniska Högskolan i Linköping, including allowed materials, total marks, and passing criteria. It contains various mathematical problems related to computational mathematics, including error analysis, interpolation, numerical methods, and matrix decomposition. The document also provides specific tasks and expected outcomes for each problem, emphasizing the importance of accuracy and error bounds in numerical computations.

Uploaded by

farmous
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Exam-TANA09-2025-January

The document outlines the exam details for the course TANA09 at Tekniska Högskolan i Linköping, including allowed materials, total marks, and passing criteria. It contains various mathematical problems related to computational mathematics, including error analysis, interpolation, numerical methods, and matrix decomposition. The document also provides specific tasks and expected outcomes for each problem, emphasizing the importance of accuracy and error bounds in numerical computations.

Uploaded by

farmous
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

TEKNISKA HÖGSKOLAN I LINKÖPING

Matematiska institutionen
Beräkningsmatematik/Fredrik Berntsson

Exam TANA09 Datatekniska beräkningar

Date: 14-18, 18th of January, 2025.

Allowed:

1. Pocket calculator

Examiner: Fredrik Berntsson

Marks: 25 points total and 10 points to pass.

Jour: Fredrik Berntsson - (telefon 013 28 28 60)

Good luck!
2
(5p) 1: a) Let a = 712.6623 be an exact value. Round the value a to 6 significant digits
to obtain an approximate value ā. Also give a bound for the absolute error in
ā.
b) Let x = 37.119875. Write x in normalized form and give a bound for the
relative error when x is stored on a computer using the floating point system
(10, 5, −10, 10).
c) Explain why the formula y = cos x − 1 can give poor accuracy when evaluated,
for small x, on a computer. Also propose an alternative formula that can be
expected to work better.
p
d) Let y = 1 + a/2, where a = 1.27 ± 0.02. Compute the approximate value ȳ
and give an error bound.

(2p) 2: We have the following table

x 1.0 1.3 1.5


f (x) 1.284 1.413 1.475

with correctly rounded function values. Use linear interpolation to approximate the
function value f (1.18). Also give a complete error estimate.

(2p) 3: We compute the function


f (x) = 1 − 2x cos(x)
for small x values on a computer with unit round off µ = 1.11 · 10−16 . Preform an
analysis of the computational errors to obtain a bound for the relative error in the
computed results f (x). For the analysis you may assume that all computations are
performed with a relative error at most µ. Also, use the obtained bound to argue
if cancellation occurs during the computations. In case of cancellation also suggest
an alternative formula that can be expected to give better accuracy.

3
(4p) 4: The non-linear equation f (x) = 1 − x2 + cos(x/2) = 0 has a root x∗ ≈ 1.34. Do the
following:

a) The equation Formulate the Newton-Raphson method for finding approxima-


tate solutuins x̄ ≈ x∗ . Also perform k = 3 iterations with the method using
the initial guess x0 = 1.34.
b) Estimate the error in the approximate root x̄ = 1.336056 ≈ x∗ .
c) An iterative method xk+1 = ϕ(xk ) has at least quadratic convergence if the
iteration function satisfies ϕ′ (x∗ ) = 0, where x∗ is the fixed point, or the
root of the equation f (x) = 0. Present a definition that clearly shows what
quadratic convergence means and also show that the Newton-Raphson method
has quadratic convergence if x∗ is a single root.

(3p) 5: Do the following

a) A computer program has computed the decomposition P A = LU and the


output is
     
1 0 0 1.7 −2.3 −1.4 1 0 0
L = −1.7 1 0
  U=  0 1.2 −0.5  P= 0 0
 1 .
0.3 0.8 1 0 0 3.1 0 1 0

Determine if pivoting was used correctly during the computations. Motivate


your answer!
b) Let  
2.2 −0.9 −1.3
A =  1.1 −0.7 1.2  ,
−1.1 0.5 0.8
and find a Guass transformation matrix M1 so that M1 A has zeroes below the
diagonal in the first column.
c) Let  
0.3 −0.9 −1.3
A =  2.1 −0.1 0.7  ,
−1.1 −1.6 0.8
and compute kAk∞ .

4
(4p) 6: Let A ∈ Rm×n be a matrix and A = UΣV T be the singular value decomposition.
Do the following:
a) Suppose m = n and rank(A) = n. Show that the formula
n
X uT bi
x= vi
i=1
σi

provides a solution to Ax = b. Is the solution unique?


b) Suppose rank(A) = n. Clearly demonstrate how the matrices U and V provides
basis vectors for the spaces Range(A) and null(A). What are the dimension of
the range and null space respectively.
c) Show that kAk2 = σ1 and if A−1 exists then kA−1 k2 = 1/σn .

(2p) 7: The Trapezoidal method computes an approximation


Z b
T (h) ≈ I = f (x)dx,
a

where the accuracy depends on the step size h used. The truncation error of the
method can be described as RT ≈ Chp . We compute a few approximations T (h) of
the exact integral I and obtain

h 0.4 0.2 0.1


T(h) 1.5826 1.5672 1.5635

Use the table to determine C and p. Also estimate the step size h needed for the
error to be of magnitude 10−4. Present your calculations.

(3p) 8: a) Let s(x) be defined by two cubic polynomials,



s1 (x) = 0.9 + 0.1x + 0.6x2 + 0.4x3 , 0 ≤ x < 1,
s(x) =
s2 (x) = 2.0 + c1 (x − 1) + c2 (x − 1)2 + 0.4(x − 1)3 , 1 ≤ x ≤ 2.
Find the appropriate values for the constants c1 and c2 so that s(x) is a cubic
spline.
b) Let P1 = (1 , 0)T , P2 = (1 , 3)T , P3 = (4 , 3)T and P4 = (4 , 2)T . Draw a
sketch that clearly shows the convex hull formed by these points. Also use the
available information to draw the cubic Beziér curve formed by the four points
P1 , . . . , P4 as accurately as possible.
c) Use the identity 1 = 13 = (1 − t + t)3 to derive the expression for a cubic
Beziér curve. Also draw a clear sketch that shows an example of a continuously
differentiable curve consisting of two different cubic Beziér curves. The sketch
should include all the control points, dashed lines connecting the control points,
and also the curve itself. Also state how many control points are needed in total
to create the continuous curve.

5
Answers

(5p) 1: For a) we obtain the approximate value ā = 712.662 which has 6 significant digits.
The absolute error is at most |∆a| ≤ 0.5 · 10−3 .
In b) the x = 3.7119875 · 101 in normalized form and the unit round off for the
floating point system is µ = 0.5 · 10−5. This is an upper bound for the relative error
when a number is stored on the computer.
For c) Since cos(x) ≈ 1, for small x, we catastrophic cancellation will occur when
cos(x) − 1 is computed resulting in a large relative error in the result. A better
formula would be
(cos(x) − 1)(cos(x) + 1) cos2 (x) − 1 sin2 (x)
cos(x) − 1 = = = ,
cos(x) + 1) cos(x) + 1) cos2 (x) + 1
where the cancellation is removed.
p √
For d) The approximate value is ȳ = 1 + ā/2 = 1.635 = 1.28 with |RB | ≤
0.5 · 10−2 . The error propagation formula gives
∂y 1 1
|∆y| . | ||∆a| = | p ||∆a| < 0.004.
∂a 2 1 + a/2 2
The total error is |RT OT | ≤ 0.004 + 0.5 · 10−2 < 0.009 < 0.01. Thus y = 1.27 ± 0.01.

(2p) 2: We use Newtons interpolation formula and the ansatz p(x) = p1 (x) + RT (x) =
c0 + c1 (x − 1.0) + c2 (x − 1.0)(x − 1.3), where the last term will be used to estimate
the truncation error. Inserting the function values from the table leads to p(1.0) =
c0 = 1.284 and p(1.3) = c0 + c1 (0.3) = 1.413 which means c1 = 0.43. The last
equation is p(0.9) = c0 + c1 (0.5) + c2 (0.5)(0.2) = 1.475 which gives c2 = −0.24.
Thus
p1 (x) = 1.284 + 0.43(x − 1.0) and RT (x) = −0.24(x − 1.0)(x − 1.3).
We obtain f (1.18) ≈ p1 (1.18) = 1.361 with |RB | < 0.5 · 10−3 and RT ≤ | −
0.24(1.18 − 1.0)(1.18 − 1.3)| < 0.52 · 10−2. The errors in the function values used
also gives an error RXF < 0.5·10−3 in the result. Thus f (1.18) = 1.361±0.62·10−2 =
1.361 ± 0.7 · 10−2 .

(2p) 3: The computational order is


f (x) = 1 − 2x cos(x) = 1 − 2xa + 1 − b = c.
The error propagation formula gives us
∂f ∂f ∂f
|∆f | . | ||∆a| + | ||∆b| + | ||∆c| = |2x||∆a| + |1||∆b| + |1||∆c| .
∂a ∂b ∂c
µ(|2xa| + |b| + |c|) ≈ µ(|2x| + |2x| + 1) ≈ µ,
where we have used cos(x) ≈ 1, f (x) = c ≈ 1 and that x is small. There is no
cancellation present in these calculations. Everything turns out fine and both the
absolute and relative errors are bounded by µ (since the function value f (x) ≈ 1).

6
(4p) 4: For a) we write the Newton-Raphson method as
f (xn )
xn+1 = xn − ,
f ′ (xn )
where f (x) is given in the exercise and f ′ (x) = −2x − sin(x/2)/2. There is no need
to simplify anything. Just inserting into the formula gives

x1 = 1.3360614, x2 = 1.3360557, and x3 = 1.3360557

For b) the error estimate is given by

|f (x̄)| 9.1 · 10−7


|x − x̄| ≤ ≤ < 3.1 · 10−7 .
|f ′ (x̄)| 2.98

For c) we state that the sequence {xn } has quadratic convergence (to x∗ ) if
|xn−1 − x∗ |
lim = C.
n→∞ |xn−1 − x∗ |2

where C is a constant. The same limit also cannot exist for p = 3 or we would have
cubic convergence. For the Newton-Raphson method ϕ(x) = x − f (x)/f ′ (x). Thus,

(f ′ (x))2 − f (x)f ′′ (x) f (x)f ′′ (x)


ϕ′ (x) = 1 − = .
(f ′ (x))2 (f ′(x))2
Since for a single root x∗ we have f (x∗ ) = 0 and f ′ (x∗ ) 6= 0 we see that ϕ′ (x∗ ) = 0.
This means we have quadratic convergence.

(3p) 5: For a) we just observe that one of the multipliers (i.e. ℓ21 = −1.7) is larger than
one in magnitude. Thus pivoting wasn’t used correctly.
For b) the Gauss transformation matrix should have the structure
 
1 0 0
M1 =  −m1 1 0  ,
−m2 0 1

where m1 = 2.1/0.3 = 7 and m2 = −1.1/0.3 = −3.667.


For c) we note that the last row gives the largest sum and kAk∞ = | − 1.1| + | −
1.6| + |0.8| = 3.5.

(4p) 6: For a) we simply compute


X uTi b X uT b X uT b X
Ax = A( i = 1n vi ) = i = 1n i Avi = i = 1n i σi ui = i = 1n(uTi b)ui = b.
σi σi σi
The last equality holds since m = n so b ∈ Rn and {ui }ni=1 is an orthonormal basis
for Rn . The solution is uniqie since A has full rank so A−1 exists.

7
For b) we write the decomposition A = UΣV T as
n
X
A= σi ui viT ,
i=1

where σn > 0 as rank(A) = n. This means that Avi = σi ui 6= 0 for i = 1, . . . , n. So


the null space is only the trivial one null(A) = {0} with dimension 0. Similarily, if
y belongs to the range then there is an x such that y = Ax, or
n
X
y = Ax = σi (viT x)ui ,
i=1

so the y is a linear combination of {u1 , . . . , un }. Thus range(A) = span(u1 , . . . , un )


and the dimension of the range is n.
For c) we use A = UΣV T where U, V are orthogonal and Σ = diag(σ1 , σ2 , . . . , σn ).
Since U, V are orthogonal we obtain kAk2 = kUΣV T k2 = kΣk2 . The norm of a
diagonal matrix can be computed by
sP sP
2 2
kΣyk2 σ y y2
kΣk2 = maxn = maxn P i 2 i ≤ σ1 maxn P i2 = σ1 ,
y∈R kyk2 y∈R yi y∈R yi

with equality for y = e1 . Thus kAk2 = σ1 . If A−1 exists then A−1 = V Σ−1 U T and
kA−1 k2 = kΣ−1 k2 . Since the diagonal elements of Σ−1 are 1/σi the largest diagonal
element is 1/σn and kA−1 k2 = 1/σn .

(2p) 7: Since T (h) = T (0) + Chp we get

T (4h) − T (2h) (4p − 2p )Chp


≈ p = 2p
T (2h) − T (h) (2 − 1p )Chp
Insert numbers from the table we obtain
1.5826 − 1.5672
2p = = 4.1622.
1.5672 − 1.5635
Which fits almost perfectly with p = 2. In order to determine C we use the last
equation T (2h) − T (h) =p(22 − 12 )Ch2 and insert h = 0.1 to obtain C = 0.3700.
Finally RT = 10−4 if h = 10−4 /0.3700 = 0.0164. Thus h < 0.016 is required.

(3p) 8: For a) can use s′1 (1) = s′2 (1), or

0.1 + 2 · 0.6 · 1 + 3 · 0.4 · 12 = c1 ,

to find c1 = 2.5. Similarily s′′1 (1) = s′′2 (1), or

2 · 0.6 + 3 · 2 · 0.4 · 1 = 2c2 ,

to obtain c2 = 1.8.

8
For b) the sketch is

P2 P3
P4

P1

The convex hull is the area enclosed by the dashed lines. Important features of the
Beziér curve is that since both P1 /P2 and P3 /P4 have the same x-coordinate the
tangent direction of the curve is vertical at both the starting and ending points.
In c) the identity 1 = (1 − t + t)3 = (1 − t)3 + 3(1 − t)2 t + 3(1 − t)t2 + t3 gives us
the weights for the control points. The cubic Beziér curve is thus

p(t) = P1 (1 − t)3 + P2 3(1 − t)2 t + P3 3(1 − t)t2 + P4 t3 , 0 ≤ t ≤ 1,

where the control points P1 , P2 , P3 , P4 are vectors in the plane R2 . The sketch should
clearly show that if you have two cubic Beziér segments then you need a total of
n = 7 control points.

You might also like