ME - 310 NUMERICAL METHODS Fall 2007 Group 02 Istructor: Prof. Dr. Eres Söylemez (Rm C205, email:eres@metu.edu.tr ) Class Hours ad Room: Moday 13:40-15:30 Rm: B101 Wedesday 12:40-13:30 Rm: B103 Course TextBook: "Numerical Methods for Egieers" by S.C. Chapra ad R.P. Caale, 4th ed., McGraw Hill. Web Page: http://www.me.metu.edu.tr/me310 Preriquisite: Calculus, Liear Algebra, Differetiatio ad itegratio, Differetial Equatios, Taylor ad biomial expasio. Computer literacy ad a programmig laguage such as C, Pascal, VBA, Delphi, Fortra, etc.
Gradig Homework ad Lab assigmets ad attedace (25%) 2 Midterms (2d midterm usig computer) (22% ad 23%) 1 Fial (30%) Cheatig!!!! Will be very severely puished. Please read Academic Code of Ethics http://www.me.metu.edu.tr/me310
Study regularly Do your homeworks o your ow. If you have ay questios, please ask (to your frieds, to the assistats ad to me) Attedace is compulsory. No excuse. %2-2
AIM of ME Educatio Solve mechaical egieerig problems Simplify ad obtai aalytical solutios Graphical solutios Solutios usig calculator Solutios usig computer at all levels Solve complex (oliear, or multi parameter) problems usig computer.
AIM of ME310 Algorithmic Thikig Solutio of complex egieerig problems usig umerical techiques. Programmig o a computer Use ew mathematical tools Lear methods of Numerical Aalysis Aalyze errors due to digital computatio
Why lear Numerical Methods? Powerful problem solvig Large systems of equatios Solutio of oliear equatios Complex geometry Repetitative solutios by chagig parameters (What if? Questio) Efficiet way of learig computer logic ad programmig Lear how math is utilized i egieerig Itroductio to the logic of package programs Solvig problems that caot be solved by the available package programs
Mai Topics i ME310 Roots of Equatios System of equatios (liear ad oliear) Itroductio to Optimizatio Curve fittig Differetiatio Itegratio Solutio of Ordiary Differetial equatios (Iitial value problems) Readig assigmets are give for each week. Please look at http://www.me.metu.edu.tr/me310
2+2 =? Scietist Egieer Social Scietist =4 =4±ε = 2,4,8... Approximatios ad Errors Math vs Egieerig sigificat digits. π=? =3.1415 (5 digit) =3.1415926 (8 digit) =3.14159265358979 (15 digit)
Accuracy ad Precissio Accuracy is the differece betwee the computed (or measured) value ad the true value. Precissio is the spread betwee the repeated calculatios or measuremets Ex: Target Problem
P r e c i s s i o Accuracy
Errors i Numerical Computatio Trucatio errors. i.e. 3 5 7 9 2+ 1 x x x x x si( x) = x + +... =+ ( 1) 3! 5! 7! 9! (2 + 1)! = 1 We ca use m terms. There will be some error Roud-off errors i.e. π =3.1415
True Value = Approximatio + error True Value= Approximate Value + Ε true Or: E t = True Value- Approximatio Fractioal Relative Error= E TrueValue true % ε t = 100 Approximate Relative Error = Pr esetapprox. Pr eviousapprox. % ε a = *100 Pr esetapprox
Example x= π/4 = 0.785398163397448 (45 0 ) si(π/4)=0.707106781186547 3 5 7 9 2+ 1 x x x x x si( x) = x + +... =+ ( 1) 3! 5! 7! 9! (2 + 1)! = 1 #Terms f(x) %ε t %ε a 1 0.785398163397448 11.072073453959200-2 0.704652651209168 0.347066389783707 11.458909868532200 3 0.707143045779360 0.005128587898981 0.352176915979992 4 0.707106469575178 0.000044068502476 0.005172658680970 5 0.707106782936867 0.000000247532581 0.000044316034947 6 0.707106781179619 0.000000000979769 0.000000248512350 7 0.707106781186568 0.000000000002889 0.000000000982658 8 0.707106781186547 0.000000000000000 0.000000000002889 9 0.707106781186547 0.000000000000000 0.000000000000000 10 0.707106781186547 0.000000000000000 0.000000000000000
Example x= 1.553343034274950 (89 0 ) si(x)=0.999847695156391 Terms f(x) %ε t %ε a 1 1.553343034274950 55.357965198088200-2 0.928672713486365 7.118582361575920 67.264851407498600 3 1.004035270448470 0.418821317723176 7.505967089028960 4 0.999705737159465 0.014197962111061 0.433080768477656 5 0.999850829115375 0.000313443637339 0.014511360263465 6 0.999847646490898 0.000004867290675 0.000318310943507 7 0.999847695717011 0.000000056070528 0.000004923361201 8 0.999847695151409 0.000000000498300 0.000000056568828 9 0.999847695156426 0.000000000003520 0.000000000501820 10 0.999847695156391 0.000000000000022 0.000000000003542 Ca we estimate the trucatio error?
Review of Calculus: Taylor s Theorem If the fuctio f(x) ad its +1 derivatives are cotiuous o a iterval cotaiig a ad x, the the value of the fuxtio at x is give by: f ( a) 2 f( x) = f( a) + f ( a)( x a) + ( x a) 2! f ( a) 3 f ( a) + ( x a) +... + ( x a) + R 3!! Where the remaider R is defied as x ( x t) + 1 R = f () t dt! a Itegral form Hece, every cotiuous fuctio ca be approximated by a polyomial of order
First Theorem of the mea If the fuctio g is cotiuous ad itegrable i the iterval cotaiig a ad x, the there exists a poit ξ betwee a ad x such that x a gtdt () = g( ξ )( x a) g(ξ) g(t) = g(ξ)(x-a) a ξ x t a x t
Secod Theorem of the mea If the fuctios g ad h are cotiuous ad itegrable o a iterval cotaiig a ad x, ad h does ot chage sig i the iterval, the there exists a poit ξ i betwee a ad x such that: x a gthtdt () () = g( ξ ) htdt () x a
Remaider, of the Taylor Series: x ( x t) + 1 R = f () t dt! a Let g=f +1 (t) ad ht () = ( x t)! The accordig to the secod theorem of the mea: ( + 1) f ( ξ ) R = ( x a ) ( + 1)! + 1 a < ξ < x
Let x= x i+1 ad a=x i f ( xi ) f ( xi+ 1) = f ( xi) + f ( xi)( xi+ 1 xi) + ( xi+ 1 xi) 2! f ( xi) f ( x ) + ( x x ) +... + ( x x ) + R 3!! 3 i i+ 1 i i+ 1 i 2 Where ( + 1) f ( ξ ) R = ( xi+ 1 xi ) ( + 1)! + 1 İf we let : h=(x i+1 x i ) f ( x ) f ( x ) f ( x ) f x f x f x h h h h R 2! 3!! i 2 i 3 i ( i+ 1) = ( i) + ( i) + + +... + + R ( + 1) f ( ξ ) = h ( + 1)! + 1
Example : f(x)=si(x) expad i Taylor series about x 0 =0 df f( x 0) = si(0) = 0, = cos(0) = 1, dx x 0 2 3 4 df df df =-si(0)=0, = cos(0) = 1, = si(0) = 0 2 3 4 dx dx dx x x x 0 0 0 df dx x (x-x ) 0 df 0 0 + 3 2 = 0 if is eve, = ( 1) if is odd dx = x x 3 5 7 9 x x x x si( x) = 0 + x+ 0 + 0 + + 0 + 0 + 3! 5! 7! 9!
3 5 7 9 x x x x si( x) = 0 + x+ 0 + 0 + + 0 + 0 + 3! 5! 7! 9! Oe term appoximatio: (=2) π π si( ) =+ = 0.785398163 4 4 ( π ) 3 ( + 1) f ( ξ ) + R = h = f ( ξ ) 0< ξ< π 4 ( + 1)! 3! 1 4 f ( ξ ) = cos( ξ) ad f (0) = 1; f ( π 4) = 0.707106781 ( π 4) 3 R = f ( ξ ) ; -0.0807455122<R <-0.0570956992 3! Two term appoximatio: (=4) ( π 4) 3 ( ) 5 π π v π 4 si( ) =+ = 0.704652651 R = f ( ξ ) 0< ξ< π 4 4 4 3! 5! f v ( ξ) = cos( ξ) ad f v (0) = 1; f v ( π 4) = 0.707106781 R = f v ( π 4) 5 I both cases the true value is withi the bouds. ( ξ ) ; 0.00176097489<R <0.00249039457 5!
Accumulatio of errors (Due to Roud off errors) Small errors add up due to very large umbers of mathematical operatios. Divisio of a large umber with a small umber, or divisio of a small umber with a large umber may result i loss of sigificat digits.
x Stability ad Coditio (A guess o how the ucertaity is magified) If x is the iput f(x) is the output If x is a value very close to x. i.e (x- x )is small, Takig Taylor series expasio of f(x) about x ad keepig oly the first two terms: f( x) = f( x ) + f ( x )( x x ) Relative Error o x: Relative error o f(x): Coditio Number: x x ε [ x] = x f ( x ) f ( x) ε [ f( x) ] = f( x ) [ ] ε [ x] ε f( x) xf ( x ) = f( x ) If the coditio umber is large, the the fuctio is ill coditioed i the regio of iterest
Coditio Number: [ ] ε [ x] ε f( x) xf ( x ) = f( x ) Is the ratio i the chage of f(x) for a small chage i x 1 ( ) e x f x for x=0.01 x = ε [ ] ε [ x] 0.01 0.01 0.01 e 1 e e 1 f(0.01) = =1.0050167 f '(0.01) = =0.50334587 2 0.01 0.01 0.01 0.01*0.50334587 The Coditio Number= =0.005 (well behavig at x=0.01) 1.0050167 f( x) xf ( x ) = f( x ) 2.5 f( x) = for x=0.999000 2 1 x 2.5 2 x*2.5 5*0.999 f(0.999) = =1250.62531 f '(0.999) = = =1249999.686 2 2 2 2 2 1 0.999 (1 x ) (1 0.999 ) 0.999*1249999.686 The Coditio Number= =999 1250.62531 (too large, fuctio is ill coditioed at x=0.999)