UNIVERSITY OF EAST ANGLIA School of Mathematics Main Series UG Examination 216 17 INTRODUCTION TO NUMERICAL ANALYSIS MTHE612B Time allowed: 3 Hours Attempt QUESTIONS 1 and 2, and THREE other questions. Notes are not permitted in this examination. Do not turn over until you are told to do so by the Invigilator. MTHE612B Module Contact: Dr. Jennifer Ryan, MTH Copyright of the University of East Anglia Version: 2
- 2-1. The Lagrange interpolating polynomial of degree two is given by p 2 (x) = f(x )L,2 (x) + f(x 1 )L 1,2 (x) + f(x 2 )L 2,2 (x) where L k,2 (x) = 2 j=, j k x x j x k x j. (i) Given the data points x =, x 1 =.6, x 2 =.9, determine the Lagrange interpolating polynomial of degree two for the functions f(x) = cos(x) and f(x) = 1 + x. (ii) Use the interpolants in 1(i) to approximate the actual value of the functions at x =.45, determine actual error at that point and give a bound on the error in the interval (,.9). (iii) Assume the error bound is given by e h3 3! max ξ (,.9) f (3) (ξ). Determine what the spacing between the data should be to obtain an error of e 1 4 of the two functions. for each [1 marks MTHE612B Version: 2
- 3-2. Consider the two point Gauss Quadrature rule 1 1 f(x) dx = w 1 f(x 1 ) + w 2 f(x 2 ) such that the nodes x 1, x 2 and weights w 1, w 2 are given by w 1 (x 1 ) m + w 2 (x 2 ) m = 1 m + 1 [1 ( 1)m+1, m =,..., 3. (1) (i) Use Equation (1) and the fact that w 1 = w 2 and x 1 = x 2 to determine the nodes and weights in the Gauss Quadrature formula. [8 marks (ii) Notice the above formula is for integrating a function over ( 1, 1). Transform this formula to apply to integrating a function over the general interval (a, b). That is, determine the formula that applies to b a f(x) dx. (iii) Consider the integral 1 x m dx. (a) For which values of m is the two-point Gauss Quadrature rule is exact? (b) Evaluate the exact integral. For the values of m = 3, 4, approximate the integral using the Gauss quadrature rule and determine the error. [7 marks MTHE612B PLEASE TURN OVER Version: 2
- 4-3. We seek a difference formula for the first derivative of a function f(x) at x = of the form such that Q(h) = 1 h ( ( α f h ) ) + α 1 f() + α 2 f(h) 2 f () Q(h) = O(h 2 ). (2) (i) Give the first four terms for the Taylor expansions of f( h ), f(), f(h) around 2 zero. (ii) Use the results from (i) and Equation (2) to show that the coefficients α, α 1 and α 2 satisfy the system 1 1 1 1/2 1 1/8 1/2 α α 1 α 2 = 1 and that the solution is therefore α = 4 3, α 1 = 1, α 2 = 1 3. [6 marks (iii) Use the information in Table 1 along with Richardson s method which assumes that the form of the error is f () Q(h) = Kh 2 to give an estimate of the error f () Q(1/5) and determine the constant, K. [9 marks x -.4 -.3 -.2 -.1.1.2.3.4 f(x) -.9511 -.89 -.5878 -.39.32.5878.89.9511 Table 1: The values of a function, f(x), for a given x. MTHE612B Version: 2
- 5-4. Suppose that we are given the nonlinear equation f(x) =. (i) Let p be a fixed point of a function f(x) such that f has a continuous derivative. Consider the fixed point iteration p k+1 = g(p k ) = p k f(p k) α, α R. Show that this always converges to a fixed point of f(x) if < f (p) < α and p sufficiently close to p by first stating the Convergence theorem. [15 marks (ii) Consider the Newton-Raphson method p n+1 = p n f(p n) f (p n ). (a) Determine p 1 using the Newton-Raphson method for f(x) = x 2 2x 2 with p = 1. (b) Can p = 1 be used as the beginning value? Why or why not? MTHE612B PLEASE TURN OVER Version: 2
- 6-5. For the numerical integration of the first order differential equation y = f(t, y), y() = y, we use the modified Euler method w n+1 =w n + hf(t n, w n ), w n+1 =w n + h 2 (f(t n, w n ) + f(t n+1, w n+1)), (3) where h denotes the timestep and w n represents the numerical solution at time t n. (i) By using the general form of the equation, y = f(t, y), show that the local truncation error is of order O(h 2 ). [1 marks (ii) Consider the initial value problem d dt [ x1 x 2 [ x1 x 2 [ 1 = 3 4 = [ 1 2. [ x1 x 2 [ + cos(t), Calculate one step with the modified Euler method, in which h = 1 1 and t = using the given initial conditions. (iii) Determine the amplification factor. MTHE612B Version: 2
- 7-6. For the numerical solution of the differential equation y = f(t, y) with y() = y, we use the fourth order Runge-Kutta method (RK4): k 1 = hf(t n, w n ), k 3 = hf(t n +.5h, w n +.5k 2 ), k 2 = hf(t n +.5h, w n +.5k 1 ), k 4 = hf(t n + h, w n + k 3 ), w n+1 = w n + 1 6 (k 1 + 2(k 2 + k 3 ) + k 4 ). and consider the equation [ [ d x1 = dt x 2 1 251 1 [ x1 x 2 [ + cos(t). (4) Figure 1: The stability region for RK4. (i) Find the eigenvalues of the matrix in Equation (4). (ii) Use the illustration in Figure 1 to give an approximate stability condition. (iii) Derive the amplification factor for RK4. (iv) Use the fact that y(t n+1 ) = e hλ y(t n ) holds for the exact solution of y = λy to show that the RK4 method solves the homogeneous test equation with a local truncation error of O(h 4 ). MTHE612B PLEASE TURN OVER Version: 2
- 8 - END OF PAPER MTHE612B Version: 2
MTHE612B/MTHE712B Exam Feedback Overall students did well on the exams, especially students that performed all coursework and laboratory exercises during the semester. Q1: This question was overall done well. The difficulties were: MTHE712B: The definition of conservative scheme and why a finite volume approximation is needed appeared to be lacking. MTHE612B: Overall students did well on this problem, but some had difficulty obtaining an error bound. Q2: The majority of the students did well. The only difficulty seemed to be in evaluating the integral and determining for which values of m the quadrature rule is exact. Q3: The majority of the students did well. However, some had difficulty in deriving the equations that determine the coefficients. Q4: Those that chose to do this problem did well. Q5: The difficulties encountered on this question were: (i) not performing the correct expansion for the modified Euler method; and (ii) neglecting to apply the method to the system of equations. Q5: The main difficulty of this question was not identifying the stability region of the 4th order Runge-Kutta method to be 2.8 λ. 1