ch02-1st
- 格式:pptx
- 大小:293.85 KB
- 文档页数:34


LECTURE 2 -1MAE3100Prof. D.E. SmithLECTURE 2Round-Off and Truncation ErrorsMotivation:Understanding the concept of error and how it develops in numerical methods is important to the effective use of computer techniques.This study focuses on two major forms of numerical error: Round-offError and Truncation Error.Reading Assignment:Chapra Chapter 4 (required)Chapra and Canale Section 4.1 (optional)LECTURE 2 -2MAE3100Prof. D.E. SmithLECTURE 2 OBJECTIVESThe primary objective of this lecture is to provide a basicunderstanding of computational errors introduced bynumerical methods. More specifically, this lecture will:•Expose potential sources of computational errors.•Compare accuracy and precision.•Review numerical precision associated with digitalcomputing.•Provide specific calculations for evaluating error estimates.•Provide a means for estimating truncation error using theTaylor series.•Explore finite difference approximations for first and secondderivatives.MAE3100Prof. D.E. SmithLECTURE 2 -3You’ve Got A Problem•The numerical methods solution to the bungee jumper problem inChapter 1 employed an approximation to the derivative as•What is known?–Numerical error is introduced byapproximation–Approximation error depends on t–Computers have limited precision•What is needed?– A basic understanding of errors associated with computercalculations– A method for assessing the amount of error introduced withthe approximations used by numerical methodsii i i t t t v t v t v dt dv 11)()(MAE3100Prof. D.E. SmithLECTURE 2 -4Sources of Error•Errors in mathematical modelingResult from simplifying assumptions and approximations madewhen representing physical systems by mathematical equations.•BlundersResult from mathematical modeling errors and/or programmingerrors.•Errors in inputBEWARE: garbage in –garbage out•Machine errorsResult from rounding, chopping, underflow and overflow•Truncation errorsResult from simplifying assumptions and approximations madein the numerical procedureOccurs when truncating an infinite series or numericalevaluation of an improper integral. E.g.,!4!3!21432x x x x e xMAE3100Prof. D.E. SmithLECTURE 2 -5Accuracy and Precisiondata scatterdefinesimprecisionoruncertaintysystematic deviation defines inaccuracy or bias inaccurateandimpreciseaccurateandprecise MAE3100Prof. D.E. SmithLECTURE 2 -6Significant Figures•The significant digits of a number are those that can be used withconfidence.•What is the speed?–48 or 49?–48.8 or 48.9?–48.8642138?–#sig-figs = 3•What is the mileage?–87324.4 or 87324.5?–87324.46?–#sig-figs = 7•All results in MAE3100 must display appropriate units and Sig-Figs–Use no less than 3 sig-figs, 4 is preferred–Use the greatest accuracy possible during calculations–Report result with sig-figs consistent with inputMAE3100Prof. D.E. SmithLECTURE 2 -7Error Definitions•True (Absolute) ErrorNote: Issues arise when working with different orders-of-magnitude•True Percent Relative Error•Approximate Percent Relative Error (true value not always known)• A specified percent tolerance s may be used as a stopping criteria:I.e., stop with n decimal place accuracy when ionapproximat value true t E (100%) value true ionapproximat - value true (100%) value true error true t %)100(ion approximat current ionapproximat previous -ion approximat current (100%)ion approximat errore approximat a )%105.0(2n s a MAE3100Prof. D.E. SmithLECTURE 2 -8Round-Off Error•Recall that numbers are stored in binary format–16 bit integer representationRange: -32,768 to 32,767Shown: -173–Floating point representation•Single precision (32 bit)24 bit mantissa7-8 sig-figs Range: 10-38to 1039•Double precision (64 bit)15-16 sig-figsRange: 10-308to 10308Representation used by MATLAB (223210)272625242330292831….sMAE3100Prof. D.E. SmithLECTURE 2 -9Working with Computer Numbers•Computers work in base 2 making it impossible to accuratelyrepresent numbers of interest, e.g.,•MATLAB commands related to machine precision include realmax ,realmin , eps•Round-off errors can accumulate in large computations.•Loss of significant figures occurs when subtracting numbers ofsimilar magnitude:•Small numbers can be lost when added to large numbers using finitemachine precision 333100001.0107641.0107642.0...,7,,,1.0etc e 4444104000.010*******.010*******.0104000.0chopped MAE3100Prof. D.E. SmithLECTURE 2 -10Truncation Error•Taylor theorem : Any smooth function can be written as a polynomial.•Definition: The Taylor Series expansion of f (x )about x = a iswhere the remainder is•The n -th order Taylor Series with h = x –a becomes:• A Maclaurin Series is a Taylor Series expanded about a = 0 (h = x )nk nk k R a x a f k x f 0)()()(!1)(n -th order Taylor Series approximation f n (x )remainder))(()()()!1(111)1(n n n n a x O a x f n R x a nn n hn a f h a f h a f h a f a f h f !)(!3)(!2)()()()()(3)3(2 nn n xn f x f x f x f f x f !)0(!3)0(!2)0()0()0()()(3)3(2 error is ‘on the order of’(x -a )n +1a x XI (ks-eye)MAE3100Prof. D.E. SmithLECTURE 2 -11Truncation Error (cont.)•Accuracy increases as more terms are added to the Taylor Series expansionconstant)a (i.e., 0a function)linear a (i.e., 10h a a )polynomial order 2nd a (i.e.,2210h a h a a MAE3100Prof. D.E. SmithLECTURE 2 -12Taylor Series ExampleFrom Chapra Figure 4.2, pg. 68:Where) (i.e., 0about Expanded 2.125.05.015.01.0)(234x a x h a x x x x x f 0.1)0(25.0)0(2.1)0(f f f xx f 25.02.1)(1225.025.02.1)(x x x f 2.1)(0x fMAE3100Prof. D.E. SmithLECTURE 2 -13Taylor Series -ExampleDetermine the 4-th order Taylor Series of y (x ) = ln(1+x )about x = a = 0By successive differentiation we obtainThe Taylor Series for |x |≤ 1becomes:Note: The error is proportional to x 5: i.e., when x is reduced by afactor of 2, R 4decreases by a factor of 25= 32)1ln()(x x y 0)0(y x x y 11)(1)0(y 2)1(1)(x x y 1)0(y 3)3()1(2)(x x y 2)0()3(y 4)4()1(6)(x x y 6)0()4(y 4324413121)()(x x x x x y x y )()1(51120)(5555)5(4x O x x y R with 5)5()1(24)(y MAE3100Prof. D.E. SmithLECTURE 2 -14Defining the RemainderRecall that the remainder R n is defined in terms the variable asConsider a zero-order (n = 0)Taylor Seriesthen 1)1()()!1()(n n n a x n f R ha a where )()()(0a f x f x f hR f h f R 00)()(= a = x = a = x)(f xa a+hMAE3100Prof. D.E. SmithLECTURE 2 -15Defining the Remainder (cont)Recall our example y (x ) = ln(1+x )with the 4-th order Taylor Series aboutx = 0The remainder becomesCombining these equations givesFor x = 1, we obtainthen or which satisfies the condition 4432413121)(R x x x x x y 55432)1(151413121)1ln(x x x x x x 555554)1(151)0())1(ln(!51x x x dx d R x 12739.058333.0413121)(69315.0)(4324x x x x x y x y 105544)1()1(15110981.058333.069315.0)1()1(y y R MAE3100Prof. D.E. SmithLECTURE 2 -16Defining the Remainder (cont)NOTE:•Determining the number of terms required for a Taylor series torepresent a function of interest is based on the remainder.•Unfortunately, ξis not known exactly but merely lies somewherebetween a and x = a + h (or x i and x i+1).•Also, R n requires derivatives of f (x ),which are not generally known.•Despite this, R n is still useful for gaining insight into truncationerrors.•Recall that we do have control over h and can therefore assess whathappens as we change h , i.e.,1)1(1)1()!1()()()!1()(n n nn n h n f a x n f R )())((11n n n h O a x O R xa a+h hMAE3100Prof. D.E. SmithLECTURE 2 -17Using the Remainder R n1)Establish order of error (from definition)2)Verify order of error estimate*> at h = 0.5 > at h = 1.03) Provide error estimate when h is increased or reduced*at h = 0.5, we computed R 4= 0.00442344then at h = 1.0 (doubled), we estimate R 4(0.00442344)(25) = 0.141550))(()()!1()(11)1(n n n n a x O a x n f R 0.109814)1()1(44y y R 0.00442344)5.0()5.0(44y y R 2X ~25X note: 25= 32X*For y (x ) = ln(1+x )about x = 0MAE3100Prof. D.E. SmithLECTURE 2 -18Using the Remainder R n (cont)4)Calculate value of ξwhen exact function value is known*Recall for h = 1and 5)Establish upper or lower bound on error*Recall that when h = 1, we obtain and Then the upper bound of the error may becalculated as the maximum R 4over the validrange of ξas 0.109814)1()1(44y y R *For y (x ) = ln(1+x )about x = 0554)1()1(151R Equating andsolving for ξgives12739.01054)1(151R 51)1(151)1(15110max 055max 4R maxξR 4MAE3100Prof. D.E. SmithLECTURE 2 -19Numerical DifferentiationDerivatives may be evaluated numerically withthe Finite (Divided) Difference method.1.Forward Difference (error is O (h ))2.Backward Difference (error is O (h ))3.Central Difference (error is O (h 2))hx f h x f x f )()()(hh x f x f x f )()()(hh x f h x f x f 2)()()(MAE3100Prof. D.E. SmithLECTURE 2 -20Remainder w/ Finite DifferenceConsider the 1st order Taylor Series and Remainder for f (x )expandedabout a = x (note h = x )which can be rearranged to give forward differenceExample problem: consider f (x ) = sin(x ) at x = /4exact derivative:forward finite difference:error bounded by remainder:2!2)()()()(xf x x f x f x x f R 1xf x x f x x f x f 2)()()()(O (x )7071067811.0)cos()(4/x x x f 6706029729.01.0)4/sin()1.04/sin()(x f (with x = 0.1)error = 0.0370781.04/at 0.0387084/at 0.035355)(2)sin(2)(x x f。
400个外贸资源网站-转移动移不动转自其它论坛,希望能给做外贸的朋友提供些帮助.北欧与中国的门户B2B,审核严格/世界综合贸易网站精选前十名Tradeleadpostingservice.电子商务广/Tradeleadsearchengineandcompanyproductlistings. /世界综合贸易网站精选前十名易创电子商贸/世界综合贸易网站精选前十名埃及贸易网/tb/MediterraneanTradeBoardwww.e-leads.ca/menu-e.asp InternationalBusinessOpportunitiesCentre / funded by the trade promotion organisations世界综合贸易网站精选前十名欧洲黄页 International trade portal providing trade leads and a business directory./FreetradeleadsinSpanish/Free trade leads and directorieswww.exportconsulting.nl/免费and links to consultants in severalcountrieswww.exportconsulting.nl/Tradeboard/Trade leads for import and export wth the USA/Website offering trade leads for importers and exporters./免费www.extrem.ro/免费.EmphasisoneasternEuropewww.extrem.ro/form.htm罗马尼亚贸易网.br/?圣保罗州工业联合会(葡文)?法国半官方外贸促进机构(/Free trade leads and other resources 法国出口网/ Classified listing of trade leads.//世界综合贸易网站精选前十名/Global Trade Village/法国黄金贸易网希腊大理石国际网香港产品澳洲国际商务论坛/bo/ibbo02po.htm International Business Forum Trade Opportunities大鸟电子商务/印度投资/引擎之二(工业化的多),自动分门别类。