SlideShare uma empresa Scribd logo
1 de 22
What is The Error ?
How did it happen ?




                      1
Definition
• The Error in a computed quantity is defined
  as:

     Error = True Value – Approximate Value




                                                2
Examples:
a. True Value : phi = 3.14159265358979
    Appr. Value : 22/7 = 3.14285714285714
    Error = phi-22/7= -0.00126448926735
b. True Value : 12
   Appr. Value: 11.78
   Error = 12-11.78 = 0.22
c. True Value : 100
   Appr. Value: 95.5
   Error = 100-95.5 = 4.5
                                            3
Kind of Error
• The Absolute Error is measure the
  magnitude of the error
              Ea     Error
• The Relative Error is a measure of the error
  in relation to the size of the true value
                       Ea
            Er
                   True Value
                                             4
Examples
• True value : 10      Ea = 10-9 = 1
  Appr. Value : 9      Er = Ea/ 10 = 0.1
           Ea    1,     Er    0 .1

• True value : 1000    Ea = 1000-999= 1
  Appr. Value : 999    Er =Ea/1000=0.001
           Ea    1,     Er    0 . 001
• True value : 250     Ea =250-240= 10
  Appr. Value : 240    Er = Ea/250= 0.04
           Ea   10 ,     Er    0 . 04      5
Sources of Error

a.Truncation Error
b.Rounding Error


                         6
a. Truncation Error
• errors that result from using an approximation
  in place of an exact mathematical procedure




                                                   7
Example of Truncation Error
Taking only a few terms of a Maclaurin series to
approximate    e
                 x

                            2           3
         x              x       x
     e       1   x                          .......... ..........
                        2!      3!

 If only 3 terms are used,
                                                          2
                                    x                 x
   Truncation        Error      e           1   x
                                                      2!


                                        8
Example 1 —Maclaurin series
Calculate the value of e with an absolute
                                                               1 .2


relative approximate error of less than 1%.
                                        2          3
        1 .2                     1 .2       1 .2
    e          1       1 .2                                .......... .........
                                   2!         3!

    n                  1 .2
                                   Ea                      %
                   e                                   a

    1                    1                    __                            ___
    2                    2.2                  1.2                           54.545
    3                    2.92                 0.72                          24.658
    4                    3.208                0.288                         8.9776
    5                    3.2944               0.0864                        2.6226
    6                    3.3151               0.020736                      0.62550


                                    6 terms are required.
                                            9
Example 2 —Differentiation
                                                                                            f (x   x)       f ( x)
Find                  for                            using
                                                2
            f ( 3)             f ( x)       x                               f ( x)
                                                                                                    x
and         x        0 .2
            '         f (3    0 .2 )       f (3)
        f (3)
                                0 .2
                                                           2           2
                      f (3 .2 )    f (3)            3 .2           3              10 . 24     9    1 . 24
                                                                                                                6 .2
                             0 .2                       0 .2                          0 .2          0 .2

The actual value is
        '                       '
       f ( x)    2 x,         f (3)        2        3          6

Truncation error is then,                                      6           6 .2         0 .2

                                                10
Example 3 — Integration
Use two rectangles of equal width to approximate
the area under the curve for
        x over the interval [ 3,9 ]
         2
 f ( x)
       y

  90
                                        9
                 y = x2                      2
  60
                                            x dx
  30                                    3

  0                                 x
       0     3    6       9    12

                          11
Integration example (cont.)
Choosing a width of 3, we have
     9
          2           2                                            2
         x dx    (x )               (6           3)           (x )            (9   6)
                              x 3                                       x 6
     3
                      2                  2
                 (3 )3              ( 6 )3
                 27           108        135

Actual value is given by
     9                        9
                          3                  3            3
          2       x                      9            3
         x dx                                                          234
     3                3       3
                                                 3

Truncation error is then
     234        135            99
                                                              12
b. Rounding Errors
• Round-off / Chopping Errors

• Recognize how floating point arithmetic operations
  can introduce and amplify round-off errors

• What can be done to reduce the effect of round-off
  errors
                         13
There are discrete points on the
     number lines that can be
     represented by our computer.
     How about the space between ?



14
Implication of FP representations
• Only limited range of quantities may be
  represented.
  – Overflow and underflow

• Only a finite number of quantities within the range
  may be represented.
  – round-off errors or chopping errors




                             15
Round-off / Chopping Errors
              (Error Bounds Analysis)
Let
   z be a real number we want to represent in a computer, and
   fl(z) be the representation of z in the computer.


What is the largest possible value of                              ?
                                                               z       fl ( z )
                                                                     z
i.e., in the worst case, how much data are we losing due to round-off or chopping
     errors?


                                          16
Chopping Errors (Error Bounds Analysis)
Suppose the mantissa can only support n digits.
                                                         e
z      0 .a1a 2  a n a n 1a n       2
                                                            ,           a1    0
                                              e
fl ( z )         0 .a1a 2  a n

Thus the absolute and relative chopping errors are
                                                                 e                              e n
z    fl ( z )       ( 0 .00 ... 0 a n 1 a n
                          
                                                 2
                                                    )                   ( 0 .a n 1a n   2
                                                                                           )
                         n zeroes
                                                                     e
z     fl ( z )         ( 0 . 00 ... 0 a n 1 a n     2
                                                      )
                                                                         e
     z               ( 0 .a 1a 2  a n a n 1a n      2
                                                       )

Suppose ß = 10 (base 10), what are the values of ai such that
the errors are the largest?
                                                         17
Chopping Errors (Error Bounds Analysis)

 Because               0 .a n 1a n 2 a n     3
                                                               1
                                                          e n        e n                          e n
 z      fl ( z )       0 .a n 1a n     2
                                                                                  z   fl ( z )

                                                                         e
 z      fl ( z )         0 . 00 ... 0 a n 1 a n           2
                                                            
                                                                             e
        z              0 .a 1a 2  a n a n 1a n             2
                                                              
                          e n

                                                      e
     0 .a1a 2  a n a n 1a n          2
                                        
                         e n

                                                 e
     0 .100000 a n 1 a n
                              2
                                   
            n digits

            e n                 e n
                                                     e n ( e 1)              1 n
                                                                                   z   fl ( z )   1 n
                   e        1         e
     0 .1                                                                              z
                                                                    18
Round-off Errors (Error Bounds Analysis)

                                                    e
z            0 .a 1 a 2  a n a n   1
                                                       ,   a1       0

           1 ( sign )               base    e       exponent


                                           e
                 ( 0 .a 1 a 2  a n )                                    0     an    1
                                                                                             2
fl ( z )                                                                     Round down

                                                                 e
                 [( 0 .a 1 a 2  a n )     ( 0 ) ]
                                             00 ...
                                              .     01                          an       1
                                                        n                2
                                                                              Round up

fl(z) is the rounded value of z
                                               19
Round-off Errors (Error Bounds Analysis)
Absolute error of fl(z)
When rounding down
                                                                              e
 z   fl ( z )                0 . 00  0 a n 1 a n        a
                                                        2 n    3
                                                                 
                                                                    e n
                             0 .a n 1 a n     a
                                             2 n   3
                                                     
                                                              e n
 z       fl ( z )   0 .a n 1 a n      a
                                     2 n     3
                                               

                                         1                                                    1   e n
an   1
                    (. a n   1
                               )                                          z       fl ( z )
               2                         2                                                    2

Similarly, when rounding up
                                                                                              1
i.e., when                      an   1                                    z        fl ( z )
                                                                                                  e n

                       2                                                                      2
                                                   20
Round-off Errors (Error Bounds Analysis)
Relative error of fl(z)
                   1     e n
  z   fl ( z )
                   2
                              n
  z   fl ( z )     1
                                  e
      z            2 z
                                      n
                   1                                                                       e
                                           because       z          (. a 1 a 2  )
                   2 (. a 1 a 2  )
                             n
                   1
                                           because       (. a 1 )        ( 0 . 1)
                   2 (. 1)
                          n
                   1
                   2
                          1                     z    fl ( z )               1        1 n

                                                     z                      2

                                          21
Summary of Error Bounds Analysis
                 Chopping Errors                 Round-off errors
 Absolute                             e n                               1       e n
                     z    fl ( z )                  z       fl ( z )
                                                                        2

 Relative            z    fl ( z )    1 n
                                                        z    fl ( z )       1    1 n

                          z                                  z              2

 β       base
 n       # of significant digits or # of digits in the mantissa

Regardless of chopping or round-off is used to round the numbers,
the absolute errors may increase as the numbers grow in magnitude
but the relative errors are bounded by the same magnitude.

                                      22

Mais conteúdo relacionado

Mais procurados

267 handout 2_partial_derivatives_v2.60
267 handout 2_partial_derivatives_v2.60267 handout 2_partial_derivatives_v2.60
267 handout 2_partial_derivatives_v2.60Ali Adeel
 
31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manualMahrukh Khalid
 
M A T H E M A T I C A L M E T H O D S J N T U M O D E L P A P E R{Www
M A T H E M A T I C A L  M E T H O D S  J N T U  M O D E L  P A P E R{WwwM A T H E M A T I C A L  M E T H O D S  J N T U  M O D E L  P A P E R{Www
M A T H E M A T I C A L M E T H O D S J N T U M O D E L P A P E R{Wwwguest3f9c6b
 
Maths ch15 key
Maths ch15 keyMaths ch15 key
Maths ch15 keyGary Tsang
 
2010 mathematics hsc solutions
2010 mathematics hsc solutions2010 mathematics hsc solutions
2010 mathematics hsc solutionsjharnwell
 
Lesson 1.1 multiplication
Lesson 1.1 multiplicationLesson 1.1 multiplication
Lesson 1.1 multiplicationA V Prakasam
 
01 derivadas
01   derivadas01   derivadas
01 derivadasklorofila
 
Accuracy
AccuracyAccuracy
Accuracyesraz
 
Elementary differential equations with boundary value problems solutions
Elementary differential equations with boundary value problems solutionsElementary differential equations with boundary value problems solutions
Elementary differential equations with boundary value problems solutionsHon Wa Wong
 
11 X1 T01 08 Simultaneous Equations (2010)
11 X1 T01 08 Simultaneous Equations (2010)11 X1 T01 08 Simultaneous Equations (2010)
11 X1 T01 08 Simultaneous Equations (2010)Nigel Simmons
 
Algebra 2 benchmark 3 review
Algebra 2 benchmark 3 reviewAlgebra 2 benchmark 3 review
Algebra 2 benchmark 3 reviewjackieeee
 

Mais procurados (18)

267 handout 2_partial_derivatives_v2.60
267 handout 2_partial_derivatives_v2.60267 handout 2_partial_derivatives_v2.60
267 handout 2_partial_derivatives_v2.60
 
Review for final exam
Review for final examReview for final exam
Review for final exam
 
assignment_2
assignment_2assignment_2
assignment_2
 
31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual
 
版型0118
版型0118版型0118
版型0118
 
M A T H E M A T I C A L M E T H O D S J N T U M O D E L P A P E R{Www
M A T H E M A T I C A L  M E T H O D S  J N T U  M O D E L  P A P E R{WwwM A T H E M A T I C A L  M E T H O D S  J N T U  M O D E L  P A P E R{Www
M A T H E M A T I C A L M E T H O D S J N T U M O D E L P A P E R{Www
 
Maths ch15 key
Maths ch15 keyMaths ch15 key
Maths ch15 key
 
2010 mathematics hsc solutions
2010 mathematics hsc solutions2010 mathematics hsc solutions
2010 mathematics hsc solutions
 
Wordproblem
WordproblemWordproblem
Wordproblem
 
Lesson 1.1 multiplication
Lesson 1.1 multiplicationLesson 1.1 multiplication
Lesson 1.1 multiplication
 
1010n3a
1010n3a1010n3a
1010n3a
 
01 derivadas
01   derivadas01   derivadas
01 derivadas
 
Accuracy
AccuracyAccuracy
Accuracy
 
Elementary differential equations with boundary value problems solutions
Elementary differential equations with boundary value problems solutionsElementary differential equations with boundary value problems solutions
Elementary differential equations with boundary value problems solutions
 
1150 day 4
1150 day 41150 day 4
1150 day 4
 
11 X1 T01 08 Simultaneous Equations (2010)
11 X1 T01 08 Simultaneous Equations (2010)11 X1 T01 08 Simultaneous Equations (2010)
11 X1 T01 08 Simultaneous Equations (2010)
 
Operations Research - The Dual Simplex Method
Operations Research - The Dual Simplex MethodOperations Research - The Dual Simplex Method
Operations Research - The Dual Simplex Method
 
Algebra 2 benchmark 3 review
Algebra 2 benchmark 3 reviewAlgebra 2 benchmark 3 review
Algebra 2 benchmark 3 review
 

Semelhante a Chap 1

Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)asghar123456
 
1-1 Algebra Review HW
1-1 Algebra Review HW1-1 Algebra Review HW
1-1 Algebra Review HWnechamkin
 
Amth250 octave matlab some solutions (1)
Amth250 octave matlab some solutions (1)Amth250 octave matlab some solutions (1)
Amth250 octave matlab some solutions (1)asghar123456
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabkrishna_093
 
Image Processing
Image ProcessingImage Processing
Image Processingyuvhashree
 
Sistem pertidaksamaan kuadrat 2 variabel
Sistem pertidaksamaan kuadrat 2 variabelSistem pertidaksamaan kuadrat 2 variabel
Sistem pertidaksamaan kuadrat 2 variabelAlya Titania Annisaa
 
numarial analysis presentation
numarial analysis presentationnumarial analysis presentation
numarial analysis presentationOsama Tahir
 
A2 Chapter 6 Study Guide
A2 Chapter 6 Study GuideA2 Chapter 6 Study Guide
A2 Chapter 6 Study Guidevhiggins1
 
8.7 numerical integration
8.7 numerical integration8.7 numerical integration
8.7 numerical integrationdicosmo178
 
8.7 numerical integration
8.7 numerical integration8.7 numerical integration
8.7 numerical integrationdicosmo178
 
8.7 numerical integration
8.7 numerical integration8.7 numerical integration
8.7 numerical integrationdicosmo178
 
Solving the Poisson Equation
Solving the Poisson EquationSolving the Poisson Equation
Solving the Poisson EquationShahzaib Malik
 
Ee107 sp 06_mock_test1_q_s_ok_3p_
Ee107 sp 06_mock_test1_q_s_ok_3p_Ee107 sp 06_mock_test1_q_s_ok_3p_
Ee107 sp 06_mock_test1_q_s_ok_3p_Sporsho
 
Precalculus 1 chapter 2
Precalculus 1 chapter 2Precalculus 1 chapter 2
Precalculus 1 chapter 2oreves
 
Jacobi and gauss-seidel
Jacobi and gauss-seidelJacobi and gauss-seidel
Jacobi and gauss-seidelarunsmm
 

Semelhante a Chap 1 (20)

Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)
 
1-1 Algebra Review HW
1-1 Algebra Review HW1-1 Algebra Review HW
1-1 Algebra Review HW
 
Amth250 octave matlab some solutions (1)
Amth250 octave matlab some solutions (1)Amth250 octave matlab some solutions (1)
Amth250 octave matlab some solutions (1)
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Image Processing
Image ProcessingImage Processing
Image Processing
 
Sistem pertidaksamaan kuadrat 2 variabel
Sistem pertidaksamaan kuadrat 2 variabelSistem pertidaksamaan kuadrat 2 variabel
Sistem pertidaksamaan kuadrat 2 variabel
 
numarial analysis presentation
numarial analysis presentationnumarial analysis presentation
numarial analysis presentation
 
Mth 4101-2 a
Mth 4101-2 aMth 4101-2 a
Mth 4101-2 a
 
A2 ch6sg
A2 ch6sgA2 ch6sg
A2 ch6sg
 
A2 Chapter 6 Study Guide
A2 Chapter 6 Study GuideA2 Chapter 6 Study Guide
A2 Chapter 6 Study Guide
 
8.7 numerical integration
8.7 numerical integration8.7 numerical integration
8.7 numerical integration
 
8.7 numerical integration
8.7 numerical integration8.7 numerical integration
8.7 numerical integration
 
8.7 numerical integration
8.7 numerical integration8.7 numerical integration
8.7 numerical integration
 
Solving the Poisson Equation
Solving the Poisson EquationSolving the Poisson Equation
Solving the Poisson Equation
 
Ee107 sp 06_mock_test1_q_s_ok_3p_
Ee107 sp 06_mock_test1_q_s_ok_3p_Ee107 sp 06_mock_test1_q_s_ok_3p_
Ee107 sp 06_mock_test1_q_s_ok_3p_
 
Precalculus 1 chapter 2
Precalculus 1 chapter 2Precalculus 1 chapter 2
Precalculus 1 chapter 2
 
Jacobi and gauss-seidel
Jacobi and gauss-seidelJacobi and gauss-seidel
Jacobi and gauss-seidel
 
1st 2practice
1st 2practice1st 2practice
1st 2practice
 
Assignment4
Assignment4Assignment4
Assignment4
 
Mth 4101-2 b
Mth 4101-2 bMth 4101-2 b
Mth 4101-2 b
 

Chap 1

  • 1. What is The Error ? How did it happen ? 1
  • 2. Definition • The Error in a computed quantity is defined as: Error = True Value – Approximate Value 2
  • 3. Examples: a. True Value : phi = 3.14159265358979 Appr. Value : 22/7 = 3.14285714285714 Error = phi-22/7= -0.00126448926735 b. True Value : 12 Appr. Value: 11.78 Error = 12-11.78 = 0.22 c. True Value : 100 Appr. Value: 95.5 Error = 100-95.5 = 4.5 3
  • 4. Kind of Error • The Absolute Error is measure the magnitude of the error Ea Error • The Relative Error is a measure of the error in relation to the size of the true value Ea Er True Value 4
  • 5. Examples • True value : 10 Ea = 10-9 = 1 Appr. Value : 9 Er = Ea/ 10 = 0.1 Ea 1, Er 0 .1 • True value : 1000 Ea = 1000-999= 1 Appr. Value : 999 Er =Ea/1000=0.001 Ea 1, Er 0 . 001 • True value : 250 Ea =250-240= 10 Appr. Value : 240 Er = Ea/250= 0.04 Ea 10 , Er 0 . 04 5
  • 6. Sources of Error a.Truncation Error b.Rounding Error 6
  • 7. a. Truncation Error • errors that result from using an approximation in place of an exact mathematical procedure 7
  • 8. Example of Truncation Error Taking only a few terms of a Maclaurin series to approximate e x 2 3 x x x e 1 x .......... .......... 2! 3! If only 3 terms are used, 2 x x Truncation Error e 1 x 2! 8
  • 9. Example 1 —Maclaurin series Calculate the value of e with an absolute 1 .2 relative approximate error of less than 1%. 2 3 1 .2 1 .2 1 .2 e 1 1 .2 .......... ......... 2! 3! n 1 .2 Ea % e a 1 1 __ ___ 2 2.2 1.2 54.545 3 2.92 0.72 24.658 4 3.208 0.288 8.9776 5 3.2944 0.0864 2.6226 6 3.3151 0.020736 0.62550 6 terms are required. 9
  • 10. Example 2 —Differentiation f (x x) f ( x) Find for using 2 f ( 3) f ( x) x f ( x) x and x 0 .2 ' f (3 0 .2 ) f (3) f (3) 0 .2 2 2 f (3 .2 ) f (3) 3 .2 3 10 . 24 9 1 . 24 6 .2 0 .2 0 .2 0 .2 0 .2 The actual value is ' ' f ( x) 2 x, f (3) 2 3 6 Truncation error is then, 6 6 .2 0 .2 10
  • 11. Example 3 — Integration Use two rectangles of equal width to approximate the area under the curve for x over the interval [ 3,9 ] 2 f ( x) y 90 9 y = x2 2 60 x dx 30 3 0 x 0 3 6 9 12 11
  • 12. Integration example (cont.) Choosing a width of 3, we have 9 2 2 2 x dx (x ) (6 3) (x ) (9 6) x 3 x 6 3 2 2 (3 )3 ( 6 )3 27 108 135 Actual value is given by 9 9 3 3 3 2 x 9 3 x dx 234 3 3 3 3 Truncation error is then 234 135 99 12
  • 13. b. Rounding Errors • Round-off / Chopping Errors • Recognize how floating point arithmetic operations can introduce and amplify round-off errors • What can be done to reduce the effect of round-off errors 13
  • 14. There are discrete points on the number lines that can be represented by our computer. How about the space between ? 14
  • 15. Implication of FP representations • Only limited range of quantities may be represented. – Overflow and underflow • Only a finite number of quantities within the range may be represented. – round-off errors or chopping errors 15
  • 16. Round-off / Chopping Errors (Error Bounds Analysis) Let z be a real number we want to represent in a computer, and fl(z) be the representation of z in the computer. What is the largest possible value of ? z fl ( z ) z i.e., in the worst case, how much data are we losing due to round-off or chopping errors? 16
  • 17. Chopping Errors (Error Bounds Analysis) Suppose the mantissa can only support n digits. e z 0 .a1a 2  a n a n 1a n 2  , a1 0 e fl ( z ) 0 .a1a 2  a n Thus the absolute and relative chopping errors are e e n z fl ( z ) ( 0 .00 ... 0 a n 1 a n    2 ) ( 0 .a n 1a n 2 ) n zeroes e z fl ( z ) ( 0 . 00 ... 0 a n 1 a n 2 ) e z ( 0 .a 1a 2  a n a n 1a n 2 ) Suppose ß = 10 (base 10), what are the values of ai such that the errors are the largest? 17
  • 18. Chopping Errors (Error Bounds Analysis) Because 0 .a n 1a n 2 a n 3  1 e n e n e n z fl ( z ) 0 .a n 1a n 2  z fl ( z ) e z fl ( z ) 0 . 00 ... 0 a n 1 a n 2  e z 0 .a 1a 2  a n a n 1a n 2  e n e 0 .a1a 2  a n a n 1a n 2  e n e 0 .100000 a n 1 a n  2  n digits e n e n e n ( e 1) 1 n z fl ( z ) 1 n e 1 e 0 .1 z 18
  • 19. Round-off Errors (Error Bounds Analysis) e z 0 .a 1 a 2  a n a n 1  , a1 0 1 ( sign ) base e exponent e ( 0 .a 1 a 2  a n ) 0 an 1 2 fl ( z ) Round down e [( 0 .a 1 a 2  a n ) ( 0 ) ] 00 ... . 01 an 1 n 2 Round up fl(z) is the rounded value of z 19
  • 20. Round-off Errors (Error Bounds Analysis) Absolute error of fl(z) When rounding down e z fl ( z ) 0 . 00  0 a n 1 a n a 2 n 3  e n 0 .a n 1 a n a 2 n 3  e n z fl ( z ) 0 .a n 1 a n a 2 n 3  1 1 e n an 1 (. a n 1 ) z fl ( z ) 2 2 2 Similarly, when rounding up 1 i.e., when an 1 z fl ( z ) e n 2 2 20
  • 21. Round-off Errors (Error Bounds Analysis) Relative error of fl(z) 1 e n z fl ( z ) 2 n z fl ( z ) 1 e z 2 z n 1 e because z (. a 1 a 2  ) 2 (. a 1 a 2  ) n 1 because (. a 1 ) ( 0 . 1) 2 (. 1) n 1 2 1 z fl ( z ) 1 1 n z 2 21
  • 22. Summary of Error Bounds Analysis Chopping Errors Round-off errors Absolute e n 1 e n z fl ( z ) z fl ( z ) 2 Relative z fl ( z ) 1 n z fl ( z ) 1 1 n z z 2 β base n # of significant digits or # of digits in the mantissa Regardless of chopping or round-off is used to round the numbers, the absolute errors may increase as the numbers grow in magnitude but the relative errors are bounded by the same magnitude. 22