THE UNIVERSITY OF NEW SOUTH WALES SCHOOL OF MATHEMATICS AND STATISTICS
MATH2089 Numerical Methods and Statistics
(1) TIME ALLOWED – 3 Hours (2) TOTAL NUMBER OF QUESTIONS – 6 (3) ANSWER ALL QUESTIONS (4) THE QUESTIONS ARE OF EQUAL VALUE (5) THIS PAPER MAY NOT BE RETAINED BY THE CANDIDATE (6) ONLY CALCULATORS WITH AN AFFIXED “UNSW APPROVED” STICKER MAY BE USED (7) STATISTICAL FORMULAE ARE ATTACHED AT END OF PAPER STATISTICAL TABLES ARE ATTACHED AT END OF PAPER
Part A – Numerical Methods consists of questions 1 – 3 Part B – Statistics consists of questions 4 – 6 Both parts must be answered
All answers must be written in ink. Except where they are expressly required pencils may only be used for drawing, sketching or graphical work.
Part A – Numerical Methods
Answer in a separate book marked Question 1
a) What are the values produced by the following Matlab expressions: i) x = -1e+200; ans1 = log(exp(x)) ii) v = [-1:1] ans2 = v./v.^(1/2) iii) x = 200; h = 1e-14; ans3 = x + h > x b) The computational complexity of some common operations with n by n matrices are Operation Matrix multiplication LU factorization Cholesky factorization Back/forward substitution Tridiagonal solve Flops 2n3 2n3 + O(n2 ) 3 n3 + O(n2 ) 3 2
n + O(n) 8n + O(1)
i) Estimate the size of the largest symmetric positive deﬁnite linear system that can be solved in one hour on a 2.5 GHz 6-core computer, where each core can do two ﬂoating point operations per clock cycle. ii) A symmetric n by n matrix is determined by the n(n+1) elements Ai,j 2 for j = 1, . . . , n, i = 1, . . . , j. Estimate the size of the largest n by n symmetric matrix that can be stored in a 6MB cache using double precision if only the elements on and above the diagonal are stored. c) The coeﬃcient matrix A is calculated “exactly” in Matlab, while the right-hand-side vector b comes from measurements taken to 6 signiﬁcant ﬁgures. The result of the Matlab command rcond is rc = rcond(A) rc = 1.0197e-04 i) What is the corresponding condition number κ(A)? ii) Estimate how many signiﬁcant ﬁgures there are in a computed solution to Ax = b? d) Explain how to eﬃciently solve the linear system Ax = b, given the results of Matlab’s lu factorization: [L, U, P] = lu(A); Please see over . . .
June 2011 2.
Answer in a separate book marked Question 2
a) Two identical chemical tanks with the same cross-sectional area α contain a liquid with height h1 (t) for tank 1 and height h2 (t) for tank 2. The ﬂow rate from tank 1 to tank 2 is Q(t) = h1 (t) − h2 (t) , R
where R is a ﬁxed constant. The liquid is withdrawn from tank 2 at a constant rate of Qe . The concentration of chemical in tank 1 is ﬁxed at the constant c1 , while the concentration in tank 2 is c2 (t). The system is governed by the system of ordinary diﬀerential equations α dh1 (t) = −Q(t), dt dh2 (t) = Q(t) − Qe , α dt Q(t) dc2 (t) = . α dt h2 (t)
Initially both tanks contain liquid with height h0 and the concentration in tank 2 is c0 . You are asked to ﬁnd the concentration of chemical in tank 2 over the ﬁrst 2 seconds. i) Write this as an initial value problem (IVP) in the standard form dx(t) = f(t, x), dt t ∈ [t0 , tf ], x(t0 ) = x0 .
Make sure you clearly deﬁne the vector of state variables x(t), the time domain, the right-hand-side function f(t, x) and the initial conditions. ii) Write EITHER a Matlab anonymous function OR a function M-ﬁle to deﬁne the function ftanks(t, x) to calculate the right-hand-side vector f(t, x). For your chosen function, how can you set values for the problem data α, R, Qe needed in your function? b) Consider the integral τ
y(τ ) = exp...