Norwegian University of Science and Technology Department of Mathematical Sciences Page of 9 Contact during the exam: Elena Celledoni, tlf. 7359354, cell phone 48238584 Exam in TMA425 December 7th 22 Allowed aids code C: Textbook Endre Süli and David Mayers, An introduction to Numerical Analysis. TMA425 lecture notes pages). Rottman. Photocopies from the textbook are also allowed instead of the book itself, but they should be kept separate from the note of the course to allow control. Itemized description of the learning outcome L approximation of functions; L2 numerical quadrature; L3 odes; L4 Linear and nonlinear equations; L5 error analysis in general; L analysis of algorithms and methods; L7 implementation; L8 design of numerical experiments tested in the project work); L9 interpretation of the numerical results tested in the project work); L usage of precise mathematical language to describe solution to the problems and findings in the project. Problem Consider f C 4) [ a, a]) and let p 3 x) be the interpolation polynomial of degree 3 satisfying Show that if M 4 = p 3 a) = f a), p 3 a) = fa), p 3 a) = f a), p 3a) = f a). max f 4) x), then a x a fx) p 3 x) a4 24 M 4.
TMA425 Numerical Mathematics Page 2 of 9 Solution This is Hermite interpolation with n =, from the theorem about the error of Hermite interpolation page 9 in Süli and Mayers) we see that the exact expression for the error is fx) p 3 x) = f 4 ξ) [x a)x + a)] 2. 4! We get fx) p 3 x) M 4 24 max x [ a,a] [x2 a 2 ] 2 finding the maximum on [ a, a] of the polynomial [x 2 a 2 ] 2 we obtain the result. Tested learning outcome: L, L5, L. Problem 2 Given the distinct absissae x i, i =,,..., n +, and the values y i, i =,,..., n +, let q be the interpolation polynomial of degree n for the set of points {x i, y i ) : i =,,..., n} and let r be the interpolation polynomial of degree n for the points {x i, y i ) : i =, 2,..., n + }. Define px) = x x )rx) x x n+ )qx) x n+ x. Show that p is the interpolation polynomial of degree n + for the points {x i, y i ) : i =,,..., n + }. Solution We verify that: px ) = qx ) = y, px n+ ) = rx n+ ) = y n+ and for x i with i =,..., n px i ) = x i x )rx i ) x i x n+ )qx i ) x n+ x = x i x )y i x i x n+ )y i x n+ x = y i. So obviously p interpolates y,..., y n+ on x,..., x n+, and since the interpolation polynomial through n + 2 distinct points is unique, from the theorem of existence and uniqueness of the interpolation polynomial, p must be a polynomial of degree n +. Tested learning outcome: L, L5, L Problem 3 Write down the errors in the approximation of x 4 dx and x 5 dx by the trapezium rule and the Simpson s rule page 22 and 23 in the textbook). Use the exact values of the two integrals. Hence find the value of the constant C for which the trapezium rule gives the correct result for the calculation of x 5 Cx 4 )dx, and show that the trapezium rule gives a more accurate result than the Simpson s rule when 5 4 < C < 85 74.
TMA425 Numerical Mathematics Page 3 of 9 Solution The values of the two integrals are respectively /5 and /. If we approximate both the two integrals with the trapezium rule we get in both cases the value /2 as approximation. So for the trapezium rule we get the two errors 5 2, 2, and one proceeds similarly for the Simpson rule. We also have x 5 Cx 4 )dx = 5 C 3 and approximating with the trapezium rule the same integral we get So we get x 5 Cx 4 )dx 2 C 2. 5 C 3 = 2 C 2, when C = 9. Using Simpson to approximate the same integral we obtain x 5 Cx 4 )dx ) 9 C. 8 Let us call I the exact value of the integral, T the approximation due to the trapezium rule and S the one due to the Simpson rule, then we have, I T = + 9C 3 and the trapezium formula gives the exact value of the integral when C = 9. We also have 5 + 2C I S =, 24 and both I T and I S are linear functions of C. We have to find the values of C such that I T I S. The two functions are plotted in figure : I T as a function of C decreases for values of C 9, and increases for C > 9. I S has a similar behaviour, and is zero in C = 5 2. It suffices to find the points of intersection of the two graphs. It turns out that the graph of I T intersects I S = S I for C < 5 2, and S I coincides with the line through the two points 5/24, ) and 5/2, ) for C < 5 2. This line intersects I T in two points corresponding to the values C = 5 85 5 4 and C = 74. So I T I S for 4 C 85 74. Tested learning outcome: L2, L5, L, L. Problem 4 Apply the implicit Runge-Kutta method
TMA425 Numerical Mathematics Page 4 of 9 plot abs K C 9 C 3, abs K5 C 2$C 24, C =..2.5.4.3.2..5.5 2 2.5 C Figure : The two functions I T in red) and I S in blue) as functions of C.
TMA425 Numerical Mathematics Page 5 of 9 3 3) 4 2 3 2 3) 3 + 3) 2 3 + 2 3) 4 2 2 to the initial value problem y = ft, y), yt ) = y, with time step t. Derive the equations giving rise to the method and discuss the implementation tasks to be performed at each time-step. Solution The Runge-Kutta method has two stages Y and Y 2 and they are obtained as the solution of the equations : Y = y + t 4 f t + 3 3 ) t, Y + 2 3 2 3)f t + 3 + 3 ) ) t, Y 2 Y 2 = y + t 2 3 + 2 3)f t + 3 3 ) t, Y + 4 f t + 3 + 3 ) ) t, Y 2. To solve these equations we can use a fixed point iteration or a Newton method. With a fixed point iteration the procedure becomes: Initialization Y = y, Y 2 = y, k = Iteration while ε T OL and k ) Y old = Y k Y2 old = Y2 k Y k+ = y + t 4 f t + 3 Y k+ 2 = y + t k = k + ε = Y k Y old 2 + Y k 2 Y old 2 2 end while 3 2 3 + 2 3)f t + 3 3 t, Y k ) + 2 3 2 3)f t + 3 + t, Y k ) + 3 4 f t + 3 + 3 t, Y2 k ) ) t, Y2 k ) ). The RK-method and the corresponding equations can be also formulated by means of the unknowns K i = f t + c i t, y + t s j= ai,jkj ).
TMA425 Numerical Mathematics Page of 9 Y = Y k Y 2 = Y k 2 y = y + t 2 f t + 3 3 t, Y ) + f t + 3+ 3 t, Y 2 ) ). Tested learning outcome: L3, L4, L7, L. Problem 5 a) Consider the θ-method Solution for θ [, ], for the initial value problem y n+ = y n + h[ θ)f n + θf n+ ], y = ft, y), yt ) = y, where f n := ft n, y n ), t n = t + nh, y n yt n ) and h the time step. Write the θ-method as a Runge-Kutta method by finding the Butcher tableau of this method. θ θ or θ θ θ θ Tested learning outcome: L3. b) Determine and draw the region of A-stability for the method obtained for θ = and for θ = 2. Solution For θ = we have the backward Euler method whose region of absolute stability is S A = {z C z }. For θ = 2 we have the trapezoidal rule whose region of absolute stability is the negative half complex plane. Tested learning outcome: L3, L. c) Show that the method is A-stable if and only if θ 2.
TMA425 Numerical Mathematics Page 7 of 9 Solution We consider the scalar test equation y = λy, y) = y, where the real part of λ is non positive. The stability function of the θ-method is The method is A-stable if Rz) = + θ)z. θz Rez) Rz). We assume then that Rez) and explore for which values of θ we have that Rz) for all such z. + θ)z θz + θ)z θz, + Re θ)z) 2 + θ) 2 Imz) 2 2θRez) + θ) 2 z 2. Taking squares on both sides and simplifying we get 2θ θ 2. Tested learning outcome: L3, L, L. Problem Let a R and consider the matrix a a A = a a a a a) For which values of a is A positive definite? For which values of a is Gauss-Seidel method convergent? Solution The eigenvalues of A are λ = 2a +, λ 2 = λ 3 = a. Therefore all eigenvalues are positive if 2 < a <. Consider A = M N where M is the lower triangular part of A including the diagonal then M N has eigenvalues: and 2 a 3a a 2 ± a ) ) aa 4) and the spectral radius is ρm N) = 2 a 3a a 2 + a ) aa 4)) and it remains less than for 2 < a < these are the values for which the Gauss-Seidel method converges). Tested learning outcome: L4, L, L.
TMA425 Numerical Mathematics Page 8 of 9 b) For which values of a is the Jacobi iterative method convergent? For which values of a is the Gauss-Seidel iterative method converging faster than the Jacobi iteration? Solution Consider A = M N where M is the identity matrix, then M N has eigenvalues: 2a, a and a, so the spectral radius of this matrix is 2 a and Jacobi method converges if and only if a < 2. For a < 2 and a, the inequality 2 a 3a a 2 + a ) aa 4)) < 2 a, is always satisfied we have equality for a = ). Therefore for 2 < a < Gauss-Seidel converges while Jacobi doesn t and for a < 2 and a Gauss-Seidel converges faster than Jacobi. Tested learning outcome: L4, L, L. Problem 7 Reformulate the following equations into fix-point equations leading to convergent fix-point iterations on some interval [a, b]: x 2 x + =, e x sinx) =. Find a and b. Justify your answers. Solution The second equation has a zero in the interval, Π 2 ], and can be transformed to the fixed point equation x = x e x sinx), by dividing by sinx) and multiplying by x on both sides. The function gx) = x e x sinx) maps, Π 2 ] into itself and, by the mean value theorem since g is continuous and differentiable on, Π 2 ]), gx) gy) max g ξ) x y. ξ, Π 2 ] Computing the derivative of g we observe that it is bounded by on the interval, Π 2 ] so g is a contraction on this interval. This suffices to conclude that the fixed point iteration e xk ) x k) = x k ) sinx k ) ) converges for any starting value x, Π 2 ], by the contraction mapping theorem. The equation x 2 x + = has two complex conjugate roots. We consider x 2 = x
TMA425 Numerical Mathematics Page 9 of 9 take square roots on both sides and add x on both sides and, after dividing by 2 we obtain x = 2 x + 2 x. Such fixed-point equation for x < guarantees that x is pure imaginary and x is complex. So we can then continue analyzing the iteration in the complex plane. The iteration converges to the root 2 + i 3). Tested learning outcome: L4, L5, L, L.