0% found this document useful (0 votes)
11 views8 pages

Exam TANA09 2022 Mars

The document outlines an exam for the course TANA09 at Tekniska Högskolan i Linköping, detailing the allowed materials, exam dates, and contact information for the examiner. It includes various mathematical problems related to numerical methods, error analysis, and cubic Beziér curves, each with specific points allocated for correct answers. The document serves as a guide for students preparing for the exam, providing a structured format for problem-solving in computational mathematics.

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)
11 views8 pages

Exam TANA09 2022 Mars

The document outlines an exam for the course TANA09 at Tekniska Högskolan i Linköping, detailing the allowed materials, exam dates, and contact information for the examiner. It includes various mathematical problems related to numerical methods, error analysis, and cubic Beziér curves, each with specific points allocated for correct answers. The document serves as a guide for students preparing for the exam, providing a structured format for problem-solving in computational mathematics.

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/ 8

TEKNISKA HÖGSKOLAN I LINKÖPING

Matematiska institutionen
Beräkningsmatematik/Fredrik Berntsson

Exam TANA09 Datatekniska beräkningar

Date: 14-18, 18th of Mars, 2022.

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 = 0.0390267 be an exact value. Round the value a to 5 correct decimals
to obtain an approximate value ā. Also give a bound for the relative error in
ā.
b) Let x = 13.245 and y = 7.8802 be two numbers that belong to the floating
point system (10, 4, −9, 9). What would be the result of z = x + y if the
computations where carried out on a computer using the floating point system
(10, 4, −9, 9)?
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.

d) Let y = 2x, where x = 0.35 ± 0.02. Compute the approximate value ȳ and
give an error bound.

(2p) 2: Let the table,

x 1.3 1.4 1.5 1.6 1.7


f (x) 0.917 1.031 1.183 1.129 1.056

of correctly rounded function values, be given. Use linear interpolation to find an


approximation of the function value f (1.57). Also estimate the error in the obtained
result.

(3p) 3: We compute the function


√ √
f (x) = 1+x− 1−x

for small x values on a computer with unit round off µ = 1.11 · 10−16 . We find that
the results are quite poor and that the relative error in the result tends to grow as
x → 0. Explain the poor accuracy by performing an analysis of the computational
errors and give a bound for the relative error in the computed result f (x). For the
analysis you may assume that all computations are performed with a relative error
at most µ.

3
(3p) 4: A cubic Beziér curve is given by an expression

p(t) = c1 (t)P1 + c2 (t)P2 + c3 (t)P3 + c4 (t)p4 , 0 < t < 1,

where P1 , P2 P3 and P4 are control points, and ci (t), i = 1, 2, 3, 4 are the weights.

a) Use the identity 1 = (1 − t + t)3 to dervie the weights ci (t) for the cubic Beziér
curve.
b) Suppose we want to combine two cubic Beziér curves to one single curve. The
combined curve should start in the point (0, 3), pass through the point (1, 1)
and end in the point (2, 0). The curves tanget should be horizontal at start
and end points and also vertical at the interpolation point (1, 1). Answer the
following queastions: Are these requirements enough to make the curve unique?
Provide a set of control points and clearly argue that all the requirements are
satisfied. Finally draw a sketch illustrating the two curve segments.

(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 = −0.7 1 0
  U=  0 1.2 −0.5  P= 0 0
 1 .
0.3 1.8 1 0 0 3.1 0 1 0

Determine if pivoting was used correctly during the computations. Motivate


your answer!
b) Let L be given as above and compute kLk∞ .
c) Suppose we want to solve a linear system Ax = b but have errors in the vector
b. Show the error estimate
k∆xk k∆bk
≤ κ(A) ,
kxk kbk

where k · k is any induced norm and κ(A) is the condition number.

4
(4p) 6: Consider the cubic polynomial f (x) = x3 − 9x2 + 24x − 20. We want to use Newton-
Raphsons method for finding a root. Do the following

a) Formulate the Newton-Raphson method and derive the resulting iteration for-
mula when the method is applied to the above cubic polynomial.
b) When Newton-Raphson’s method is applied to the function f (x) above with
the starting guess x0 = 1.8 we obtain the following table
k xk |xk − x∗ |
0 1.8000 0.2000
1 1.8970 0.1030
2 1.9476 0.0524
3 1.9736 0.0264
4 1.9867 0.0133
State the definition of order of convergence p for an iterative method. Also
use the table to determine the order of convergence when Newton-Raphson’s
method is applied to this specific function f (x).
c) Use the results from b) and known properties of Newton-Raphson’s method
to determine if x∗ = 2 is a double or single root. Explain briefly why you reach
the conclusion.

(2p) 7: A numerical method, depends on a discretization parameter h, and has a truncation


error that can be described as RT ≈ Chp . We use the method to compute a few
approximations T (h) of the exact result T (0) and obtain

h 0.9 0.3 0.1


T(h) 2.923 3.172 3.201

Use the table to determine C and p. Also estimate the value of h needed for the
error to be of magnitude 10−3.

(3p) 8: a) Suppose the m × n matrix A, with m > n, has rank n, and that the linear
system Ax = b has a solution. Use the singular value decomposition A =
UΣV T to give the a formula for the solution x of the system Ax = b. Is the
solution unique? Clealy motivate your answers.
b) Let A be an m × n matrix, m > n. Show how the singular value decomposition
A = UΣV T can be used for solving the minimization problem

min kAxk2 .
kxk2 =1

Give both the minmizer x and the minimum in terms of singular values and
singular vectors.

5
Answers

(5p) 1: For a) we obtain the approximate value ā = 0.03903 which has 5 correct decimal
digits. The absolute error is at most |∆a| ≤ 0.5 · 10−5 and thus the relative error is
bounded by ∆a|/|a| ≤ 0.5 · 10−5/0.03903 ≤ 0.128 · 10−3 .
In b) we first compute the exact result z = 13.245+7.8802 = 21.1252 and round the
result to fit the number system (10, 4, −9, 9). to obtain z̄ = 21.125 = 2.1125 · 101 .
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) − 12 − sin2 (x)
cos(x) − 1 = = = ,
cos(x) + 1 cos(x) + 1 cos(x) + 1
where the cancellation is removed.
√ √
For d) The approximate value is ȳ = 2x̄ = 2 · 0.35 = 0.84 with |RB | ≤ 0.5·10−2.
The error propagation formula gives
∂y
|∆y| . | ||∆x| = |(2 · 0.35)−1/2 |0.02| < 0.024.
∂x
The total error is |RT OT | ≤ 0.024 + 0.5 · 10−2 < 0.03. Thus y = 0.84 ± 0.03.

(3p) 2: First we note that the closest points to x = 1.57 in the table are x1 = 1.5, x2 = 1.6,
and x3 = 1.7.
Making the anzatz p1 (x) = c0 + c1 (x − 1.5) + c2 (x − 1.5)(x − 1.6), where the last
term will be used to estimate the truncation error RT , we obtain

p1 (1.5) = c0 = 1.183, p1 (1.6) = c0 + c1 (1.6 − 1.5) = 1.129 =⇒ c1 = −0.54.

For the truncation error we also compute

p1 (1.7) = c0 + c1 (1.7 − 1.5) + c2 (1.7 − 1.5)(1.7 − 1.6) = 1.056 =⇒ c2 = −0.95.

So p1 (x) = 1.183 − 0.54 · (x − 1.5) and RT (x) = −0.95(x − 1.5)(x − 1.6). Thus
we obtain p1 (1.57) = 1.145, RB ≤ 0.5 · 10−3 , |RT (1.57)| ≤ 2 · 10−3 . We also have
to remember the errors in the table giving RXF ≤ 0.5 · 10−3 . Thus f (1.57) =
1.145 ± (0.5 · 10−3 + 2 · 10−3 + 0.5 · 10−3 ) = 1.145 ± 3 · 10−3 .

(3p) 3: We first determine the computational order as


√ √ √ √
f (x) = 1 + x − 1 − x = a − b = c − d = e.

The relative errors in the intermediate results, e.g. |∆a|/|a|, are boudned by µ. The
error propagation formula gives
1 1
|∆f | . | √ ||∆a| + | √ ||∆b| + |∆c| + |∆d| + |∆e|.
2 a 2 b

6
In order to simplify the result we use a ≈ b ≈ c ≈ d ≈ 1 for small x. Also
√ √ √ √
( 1 + x − 1 − x)( 1 + x + 1 − x) 2x
f (x) = √ √ =√ √ ≈ x,
1+x− 1−x 1+x− 1−x
for small x. We obtain
1 1
|∆f | . µ( + + 1 + 1 + |x|) ≈ 3µ.
2 2
Since f (x) ≈ x for small x the bound for the relative error is |∆f |/|f | ≤ 3|x|−1 µ.

(3p) 4: For a) we compute (1 − t + t)3 = (1 − t)3 + 3(1 − t)2 t + 3(1 − t)t2 + t3 = c1 (t) +
c2 (t) + c3 (t) + c4 (t).
For b) we recall that the tangent on a Beziér cubic curve satisfies s′ (0) = 3(P2 −P1 )
and s′ (1) = 3(P4 −P3 ). Thus the curve is horizontal at the start point if P1 and P2 has
the same y-coordinate. This does not put any requirements on the x-coordinate of
P2 . Thus we can pick points P1 = (0, 3), P2 = (0.5, 3), P3 = (1, 1.5), and P4 = (1, 1)
for the first curve segment. The curve will have a vertical tangent at the end point
since P3 and P4 has the same x-coordinate. The y-coordinate can be chosen freely.
Similarily the second curve segment is determined by the control points p4 = (1, 1),
P5 = (1, 0.5), P6 = (1.5, 0) and P7 = (2, 0). As explained above the curve is not
unique.

(3p) 5: For a) we just observe that one of the multipliers (i.e. ℓ32 = 1.8) is larger than one.
Thus pivoting wasn’t used correctly.
For b) we note that the largest row-sum is given by the last row so kLk∞ =
0.3 + 1.8 + 1 = 3.1.
In c) we note the solution with the noisy b vector can be written A(x + ∆x) =
b + ∆b and thus A(∆x) = ∆b, or k∆xk = kA−1 ∆bk ≤ kA−1 kk∆bk. We also have
kbk = kAxk ≤ kAkkxk. Thus
k∆xk kA−1 kk∆bk k∆bk
≤ = kAkkA−1 k ,
kxk kbk/kAk kbk
where κ(A) = kAkkA−1 k is the condition number.

(4p) 6: For a) we give the definition of the Newton-Raphson method as xk+1 = xk −


f (xk )/f ′(xk ), where for our case f ′ (x) = 3x2 − 18x + 24. There is no reason at all
to simplify the resulting iteration formula.
For b) we state the order of convergence as the p value such that |xk − x∗ | ≈
C|xk−1 − x∗ |p , or
|xk − x∗ |
= C.
|xk−1 − x∗ |p
The goal is to select the value p so that the quotient is approximately a constant
independently of the iteration number k. If we use p = 1 we see that k = 1 gives

7
C = 0.2/1.03 = 1.9417, k = 2 gives C = 0.1030/0.0524 = 1.9656, etc. This means
that p = 1 and we have linear convergence.
In c) we recall that Newtons method is supposed to have quadratic convergence if
the root x∗ is a single root. Also the convergence is linear for double roots. Thus
the function f (x) the root x∗ = 2 is a double root.

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

T (9h) − T (3h) (9p − 3p )Chp


≈ p = 3p
T (3h) − T (h) (3 − 1p )Chp
Insert numbers from the table we obtain
2.9122 − 3.1689
3p = = 9.0070
3.1689 − 3.1974
Which fits perfectly with p = 2. In order to determine C we use the last equation
T (2h) − T (h) = (3
p
2
− 12 )Ch2 and insert h = 0.1 to obtain C = −0.356. Finally
RT = 10−3 if h = 10−3 /0.356 = 0.053. Thus h < 0.053 is required.

(3p) 8: For a) we note that if rank(A) = n then the matrix only has the trivial null space.
Thus any solution we find is unique. Thus the solution can be written as
n
X
x= ci vi ,
i=1

In order to determine the coefficients ci we compute


n
X m
X
Ax = ci σi ui = b = (uTi b)ui .
i=1 i=1

Where (uTi b) = 0, for i = n + 1, . . . , m, since it is said that the solution exists. Thus
n
X uT b i
x= vi ,
i=1
σi

is the sought after unique solution.


For b) we use the singular value decomposition to write kAxk2 = kUΣV T xk2 =
kΣyk2 , where y = V T x. Since V is orthogonal kxk2 = kyk2. Thus the minimization
problem is equivalent to
n
X n
X
min kΣyk22 = . min σi2 yi2 ≥ σn2 yi2 = σn2 ,
kyk2 =1 kyk2 =1
i=1 i=1

since σn is the smallest singular value, with equality if y = en which means that
x = V T en = vn .

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy