314513180211Chapter 3 - Computational Errors

download 314513180211Chapter 3 - Computational Errors

of 51

Transcript of 314513180211Chapter 3 - Computational Errors

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    1/51

    Chapter 3

    Computational Errors

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    2/51

    Numerical "bugs"

    2

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    3/51

    Numerical Errors

    3

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    4/51

    Uncertainty: well- or ill-conditioned?

    Errors in input data can cause uncertain results input

    data can be experimental or rounded. leads to a certain

    variation in the results

    well-conditioned: numerical results are insensitive tosmall variations in the input

    ill-conditioned: small variations lead to drastically

    different numerical calculations (a.k.a. poorly

    conditioned)

    4

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    5/51

    Our Job

    As numerical analysts, we need to

    solve a problem so that the calculation is not susceptible to large

    roundoff error

    solve a problem so that the approximation has a tolerabletruncation error

    How?

    incorporate roundoff-truncation knowledge into

    the mathematical model the method

    the algorithm

    the software design

    awareness correct interpretation of results

    5

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    6/51

    Intel

    6

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    7/51

    Intel

    7

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    8/51

    Intel

    8

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    9/51

    Intel Timeline

    June 1994: Intel engineers discover the division error. Managers

    decide the error will not impact many people. Keep the issue

    internal.

    June 1994: Dr Nicely at Lynchburg College notices computation

    problems

    Oct 19, 1994: After months of testing, Nicely confirms that other

    errors are not the cause. The problem is in the Intel Processor.

    Oct 24, 1994: Nicely contacts Intel. Intel duplicates error.

    Oct 30, 1994: After no action from Intel, Nicely sends an email

    9

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    10/51

    Intel Timeline

    10

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    11/51

    Intel Timeline

    Nov 1, 1994: Software company Phar Lap Software receives Nicelys email.

    Sends to collegues at Microsoft, Borland, Watcom, etc. decide the error will

    not impact many people. Keep the issue internal.

    Nov 2, 1994: Email with description goes global.

    Nov 15, 1994: USC reverse-engineers the chip to expose the problem. Intellstill denies a problem. Stock falls.

    Nov 22, 1994: CNN Moneyline interviews Intel. Says the problem is minor.

    Nov 23, 1994: The MathWorks develops a fix.

    Nov 24, 1994: New York Times story. Intel still sending out flawed chips. Will

    replace chips only if it caused a problem in an important application. Dec 12, 1994: IBM halts shipment of Pentium based PCs

    Dec 16, 1994: Intel stock falls again.

    Dec 19, 1994: More reports in the NYT: lawsuits, etc.

    Dec 20, 1994: Intel admits. Sets aside $420 million to fix.

    11

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    12/51

    Pentium Bug

    12

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    13/51

    Digital Representation

    Can only use a finite number of digits to represent a number

    + reduces cost

    + reduces memory

    - errors bit: binary (0 or 1)

    byte: 8 bits

    word: smallest addressable unit of memory for a certain

    computer

    13

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    14/51

    Integers

    most computers: 16 or 32 bits for integers

    leads to 216 1 = 65535 integers

    spanned over -32768 to 32767

    not many problems here

    14

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    15/51

    Integer Algorithm

    15

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    16/51

    Integers

    16

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    17/51

    Floating Point

    17

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    18/51

    Floating Point Algorithm

    18

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    19/51

    Floating Point Representation

    19

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    20/51

    Floating Point

    20

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    21/51

    Overflow/Underflow

    21

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    22/51

    Floating Point Number Line

    22

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    23/51

    A problem with precision

    23

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    24/51

    Finite Precision

    24

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    25/51

    Finite Precision

    25

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    26/51

    Solution

    26

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    27/51

    Round-off

    27

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    28/51

    On Symbolic versus Numerical

    28

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    29/51

    So What?

    29

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    30/51

    Floating point Arithmetic

    30

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    31/51

    Where is the rounding error?

    31

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    32/51

    Example: Quadratic Formula

    32

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    33/51

    Example: Quadratic Formula

    33

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    34/51

    A fix?

    34

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    35/51

    Real (obscure) fix

    35

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    36/51

    Catastrophic Cancellation

    36

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    37/51

    Catastrophic Cancellation

    37

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    38/51

    Summary

    38

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    39/51

    How large is the roundoff error?

    39

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    40/51

    To compute

    40

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    41/51

    Practical Considerations

    41

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    42/51

    How close is float x to float y?

    42

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    43/51

    Why Relative?

    43

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    44/51

    Relative vs. Absolute

    44

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    45/51

    Truncation Error

    45

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    46/51

    Taylor Series revisited

    46

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    47/51

    Taylor Series revisited

    47

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    48/51

    Big "O"

    48

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    49/51

    Example

    49

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    50/51

    Example

    50

  • 7/27/2019 314513180211Chapter 3 - Computational Errors

    51/51

    Any Question??