MATH 28A, SUMME 2009, FINAL EXAM SOLUTION BENJAMIN JOHNSON () (8 poins) [Lagrange Inerpolaion] (a) (4 poins) Le f be a funcion defined a some real numbers x 0,..., x n. Give a defining equaion for he Lagrange Inerpolaing Polynomial for f over x 0,..., x n. Soluion: P n (x) = n k=0 f(x k) n i=0,i k ( x x i x k x i ). (b) (4 poins) Le f(x) = 2e x and le x 0 =, x = 4, and x 2 = 7. Wrie an expression for he Lagrange inerpolaing polynomial for f over x 0, x, x 2. Soluion: P 2 (x) = 2e (x 4)(x 7) + ( 4)( 7) 2e4 (x )(x 7) + (4 )(4 7) 2e7 (x )(x 4). You can also simplify (7 )(7 4) 2e o ge: 8 (x2 x + 28) 2e4 9 (x2 8x + 7) + 2e7 8 (x2 x + 4) = x 2 ( e 2e4 + e7 ) + 9 9 9 x( e + 6e4 e7 ) + 28e 4e4 + 4e7, bu his is no required o ge full credi. 9 9 9 9 9 9 (2) (8 poins) [Improper Inegrals] (a) (4 poins) Conver he inegral cos x dx ino a form o which numerical inegraion x echniques can be applied. [Hin: Afer you deal wih he, consider he limi of he expression you ge before doing furher compuaions.] soluion: Use he variable subsiuion: =. Then d = dx, so cos x dx = x x 2 x 0 cos d = cos d. The fracion wih in he denominaor keeps his inegral 0 from being proper, bu since cos is bounded beween 0 and for all 0, we { have lim 0 cos cos = 0. We can hus define f() = if 0 ; we will have 0 if = 0 cos x dx = f()d, and numerical inegraion echniques can be applied o he x 0 laer. (b) (4 poins) Use Simpson s rule o approximae he value of his inegral, afer applying he conversion in par (a). [You may receive parial credi for correcly saing Simpson s rule.] soluion: Simpson s rule says: b b a f(x) dx (f(a) + 4f ( a+b a 6 2 we have 0 f() d 6 (f(0) + 4f( 2 ) + f()) = cos 2 + cos 6. ) + f(b)). In his case, () (8 poins) [Gaussian Quadraure] (a) (4 poins) Explain where he consans c i and r i come from in he Gaussian Quadraure approximaion formula n i= c if(r i ). soluion: The r i are he roos of he n h Legendre polynomial, and c i = n k=,k i where x,..., x n are equally spaced poins in [, ] (b) (4 poins) Use Gaussian Quadraure wih n = 2 o approximae he inegral 4 0 x dx. Hin: see he able. x x k x i x k dx Dae: Augus, 2009.
2 BENJAMIN JOHNSON oos r 2,j Coefficiens c 2,j soluion: To apply Gaussian quadraure, we firs need o change he bounds of inegraion o [, ]. We can do his wih he formula b b a f(x) dx = a 2 f((b a)+b+a ) d 2 or by using he variable subsiuion = x. Eiher way we ge ha 4 2 0 x dx = 2 (2 + 2) d. The esimae is hen 2 2 j= c 2,jf(r 2,j ) = 2(( 2 + 2) + ( 2 + 2) ). Using (a + b) + ( a + b) = a + a 2 b + ab 2 + b + ( a) + ( a) 2 b ( a)b 2 + b = 6a 2 b + 2b, we ge 2(( 2 + 2) + ( 2 + 2) ) = 2(6( 2 )2 2 + 2 2 ) = 2(6 + 6) = 64. (4) (0 poins) [Big Oh s] Fill in he blank wih an answer of he form O(h k ) or O(n k ) for he correc consan k. (a) O(h ) The local runcaion error for he Taylor mehod of order (b) O(h 4 ) The local runcaion error for a unge Kua mehod of order 4 (c) O(h 2 ) The local runcaion error for an Adams Bashforh explici 2 sep mulisep mehod (d) O(h 8 ) The local runcaion error for an Adams Moulon implici 7 sep mulisep mehod (e) O(h ) The local runcaion error for Euler s Mehod (f) O(h 2 ) The local runcaion error for he Midpoin Mehod (g) O(h 2 ) The local runcaion error for he Implici Trapezoid Mehod (h) O(h 2 ) The local runcaion error for Huen s Mehod (i) O(n ) The number of arihmeic operaions required o perform Gaussian Eliminaion on an n n marix. (j) O(n 2 ) The number of arihmeic operaions required o perform backwards subsiuion using an upper-riangular n n marix () (2 poins) [IVP s and Soluion Mehods] (a) (4 poins) Wha is an iniial value problem for firs order differenial equaions? Soluion: I is a problem of he form: Find y() given ha y () = f(, y) for a b, and ha y(a) = α. We are ypically given he parameers f, a, b, and α. (b) (4 poins) Wha is he common goal of Euler s Mehod, he Taylor mehods, and he unge Kua mehods? Explain how his differs from he goal of he adapive mehods like unge-kua-fehlberg and he variable sep size mulisep mehods. Soluion: The firs se of mehods seeks o approximae he soluion funcion y() of an iniial value problem a n + equally spaced nodes 0,... n in he relevan inerval [a, b]. By conras, he goal of he adapive mehods is o approximae y() for a single value of, using as few funcion evaluaions as possible.
MATH 28A, SUMME 2009, FINAL EXAM SOLUTION (c) (4 poins) Give wo examples of unge-kua mehods for solving iniial value problems. [Naming he mehods is no sufficien. You also need o define hem.] soluion: Any wo of he following mehods would suffice: The Midpoin Mehod: w 0 = α, w i+ = w i + hf( i + h 2, w i + h 2 f( i, w i )) The Modified Euler Mehod: w 0 = α, w i+ = w i + h 2 [f( i, w i ) + f( i+, w i + hf( i, w i ))] Huen s Mehod: w 0 = α, w i+ = w i + h 4 [f( i, w i ) + f( i + 2 h, w i + 2 hf( i, w i ))] There are also oher more complicaed examples. (6) (6 poins) [Sabiliy] Consider he following mulisep mehod for approximaing he soluion o an iniial value problem: w 0 = α, w = α, w 2 = α 2, w i+ = 2w i w i + h 4 [w i 2 + w i ]. (a) ( poins) Wha is he characerisic polynomial of his mehod? soluion: P (λ) = λ 2λ 2 + λ (b) ( poins) Is i a sable mehod? Jusify your answer. soluion: No, i is no sable. For a mehod o be sable, all of is roos mus have absolue value a mos one, and all roos wih absolue value mus be simple roos. This polynomial has as a roo wih mulipliciy 2, violaing he second of hese condiions. (7) (6 poins) [Linear Sysems] Use Gaussian Eliminaion wih backwards subsiuion o solve he linear sysem: x + 0x 2 + 9x = 4 0x + 26x 2 + 26x = 0 x + 4x 2 + 66x = 27 soluion: For he Gaussian Eliminaion par: 0 9 4 0 6 8 2 0 9 42 Then for backwards subsiuion: 7x = 7 x = ; 6x 2 + 8x = 2 6x 2 + 8 = 2 x 2 = ; and x + 0x 2 + 9x = 4 x 0 + 9 = 4 x =. 0 9 4 0 26 26 0 4 66 27 0 9 4 0 6 8 2. 0 0 7 7 2 2 2 (8) ( poins) [Inverses and Deerminans] Le A = 2 2. 2 (a) (4 poins) Compue he inverse of A, if i exiss. Oherwise, explain why i does no exis. soluion: We use Gaussian Eliminaion wih backwards subsiuion: 2 0 0 2 0 0 2 0 0 0 7 2 0 2 0 0 0 7 2 0 2 0 0 0 7 0 0 0 7 7 7 For backwards subsiuion, we ge
4 BENJAMIN JOHNSON b = /7 =, b /7 2 = /7 =, and b /7 = = 7. Then /7 b 2 = 2 ( )b 2+ = = 7/ =, b 7 7 7 22 = ( )b 2 2 + = = 49/ = 7, and 7 7 7 b 2 = 0 ( )b 0 = =. Finally, 7 7 b = 2b 2 b = + 2 = 7, b 2 = 0 2b 22 b 2 = 0 + 4 =, and b = 0 2b 2 b = 0 0 + 2 =. So A = mehods. 7 7 7. You can also ge he same correc answer by oher (b) (4 poins) Compue he deerminan of A. [ soluion: I will expand across he firs row of A. The de(a) = de 2 [ ] [ ] 2 2 2 de + de = 7 2 + = 2 (c) ( poins) Is A posiive definie? Explain how you deermined your answer. ] soluion: No, [ A is no ] posiive definie. One way o see his is ha he leading principle 2 sub-marix has a negaive deerminan. 2 (9) (2 poins) [LU Facorizaion] (a) (4 poins) Wha does i mean for a marix A o have an LU facorizaion? soluion: I means ha A can be wrien as LU where L is a lower riangular marix wih s along he diagonal and U is an upper riangular marix. (b) (4 poins) Explain how an LU facorizaion can help o more efficienly solve a linear sysem of he form Ax = b. soluion: If we have A = LU, hen we can solve Ax = b by firs solving Ly = b (for y) and hen solving Ux = y (for x). This is more efficien for large n n marices because solving he riangular marix equaions using forward or backward subsiuion requires only O(n 2 ) operaions, compared o O(n ) for Gaussian Eliminaion or mos oher direc mehods. (c) (4 poins) Compue he LU facorizaion for he marix A = 0 9 0 26 26 4 66 soluion: In problem 7, we carried ou Gaussian Eliminaion for his marix. The marix U is he las marix of ha procedure, and we ge L from he row operaions. U = 0 9 0 6 8 ; and L = 0 0 2 0 0 0 7 4 (0) (0 poins) [Vecor Norms] (a) (4 poins) Lis all he condiions for a funcion o be considered a vecor norm for n. soluion: : n saisfying (i) x 0 for every x n (ii) x = 0 iff x = 0 (he zero vecor)
MATH 28A, SUMME 2009, FINAL EXAM SOLUTION (iii) αx = α x for every α and x n (iv) x + y x + y for every x, y n (b) ( poins) Give a leas hree examples of vecor norms for n. For each example, you mus define he norm funcion. soluion: For example, (i) x = n j= x j n (ii) x 2 = j= x2 j (iii) x = max n j= x j (c) ( poins) For each of your hree examples in par (b),compue soluion: (i) x = 2 + + 4 + = 4 (ii) x 2 = 2 2 + 2 + 4 2 + 2 = 4 + 9 + 6 + 2 = 4 = 6 (iii) x = max{2,, 4, } = () (9 poins) [Marix Norms] (a) ( poins) Lis all he condiions for a funcion o be considered a marix norm for. [The symbol M n n refers o he se of all n n marices wih real enries.] M n n soluion: : M n n saisfying (i) A 0 for every A M n n (ii) A = 0 iff A = 0 (he zero marix) (iii) αa = α A for every α and A M n n 2 4. (iv) A + B A + B for every A, B M n n (v) AB A B for every A, B M n n (b) ( poins) Explain how o ge a naural marix norm from a vecor norm. soluion: Given a vecor norm, he associaed naural marix norm is defined o be A = max x: x = Ax. An alernaive and equivalen definiion is ha (c) ( poins) Compue A = max x 0 2 4 6 2 4 7 4 2 Ax x. soluion: Since [a ij ] = max n i= n j= a ij, he answer is 4 + + + 7 = 7. BONUS ( poins) In wha governmenal deparmen did Erwin Fehlberg work? and during wha decade? Answer in a complee senence wih proper grammar, spelling, and puncuaion. Soluion: Fehlberg worked for NASA in he 960 s.