DCDM BUSINESS SCHOOL NUMEICAL METHODS (COS -8) Solutons to Assgnment Queston Consder the followng dt: 5 f() 8 7 5 () Set up dfference tble through fourth dfferences. (b) Wht s the mnmum degree tht n nterpoltng polynoml, tht fts ll s dt ponts ectly, cn hve? Epln. (c) Gve the (forwrd) Newton-Gregory polynoml tht fts the dt ponts wth vlues, nd. Then compute f(.5). (d) Compute n ppromte bound for the error n the ppromton to f(.5) n (c) usng the Newton s forwrd nterpoltng polynoml. (e) Compute f(.5) usng the Lgrnge nterpoltng polynoml through the dt ponts wth vlues t, nd. Soluton () y y y y y 7 8 9 7 8 7 5 5 9 (b) If ll the ponts hve the sme y-coordnte, the functon s constnt nd the mnmum degree of the nterpoltng polynoml wll be zero. If ths s not the cse, we drw dfference tble to see whether one of the dfferences does n become non-zero constnt. If y s constnt, the polynoml wll be of degree n. In the bove emple, we hve ponts; f we hve reched the ffth dfference wthout ny constnt dfference, then the mnmum degree of the nterpoltng polynoml wll be 5.
(c) y y y 8 9 7 8 7 The (forwrd) Newton-Gregory polynoml s gven by f ( ) = y ( h ) y ( )( ) y h! ( )( )( ) y In ths prtculr cse, we wll stop t the second dfference snce we only hve three ponts, tht s, ( ) ( )( ) y f ( ) = y y where = nd h =. h h! h!... Therefore, ( )(9) ( )( )(8) f ( ) = 8 () ()() = 8 9 8 9 5 5 = 9 Thus, f (.5) = (9) (.5) ()(.5) =.5. (d) It cn be esly seen tht the true functon f() s. Thus, the true vlue of f(.5) s.875 nd the error s.75. If we use the net-term rule (wth obvously four ponts), the error s (.5 )(.5 )(.5 )() =.75 ()()() (e) For three dt ponts, we cn only ft Lgrngn polynoml of degree. Usng the relevnt Lgrngn formul, we hve ( )( ) ( )( ) P ( ) = f f ( )( ) ( )( ) wth =, = nd =. Therefore, ( ( )( )( ) ) f (.5)(.5)(8) (.5)(.5)(7) P (.5) = ( )( ) ()( ) (.5)(.5)() ()() =.5 =.5.
Queston It s suspected tht the hgh mounts of tnnn n mture ok leves nhbt the growth of the wnter moth (Operophter bromt L., Geometrde) lrve tht etensvely dmge these trees n certn yers. The followng tble lsts the verge weght of two smples of lrve t tmes n the frst 8 dys fter brth. The frst smple ws rered on young ok leves wheres the second smple ws rered on mture leves from the sme tree. Dy Smple Averge weght (mg) Smple Averge weght (mg).7.7 7...7 8.89 7. 5. 7..5 9. 9. 8 8.7 8.89 () (b) Use nturl cubc splne to ppromte the verge weght curve for ech smple. Fnd n ppromte mmum verge weght for ech smple by determnng the mmum of the splne. Soluton () The coeffcents of the ndvdul cubc splnes re gven by S S = h S b = y y h S h S c = d = y h where ech splne g ( ) = ( ) b ( ) c ( ) d. Note tht h =, h, h, h, h nd h 8. = = = = 5 = Frst smple Dy Smple [] Averge weght (mg).7.777 7..5.7.78 7..875 7.. 9..7 8 8.7
Ths gves us the mtr equton S S S S S 5 7.98 8.9 =.5 9.5.5 from whch we fnd tht S =. 5, S =. 8, S =. 7795, S =. 7 nd S 5 =. 77. For nturl cubc splne, S = nd S =..5 = =.8 b = c =.777.5 =.8 d =. 7 g ( ) =.8.8.7.8.5.5 = =.7 b = =. 8 ()()(.5) ()(.8) c =.5 =.8 d =7. g ( ) = (.7)( ) (.8)( ) (.8)( ) 7. g ( ) =.7 5.9898.858 78.58.7795.8.8 = =.8 b = =. ()() ()()(.8) ()(.7795) c =.78 =.5 d =. 7 g ( ) = (.8)( ) (.)( ) (.5)( ).7 g ( ) =.8.57 9.5 7.55
5.7.7795.7795 = =. b = =. 898 ()() ()()(.7795) ()(.7) c =.875 =. d = 7. g ( ) = (.)( ) (.898)( ) (.)( ) g ( ) =..997. 75.7 7..77.7.7 = =.9 b = =. ()() ()()(.7) ()(.77) c =. =.7 d =. g ( ) = (.9)( 7) (.)( 7) (.7)( 7). g ( ) =.9.9 9.78 8.7.77.77 5 = =. b 5 = =. 9 ()(8) ()(8)(.77) c 5 =.7 =.58 5 d = 9. g 5 ( ) = (.)( ) (.9)( ) (.58)( ) 9. g 5 ( ) =..59.5 7. Intervl g () [, ] g ( ) =.8.8.7 [, ] g ( ) =.7 5.9898.858 78.58 [, ] g ( ) =.8.57 9.5 7.55 [, 7] g ( ) =..997. 75.7 [7, ] g ( ) =.9.9 9.78 8. 7 5 [, 8] g ( ) =..59.5 7. 5
Second smple Dy Smple [] Averge weght (mg).7.57..95 8.89.97 5.. 7.5.7 9..88 8 8.89 Ths gves us the mtr equton S S S S S 5 5.98.95 =...87 from whch we fnd tht S =. 8, S =. 885, S =. 595, S =. 5 nd S 5 =. 9..8 = =. b = c =.57.8 =.599 d =. 7 g ( ) =..599.7.885.8.8 = =. b = =. ()()(.8) ()(.885) c =.95 =. d =. g ( = ( )( ) (. ). )(. g ( ) =..55.59.8
7.595.885.885 = =. b = =. ()() ()()(.885) ()(.595) c =.97 =.5 d =8. 89 g ( ) = (.)( ) (.)( ) (.5)( ) g ( ) =..5 7.8 8.5 8.89.5.595.595 = =.9 b = =. 98 ()() ()()(.595) ()(.5) c =. =.795 d =5. g ( ) = (.9)( ) (.98)( ) (.795)( ) 5. g ( ) =.9.95 9.59 7.8.9.5.5 = =.7 b = =. 77 ()() ()()(.5) ()(.9) c =.7 =. d =. 5 g ( ) = (.7)( 7) (.77)( 7) (.)( 7).5 g ( ) =.7..8.7.9.9 5 = =. b 5 = =. ()(8) ()(8)(.9) c 5 =.88 =.79 d 5 = 9. g 5 ( ) = (.)( ) (.)( ) (.79)( ) 9. g 5 ( ) =..8.79.
8 Intervl g () [, ] g ( ) =..599.7 [, ] g ( ) =..55.59. 8 [, ] g ( ) =..5 7.8 8. 5 [, 7] g ( ) =.9.95 9.59 7. 8 [7, ] g ( ) =.7..8. 7 5 [, 8] g ( ) =..8.79. 5 Note The numbers hve been rounded (not truncted) to four decml plces. Substtuton of vlues n the respectve splnes wll yeld mnor errors. (b) The ppromte mmum verge weght s.7 mg for the frst smple nd 8.89 mg for the second smple. Queston The Newton forwrd dvded-dfference formul s used to ppromte f(.) gven the followng dt:.... f() 5... 5. Suppose tht t s dscovered tht f(.) ws understted by nd f(.) ws overstted by 5. By wht mount should the ppromton to f(.) be chnged? Soluton We strt by drwng tble of dvded dfferences: f() [] [] []. 5. 7.5 87.5.. 5 5... 5. 5.
9 The correspondng polynoml of degree obtned by usng the formul [] [] [] ( ) f ( )( ) f ( )( )( ) f ( ) = f f Therefore, f ( ) = 5. ( ) () ( )(.)(7.5) ( )(.)(.)(87.5) [] f ( ) = 87.5 75 7.5 5 The vlue of f(.) s clculted s.55. Wth the understtement nd oversttement of f(.) nd f(.) respectvely, we hve the followng dvded dfference tble: f() [] [] []. 5..5 5.7.. 95.5.... Therefore, workng ectly, 5 f ( ) = 5. ( ) () ( )(.)(.5) ( )(.)(.) 5 f ( ) = 87.5 75 5 The correspondng vlue of f(.) s clculted s.5, whch mens tht t would chnge by 5.975. Queston Consder the followng tble:...5.7 5. 5.5 5.9..8 7. f().5.8..5 7.5 95..87 5.7 99.5.7 () (b) (c) (d) Construct the lest squres ppromton polynoml of degree three nd compute the error. Construct the lest squres ppromton of the form be nd compute the error. Construct the lest squres ppromton of the form b nd compute the error. Drw grph of the dt ponts nd the ppromtons n (), (b) nd (c).
Soluton () Let the lest-squres cubc nterpoltng polynoml be y =. Usng the lest-squres crteron, we hve the mtr equton = y y y y n 5 5, whch, when smplfed, gves = 77.98 8.8.8 958.9 5.75 7.9775 5.7 759.8 7.9775 5.7 759.8.9 5.7 759.8.9 5. 759.8.9 5. The ugmented mtr for the system s 77.98 5.75 7.9775 5.7 759.8 8.8 7.9775 5.7 759.8.9.8 5.7 759.8.9 5. 958.9 759.8.9 5. Proceedng by Gussn elmnton, we obtn 77.98 5.75 7.9775 5.7 759.8 8.8 7.9775 5.7 759.8.9.8 5.7 759.8.9 5. 95.89 75.98.9 5. 77.98 5.75 7.9775 5.7 759.8 8.8 7.9775 5.7 759.8.9 77.95.5 8.9.79 95.89 75.98.9 5. 5. 77.98 5.75 7.9775 5.7 759.8 859.89.8 8.575 8.9 77.95.5 8.9.79 95.89 75.98.9 5..9 78.555 959.8.8.5 859.89.8 8.575 8.9 77.95.5 8.9.79 95.89 75.98.9 5. 759.8
.79 5. 8.9.5.9. 8.575.8 75.98 9.8.8 959.8 95.89 7.85 859.89 78.555 8.9 5..5.9. 7.59.8 75.98 9.8.89 959.8 95.89 7.85 9.75 78.555.5 5..9. 7.59.95 75.98 9.8.89 8.9 95.89 7.85 9.75 8.59 7.59 5..9..95 75.98 9.8.9 8.9 95.89 7.85.5 8.59.95 5..9. 75.98 9.8.9 5.75 95.89 7.85.5.99 5.75 5..9. 75.98 9.8.9 95.89 7.85.5.7 Bck substtuton gves =.587, =. 9, =. nd =. 7so tht the lest squres ppromton polynoml of degree s gven by y =.7..9.587
...5.7 5. 5.5 5.9..8 7. y.5.8..5 7.5 95..87 5.7 99.5.7 ŷ.9.7 9.7. 7. 9.7. 5.5 99.. Stndrd error = ( y yˆ ) n.97 = =. 55. 8 (b) Gven tht the equton s y = be, tkng nturl logrthm on both sdes, we hve ln y = ln b ewrtng the bove equton s Y = B, where Y = ln y nd B = ln b, we cn use lner regresson nd hence the formule by the method of lest squres. n ( ) n Y Y = nd B = Y...5.7 5. 5.5 5.9..8 7. y.5.8..5 7.5 95..87 5.7 99.5.7 Y = ln y..79.88.95 5. 5.77 5.55 5.58 5.7 5.789 The dt cn be summrsed s n =, = 5., Y = 5., =. 9, Y = 85. 89 ()(85.89) (5.)(5.) 5. (.7)(5.) Therefore, = =. 7 nd B = =. 888 ()(.9) (5.).888 so tht b = e =. 59. The lest squres ppromton s gven by y =.59 e.7...5.7 5. 5.5 5.9..8 7. y.5.8..5 7.5 95..87 5.7 99.5.7 ŷ 7. 5.9 9. 9..7 88. 8. 5.9 5.5. Stndrd error = ( y yˆ ) n 8.9 = = 7.. 8
(c) Gven tht the equton s y = b, tkng nturl logrthm on both sdes, we hve ln y = ln b ln ewrtng the bove equton s Y = B X, where Y = ln y, X = ln nd B = ln b, we cn use lner regresson nd hence the formule X ( X ) n XY Y = nd B = Y X n X by the method of lest squres....5.7 5. 5.5 5.9..8 7. y.5.8..5 7.5 95..87 5.7 99.5.7 X = ln.8.5.5.57.9.77.775.85.99.9 Y = ln y..79.88.95 5. 5.77 5.55 5.58 5.7 5.789 The dt cn be summrsed s n =, X =. 995, Y = 5., X = 5. 5, XY = 87. ()(87.) (.995)(5.) 5. (.9)(.995) Therefore, = =. 9 nd B = =. 87 ()(5.5) (.995).87 so tht b = e =. 8. The lest squres ppromton s gven by y =.8.9...5.7 5. 5.5 5.9..8 7. y.5.8..5 7.5 95..87 5.7 99.5.7 ŷ.5.8..5 7.5 95..8 5.9 99.5.79 Stndrd error = ( y yˆ ) n.79 = =.. 8 (d) On grph pper. Note Curve Epert. gve the followng nswers: () y =.7.85.79. 9 (r =.) (b).555 y =.758 e (r =.9975) (c).9 y =. (r =.99999995)