round off and error - chapter 4chapter4rev1

Upload: qilah-kamarudin

Post on 14-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Round Off and Error - Chapter 4Chapter4Rev1

    1/20

    Part 1Chapter 4

    Roundoff and

    Truncation Errors

    PowerPoints organized by Dr. Michael R. Gustafson II, Duke University and

    Prof. Steve Chapra, Tufts UniversityAll images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

  • 7/29/2019 Round Off and Error - Chapter 4Chapter4Rev1

    2/20

    Chapter Objectives

    Understanding the distinction between accuracyand precision.

    Learning how to quantify error.

    Learning how error estimates can be used to decidewhen to terminate an iterative calculation.

    Understanding how roundoff errors occur because

    digital computers have a limited ability to represent

    numbers.

    Understanding why floating-point numbers have

    limits on their range and precision.

  • 7/29/2019 Round Off and Error - Chapter 4Chapter4Rev1

    3/20

    Objectives (cont)

    Recognizing that truncation errors occur whenexact mathematical formulations are represented

    by approximations.

    Knowing how to use the Taylor series to estimatetruncation errors.

    Understanding how to write forward, backward, and

    centered finite-difference approximations of the first

    and second derivatives. Recognizing that efforts to minimize truncation

    errors can sometimes increase roundoff errors.

  • 7/29/2019 Round Off and Error - Chapter 4Chapter4Rev1

    4/20

    Accuracy and Precision

    Accuracyrefers to how closely a computed or measuredvalue agrees with the true value, whileprecision refers to

    how closely individual computed or measured values

    agree with each other.

    a) inaccurate and imprecise

    b) accurate and imprecise

    c) inaccurate and precise

    d) accurate and precise

  • 7/29/2019 Round Off and Error - Chapter 4Chapter4Rev1

    5/20

    Error Definitions

    True error (Et): the difference between thetrue value and the approximation.

    Absolute error (|Et|): the absolute difference

    between the true value and theapproximation.

    True fractional relative error: the true errordivided by the true value.

    Relative error (t): the true fractional relativeerror expressed as a percentage.

  • 7/29/2019 Round Off and Error - Chapter 4Chapter4Rev1

    6/20

    Error Definitions (cont)

    The previous definitions of error relied on knowinga true value. If that is not the case, approximationscan be made to the error.

    The approximate percent relative error can be

    given as the approximate error divided by theapproximation, expressed as a percentage - thoughthis presents the challenge of finding theapproximate error!

    For iterative processes, the error can beapproximated as the difference in values betweensucessive iterations.

  • 7/29/2019 Round Off and Error - Chapter 4Chapter4Rev1

    7/20

    Using Error Estimates

    Often, when performing calculations, we maynot be concerned with the sign of the error

    but are interested in whether the absolute

    value of the percent relative error is lowerthan a prespecified tolerance s. For such

    cases, the computation is repeated until | a

    |