Академический Документы
Профессиональный Документы
Культура Документы
Page
April 2002
This examination paper includes 5 pages and 7 questions. You are responsible for ensuring that your copy of the paper is complete. Bring any discrepancy to the attention of your invigilator. SPECIAL INSTRUCTIONS: This paper must be returned with your answers. Use of any calculator is allowed. 1. (2 marks) What is the unit of roundo in a computer number system where = 10, p = 5, emin = 48, emax = 49? 0.5 104 . (4 = p 1) 2. (3 marks) Rewrite the following row version of an upper triangular solver (backward substitution) into a column version. % Given an upper triangular matrix U and a right hand side b, % this program solves the upper triangular system U*x = b and % overwrites b with the solution x. n = length(b); for j=n:-1:2 b(j) = b(j)/U(j,j); b(j-1) = b(j-1) - U(j-1,j:n)*b(j:n); end b(1) = b(1)/U(1,1);
n = length(b); for j=n:-1:2 b(j) = b(j)/U(j,j); b(1:j-1) = b(1:j-1) - b(j)*U(1:j-1,j); end b(1) = b(1)/U(1,1); (continued on page 2)
Page
compute vector p and matrices L and U in the LU decomposition of A using Gaussian elimination with partial pivoting, where p is the permutation vector, L is an elementary lower triangular matrix, and U is an upper triangular matrix. Matrix A should be overwritten by L and U . Assume the base = 10 and the precision p = 4. Show the steps. Step 1 pivot row: 2, after updating
(continued on page 3)
Page
4. (5 marks) Consider the initial value problem y =y for t 0, with initial values y(0) = 1 and y (0) = 2. (a) Express this second-order ODE as an equivalent system of two rst-order ODEs. Let u1 (t) = y(t) and u2 (t) = y (t), then we get a system of rst order ODEs u1 (t) = u2 (t) u2 (t) = u1 (t) (b) What are the corresponding initial conditions for the system of ODEs in part a? The initial values: u1 (0) = 1 u2 (0) = 2 (c) Perform one step of Eulers method for this ODE system using a stepsize of h = 0.5. One step of Eulers method with h = 0.5 u(0.5) = 1 2 + 0.5 2 1 = 2 2.5
(continued on page 4)
Page
using a Givens rotation, but a1 is already zero. Is it still possible to annihilate a 2 with a Givens rotation? If so, specify an appropriate Givens rotation; if not explain why. Yes, the Given rotation is: G= 0 1 1 0 .
6. (3 marks) Suppose you want to nd a zero of a nonlinear function of one variable: f (x) = 0. For each convergence rate given, name a method that normally has that convergence rate for this problem: (a) Linear but not superlinear (b) Superlinear but not quadratic (c) Quadratic (a) Bisection (b) Secant (c) Newtons
(continued on page 5)
Page
7. (4 marks) On a computer with no functional unit for oating-point division, one might instead use multiplication by the reciprocal of the divisor. Apply Newtons method to produce an iterative scheme for approximating the reciprocal of a number a > 0. Considering the intended application, your solution should not contain any divisions except divisions by 2. (Hint: Apply the idea behind the Newtons method for computing square root.) (a) Develop an iterative scheme using Newtons method. (b) Find an intial x0 . (a) Construct a function f (x) such that f (1/a) = 0: f (x) = 1/x a. Then f (x) = 1/x2 . The Newtons iteration: f (x) x+ = x = x(2 ax) f (x) (b) First, a is scaled so that 1.0 a < 2.0. Linearly interpolate (a, 1/a) at points (1.0, 1.0) and (2.0, 0.5), we get the initial guess x0 = (3 a)/2
END!