Title | Numerical Methods Exam 2014 |
---|---|
Course | Numerical Methods II |
Institution | The University of Adelaide |
Pages | 7 |
File Size | 157.4 KB |
File Type | |
Total Downloads | 93 |
Total Views | 155 |
2014 examination for Numerical Methods. Good luck...
Examination in School of Mathematical Sciences Semester 2, 2014
104838 MATHS 2104 Numerical Methods II
Official Reading Time: Writing Time: Total Duration:
10 mins 120 mins 130 mins
NUMBER OF QUESTIONS: 5
TOTAL MARKS: 58
Instructions • Attempt all questions. • Begin each answer on a new page. • Examination materials must not be removed from the examination room. Materials • 1 Blue book is provided. • A calculator is required. Only calculators without remote communications or CAS capability are allowed. The memory must be cleared before entering the examination room. • A formula sheet is attached.
DO NOT COMMENCE WRITING UNTIL INSTRUCTED TO DO SO.
Page 1 of 7
Numerical Methods II
Page 2 of 7
1. Consider the equispaced data (0, f0 ), (h, f1 ), (2h, f2 ), where fj = f (jh) for j = 0, 1, 2. (a) Write down the Lagrange form of the quadratic interpolating polynomial that passes through these points. [2 marks] (b) Use the interpolant found in part (a) to obtain an estimate of f0′ = f ′ (0).
[2 marks]
(c) Use Taylor’s theorem (not the polynomial interpolation error theorem) to find the order of the error for the estimate in part (b). Hint: You will need to include terms up to O(h3 ) in Taylor’s theorem. [4 marks] (d) The formula is tested by differentiating exp x and the error is plotted in Figure 1. Are the test results consistent with the error derived in (c)? Explain your answer. [2 marks] [TOTAL 10 marks] −2 −3 −4
log
10
|error|
−5 −6 −7 −8 −9 −10 −11 −12 −8
−7
−6
−5
log
10
−4 h
−3
−2
−1
Figure 1: Numerical differentiation error obtained when differentiating exp x using the finitedifference formula obtained in (b).
Please turn over for page 3
Numerical Methods II
Page 3 of 7
2. (a) Use the trapezoidal method to estimate the integral Z
4
f (x) dx 0
given the discrete data listed in Table 1 below. Show your working. Use all the data points. [2 marks] 0 1 3 4 1 3 5 −1
xj fj
Table 1: Discrete data, fj = f (xj ). (b) Write a fully-vectorised function that uses the trapezoidal method to estimate the integral Z xn f (x) dx (1) x1
using discretely sampled data fj = f (xj ), j = 1, 2, . . . , n. The function must have the interface function s = itrap(f, x) The input arguments x and f are vectors containing the data xj and fj , respectively. Note that the xj need not be evenly spaced. You may assume that the xj are arranged in ascending order. Do not document your function. [4 marks] (c) Use the polynomial interpolation error theorem to show that the error ej in the trapezoidal method estimate of Z xj+1 f (x) dx xj
is bounded by
1 Mh3j , j = 1, . . . , n − 1, 12 where f ′′ (x) ≤ M for x1 ≤ x ≤ xn and hj = xj+1 − xj . |ej | ≤
[6 marks]
(d) Hence show that the error e in the trapezoidal estimate of (1) is bounded by |e| ≤
1 M(xn − x1 )h2 12
where h = max hj .
[4 marks]
j
[TOTAL 16 marks]
Please turn over for page 4
Numerical Methods II
Page 4 of 7
3. (a) Consider the linear system 2 A = 6 0
Ax = b, where 0 1 x1 1 5 , x = x2 2 7 x3
5 and b = 15 . −3
The matrix A has the lu factorisation 1 0 0 2 0 1 3 1 0 0 1 2 0 2 1 0 0 3 Use the lu factorisation of A given above to solve Ax = b for x. Show your working. [5 marks] (b) Consider the linear system x 4 2 −1 5 −1 3 y = −4 . 1 z 1 −2 5 7
Perform one Jacobi iteration of the resulting system, starting from the initial guess [1, 2, 3]T . Show your working. [2 marks] (c) Consider the boundary-value problem d2 u − u = x2 , dx2
u(0) = 0,
u(1) = 1.
(2)
For constant grid spacing h, the second derivative can be approximated by u′′j = u′′ (xj ) =
uj +1 − 2uj + uj −1 + O(h2 ), h2
(3)
where uj = u(xj ), xj = jh and j is an integer. (i) Let u = [u0 , u1 , u2 , u3 ]T . Use (3) to write down a linear system of the form Du = f that approximates the differential equation and boundary conditions given by (2). Make sure you clearly define the elements of the matrix D and the vector f . [3 marks] (ii) Will Jacobi iteration converge to the solution of this system of equations? Explain your answer. [2 marks] [TOTAL 12 marks]
Please turn over for page 5
Numerical Methods II
Page 5 of 7
4. (a) Consider the nonlinear equation x = e−x .
(4)
(i) Write down the formula for the Newton iteration to solve (4) in the form xk+1 = xk + · · · [3 marks] (ii) Using an initial guess x0 = 0.5, find a solution of (4) to two decimal places. Show your working. [2 marks] (b) Consider the nonlinear system x2 + y 2 = 1 x + xy + y = 1
(5)
Write a short Matlab script that uses multidimensional Newton iteration to find any of the solutions of (5). Do not document your script. [5 marks] [TOTAL 10 marks]
Please turn over for page 6
Numerical Methods II
Page 6 of 7
5. Consider the initial value problem, dy = f (t, y), dt
y(t0 ) = y0 .
(6)
The modified Euler method is yk+1/2 = yk + 21 hf(tk , yk ), yk+1 = yk + hf(tk + 21 h, yk+1/2 ),
(7)
where yk = y(tk ) and h is the step size. (a) Suppose that f (t, y) = cos t − y 2 and y(1) = 0. Find an approximate value of y(1.5) using a single step of the modified Euler method (7). Show your working. [4 marks] (b) Use Taylor’s theorem to show that the error in a single step of the modified Euler method is O(h3 ) as h → 0. [6 marks] [TOTAL 10 marks]
Please turn over for page 7
Numerical Methods II
Page 7 of 7
Useful Formulae The Lagrange form of the interpolation polynomial is pn (x) =
n X
fk Lk (x),
n Y x − xi , Lk (x) = xk − xi i=0 i6=k
k=0
where n is the degree of the polynomial. If f (x) has n + 1 continuous derivatives on the smallest interval I that contains {x, x0 , . . . , xn }, then the error of the polynomial interpolant is n f n+1 (t) Y ǫn (x) = f (x) − pn (x) = (x − xk ) (n + 1)! k=0
where the unknown t ∈ I depends on x.
Final page...