SlideShare a Scribd company logo
Introduction to
Numerical
Methods
Numerical Methods (ME 212)
Author: Dr. Shoeb Ahmed Syed
Papua New Guinea University of Technology
Department of Mechanical Engineering
1
Sources of Error
Two sources of numerical error
1)
2)
Round off error
Truncation error
3
Round-off Error
4
Round off Error
• Caused by representing
approximately
a number
1
3
 0.333333
1.4142...
2
5
GET THESE RULES FOR ROUNDING OFF
NUMBERS
CASE 1:
In rounding off numbers, the last figure kept should be unchanged if the
first figure dropped is less than 5. For example, if only one decimal is
to be kept, then 6.422 becomes 6.4.
CASE 2:
In rounding off numbers, the last figure kept should be increased by 1 if
the first figure dropped is greater than 5. For example, if only two
decimals are to be kept, then 6.4872 becomes 6.49. Similarly, 6.997
becomes 7.00.
CASE 3:
In rounding off numbers, if the first figure dropped is 5, and all the figures
following the five are zero or if there are no figures after the 5, then the
last figure kept should be unchanged if that last figure is even. For
example, if only one decimal is to be kept, then 6.6500 becomes 6.6.
For example, if only two decimals are to be kept, then 7.485 becomes
GET THESE RULES FOR ROUNDING OFF
NUMBERS
CASE 4:
In rounding off numbers, if the first figure dropped is 5, and all the figures
following the five are zero or if there are no figures after the 5, then the
last figure kept should be increased by 1 if that last figure is odd. For
example, if only two decimals are to be kept, then 6.755000 becomes
6.76.
For example, if only two decimals are to be kept, 8.995 becomes 9.00.
CASE 5:
In rounding off numbers, if the first figure dropped is 5, and there are any
figures following the five that are not zero, then the last figure kept
should be increased by 1. For example, if only one decimal is to be
kept, then 6.6501 becomes 6.7.
For example, if only two decimals are to be kept, then 7.4852007
becomes 7.49.
Problems created by round off error
• 28 Americans were killed on February 25,
1991 by an Iraqi Scud missile in Dhahran,
Saudi Arabia.
• The
and
patriot defense system failed to track
intercept the Scud. Why?
6
Problem with Patriot missile
• Clock cycle of 1/10 seconds was
represented in 24-bit fixed point
register created an error of 9.5 x
10-8 seconds.
• The battery was on for 100
consecutive hours, thus causing
an inaccuracy of
s 3600s
1hr
= 9.5 10−8
= 0.342s
100hr 
0.1s
7
Problem (cont.)
The shift calculated in the ranging system
of the missile was 687 meters.
•
• The target was considered to be out of
137
range at
meters.
a distance greater than
8
Some disasters caused by
numerical errors?
➢ Explosion of the Ariane 5
➢ EURO page: Conversion Arithmetic's
➢ The Vancouver Stock Exchange
➢ Rounding error changes Parliament makeup
Explosion of the Ariane 5
Explosion of the Ariane 5
EURO page: Conversion
Arithmetic's
EURO page: Conversion
Arithmetic's
The Vancouver Stock Exchange
Rounding error changes
Parliament makeup
Rounding error changes
Parliament makeup
Effect of Carrying Significant
Digits in Calculations
9
RULES FOR SIGNIFICANT FIGURES
1. All non-zero numbers ARE significant. The number 33.2 has THREE significant figures
because all of the digits present are non-zero.
2. Zeros between two non-zero digits ARE significant. 2051 has FOUR significant figures.
The zero is between a 2 and a 5.
3. Leading zeros are NOT significant. They're nothing more than "place holders." The
number 0.54 has only TWO significant figures. 0.0032 also has TWO significant figures.
All of the zeros are leading.
4. Trailing zeros to the right of the decimal ARE significant. There are FOUR significant
figures in 92.00.
92.00 is different from 92: a scientist who measures 92.00 milliliters knows his value to
the nearest 1/100th milliliter; meanwhile his colleague who measured 92 milliliters only
knows his value to the nearest 1 milliliter. It's important to understand that "zero" does
not mean "nothing." Zero denotes actual information, just like any other number. You
cannot tag on zeros that aren't certain to belong there.
RULES FOR SIGNIFICANT FIGURES
5. Trailing zeros in a whole number with the decimal shown ARE significant. Placing a
decimal at the end of a number is usually not done. By convention, however, this
decimal indicates a significant zero. For example, "540." indicates that the trailing zero IS
significant; there are THREE significant figures in this value.
6. Trailing zeros in a whole number with no decimal shown are NOT significant. Writing
just "540" indicates that the zero is NOT significant, and there are only TWO significant
figures in this value.
7. Exact numbers have an INFINITE number of significant figures. This rule applies to
numbers that are definitions. For example, 1 meter = 1.00 meters = 1.0000 meters =
1.0000000000000000000 meters, etc.
8. For a number in scientific notation: N x 10x, all digits comprising N ARE significant by
the first 6 rules; "10" and "x" are NOT significant. 5.02 x 104 has THREE significant
figures: "5.02." "10 and "4" are not significant.
Rule 8 provides the opportunity to change the number of significant figures in a value by
manipulating its form. For example, let's try writing 1100 with THREE significant figures.
By rule 6, 1100 has TWO significant figures; its two trailing zeros are not significant. If we
add a decimal to the end, we have 1100., with FOUR significant figures (by rule 5.) But
by writing it in scientific notation: 1.10 x 103, we create a THREE-significant-figure value.
Dr.Shoeb_ME212_Lec-2-NUMERICAL METHODS_g
Truncation error
• Error caused by truncating or
mathematical
approximating
procedure.
a
Example of Truncation Error
T
aking only a few terms of a Maclaurin series to
e x
approximate
2 3
x x
ex
=1+ x + + +....................
2! 3!
If only 3 terms are used,
x2
 
x
Error = e −1+ x +



Truncation
2!
Another Example of Truncation
Error
f (x)
x
Using a finite to approximate
f (x +x) −f (x)
f (x) 
x
P
ine
Figure 1. Approximate derivative using finite Δx
secant line
tangent l
Q
Another Example of Truncation
Error
Using finite
integral.
rectangles to approximate an
y
90
y = x 2
60
30
0 x
0 1.5 3 4.5 6 7.5 9 10.5 12
Example 1 —Maclaurin series
e1.2
Calculate the value of with an absolute
relative approximate error of less than 1%.
2 3
= 1 + 1.2 +
1.2
+
1.2
e1.2
+ ...................
2! 3!
6 terms are required. How many are required to get
at least 1 significant digit correct in your answer?
n
e1.2
Ea
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
Example 2 —Differentiation
f (x +x) −f (x)
x2
f (x) =
f (3)
Find
and
for using f (x) 
x
x = 0.2
f (3 +0.2) −f (3)
f '
(3) =
0.2
f (3.2) −f (3) 2 2
3.2 −3 10.24 −9 1.24
0.2
=
= 6.2
= =
=
0.2 0.2 0.2
The actual value is
f '
(x) = 2x, f '
(3) = 2 3 = 6
Truncation error is then, 6 − 6.2 = −0.2
Can you find the truncation error with x = 0.1
Example 3 — Integration
Use two rectangles of equal width to
approximate the area under the curve for
over the interval [3,9]
x2
(x) =
f
9

3
x2
dx
y
90
y = x 2
60
30
0 x
0 3 6 9 12
Integration example (cont.)
Choosing a width of 3, we have
9
x2
dx = (x 2
) (6 − 3) + (x2
)

3
(9 − 6)
x=3 x=6
= (32
)3 + (62
)3
= 27 +108 =135
Actual value is given by
9
 x3

9

93
− 33

x2
dx = = = 234
   

3 3
 3

3
Truncation error is then
234 −135 = 99
Can you find the truncation error with 4 rectangles
26
?
Propagation of Errors
Propagation of Errors
In numerical methods, the calculations are not
made with exact numbers. How do these
inaccuracies propagate through the calculations?
Example 1:
Find the bounds for the propagation in adding two
if one is calculating X +Y where
X = 1.5 0.05
Y = 3.4 0.04
Solution
numbers. For example
Maximum possible value of X 1.55 and Y = 3.44
=
Maximum possible value of X Y = 1.55 + 3.44 = 4.99
+
possible value of X = 1.45 and Y = 3.36.
Minimum
possible value of X + Y = 1.45 + 3.36 = 4.81
Minimum
Hence
4.81 ≤ X + Y ≤4.99.
Propagation of Errors In Formulas
If f is a function of several variables
possible value of
X1 , X 2 , X 3 ,.......,X n−1 ,
is
X n
then the maximum the error in f
∂f ∂f ∂f ∂f
∆f ≈ ∆X1 + ∆X 2 +.......+ ∆X n−1 + ∆X n
∂X1 ∂X 2 ∂X n−1 ∂X n
Example 2:
square
The strain in an axial member
section is given by
of a cross-
F
∈=
Given
h2
E
F = 72 ± 0.9 N
h = 4 ± 0.1 mm
E = 70 ±1.5 GPa
Find the maximum possible
strain.
error in the measured
Example 2:
Solution
72
∈=
(4×10−3
)2
(70×109
)
64.286 ×10−6
64.286µ
=
=
∂∈ ∂∈ ∂∈
∆ ∈= ∆F + ∆h + ∆E
∂F ∂h ∂E
Example 2:
∂∈ 1 ∂∈ ∂∈
−
F
−
2F
= =
=
h2
E
∂F
Thus
∆E
h2
E 2
h3
E ∂E
∂h
1
∆F
2F
∆h
F
∆E
= + +
h2
E h3
E h2
E2
2×72
×0.0001
1
×0.9
= +
(4×10−3
)2
(70×109
) (4×10−3
)3
(70×109
)
72
×1.5×109
+
(4×10−3
)2
(70×109
)2
= 5.3955µ
Hence
∈= (64.286µ ± 5.3955µ)
Example 3:
Subtraction of numbers that are nearly equal can create unwanted
inaccuracies. Using the formula for error propagation, show that this is true.
Solution
Let
z = x − y
Then ∂z
∆z = ∆x + ∆y
∂x
=
=
(1)∆x +
∆y
(−1)∆y
∆x +
So the relative change is
∆x +∆y
∆z
z
=
x − y
∂z
∂y
(−
Example 3:
For example if
x = 2 ± 0.001
y = 2.003 ± 0.001
0.001 + 0.001
∆z
z
=
| 2 − 2.003 |
0.6667
66.67%
=
=
Measuring Errors
Why measure errors?
1) To determine the accuracy of
numerical results.
2) To develop stopping criteria for
iterative algorithms.
True Error
◼ Defined as the difference between the true
value in a calculation and the approximate
value found using a numerical method etc.
True Error = True Value – Approximate Value
Example—True Error
can be
f ′(x)
The derivative, of a function f (x)
approximated by the equation,
f (x +h) −f (x)
f '(x) ≈
h
h = 0.3
and
7e0.5x
f (x) =
a)
b)
c)
If
Find the approximate value of f '(2)
True
True
value of
error for
f '(2)
part (a)
Example (cont.)
Solution:
a) For and
x = 2 h = 0.3
f (2 +0.3) −f (2)
f '(2) ≈
0.3
f (2.3) −f (2)
=
0.3
7e0.5(2.3)
− 7e0.5(2)
=
0.3
22.107 −19.028
= 10.263
=
0.3
Example (cont.)
Solution:
b) The exact value of can be found by using
f '(2)
our knowledge of differential calculus.
7e0.5 x
f (x) =
f ' ( x) = 7 × 0.5 × e0.5x
3.5e0.5x
=
So the true value of is
f '(2)
3.5e0.5(2)
f '(2) =
= 9.5140
True error is calculated as
Et = True Value – Approximate Value
= 9.5140 −10.263 = −0.722
Relative True Error
◼ Defined as the ratio between the true
error, and the true value.
True Error
∈t ) =
Relative True Error (
True Value
Example—Relative True Error
Following from the previous example for true error
,
find the relative true error for at f '(2)
7e0.5 x
f (x) =
with h = 0.3
From the previous example,
Et = −0.722
Relative True Error is defined as
True Error
∈ =
t
True Value
−0.722
= = −0.075888
9.5140
as a percentage,
∈t = −0.075888×100% = −7.5888%
Approximate Error
◼ What can be done
known or are very
◼ Approximate error
if true values are not
difficult to obtain?
is defined as the
difference between the present
approximation and the previous
approximation.
Approximate Error ( Ea ) = Present Approximation – Previous Approximation
Example—Approximate Error
For at find the following,
x = 2
7e0.5x
f (x) =
f ′(2)
f ′(2)
a)
b)
c)
using
using
h = 0.3
h = 0.15
f ′(2)
approximate error for the value of for part b)
Solution:
a) For and
x = 2 h = 0.3
f (x +h) −f (x)
f '(x) ≈
h
f (2 +0.3) −f (2)
f '(2) ≈
0.3
Example
Solution: (cont.)
f (2.3) −f (2)
(cont.)
=
0.3
7e0.5(2.3)
− 7e0.5(2)
=
0.3
22.107 −19.028
= = 10.263
0.3
and
b) For x = 2 h = 0.15
f (2 +0.15) −f (2)
f '
(2) ≈
0.15
f (2.15) −f (2)
=
0.15
Example
Solution: (cont.)
(cont.)
7e0.5(2.15)
− 7e0.5(2)
=
0.15
20.50 −19.028
= 9.8800
=
0.15
c) So
Ea
the approximate error
, is
Ea
= Present Approximation – Previous Approximation
= 9.8800 −10.263
= −0.38300
Relative Approximate Error
◼ Defined as the ratio between the
approximate error
approximation.
(∈a)
and the present
Approximate Error
Relative Approximate Error =
Present Approximation
Example—Relative Approximate Error
7e0.5x
f (x) =
For at , find the relative approximate
x = 2
error using values from
Solution:
and
h = 0.3 h = 0.15
f ′(2) =10.263
From
using
Ea
Example 3, the approximate value of
and using
h = 0.3 h = 0.15
f ′(2) = 9.8800
= Present Approximation – Previous Approximation
= 9.8800 −10.263
= −0.38300
Example
Solution: (cont.)
Approximate Error
(cont.)
∈a =
Present Approximation
−0.38300
= −0.038765
=
9.8800
as a percentage,
∈a = −0.038765×100% = −3.8765%
Absolute relative approximate errors
be calculated,
may also need to
∈a =| −0.038765 | = 0.038765 or 3.8765
%
How is Absolute Relative Error used as
stopping criterion?
a
If where is a pre-specified tolerance, then
|∈a | ≤∈s ∈s
no further iterations are necessary and the process
stopped.
is
If at least m significant digits are required to be
correct in the final answer
, then
0.5 ×102−m
%
|∈ |≤
a
Table of Values
7e0.5x
=
f (x)
For at with varying step size,
x = 2 h
h f ′(2) ∈a m
0.3 10.263 N/A 0
0.15 9.8800 3.877% 1
0.10 9.7558 1.273% 1
0.01 9.5378 2.285% 1
0.001 9.5164 0.2249% 2
1. http://numericalmethods.eng.usf.edu
2.
http://numericalmethods.eng.usf.edu/topics/sources_of_err
or.html
3. http://numericalmethods.eng.usf.edu/topics/propagatio
n_of_errors.html
4. http://numericalmethods.eng.usf.edu/topics/measuring
_errors.html
References
THE END

More Related Content

PPT
PDF
Συνέδριο Λευκάδας 2017: Ο νόμος της εκθετικής μεταβολής στην υπηρεσία διάφορω...
PDF
Οδηγός Επανάληψης για τη Γ Λυκείου [2020]
PDF
Μαθη..μαγικα για Διαγωνισμούς (Διαγωνιστικά Μαθηματικά ,Γ γυμνασίου,Α λυκείου)
PDF
Συναρτήσεις καλοκαιρινή προετοιμασία μαθηματικά θετικών σπουδών,οικονομίας κ...
PDF
Applied numerical methods lec3
PDF
Errors in computation
PPTX
Approximation and error
Συνέδριο Λευκάδας 2017: Ο νόμος της εκθετικής μεταβολής στην υπηρεσία διάφορω...
Οδηγός Επανάληψης για τη Γ Λυκείου [2020]
Μαθη..μαγικα για Διαγωνισμούς (Διαγωνιστικά Μαθηματικά ,Γ γυμνασίου,Α λυκείου)
Συναρτήσεις καλοκαιρινή προετοιμασία μαθηματικά θετικών σπουδών,οικονομίας κ...
Applied numerical methods lec3
Errors in computation
Approximation and error

Similar to Dr.Shoeb_ME212_Lec-2-NUMERICAL METHODS_g (20)

PPTX
Approximation and error
PDF
Chapter assignment character assignemetb
PPTX
Lecture 2 - Error Analysis - Numerical Analysis
PPTX
Numerical Methods.pptx
PDF
Numerical approximation
PDF
LectureSlides3.pdf
PPTX
numerical chapter 2 numerical method and analysis.pptx
PDF
Error_Analysis.pdf
PPTX
Error Analysis.pptx
PPTX
PDF
NUMERICA METHODS 1 final touch summary for test 1
PPT
Chapter 1 Errors and Approximations.ppt
PPT
Numerical Method
PPTX
Error(Computer Oriented Numerical and Statistical Method)
PPTX
Impact of error
PDF
Errors in Numerical Analysis
PPTX
Engineering Numerical Analysis Lecture-1
PPS
Numerical approximation
Approximation and error
Chapter assignment character assignemetb
Lecture 2 - Error Analysis - Numerical Analysis
Numerical Methods.pptx
Numerical approximation
LectureSlides3.pdf
numerical chapter 2 numerical method and analysis.pptx
Error_Analysis.pdf
Error Analysis.pptx
NUMERICA METHODS 1 final touch summary for test 1
Chapter 1 Errors and Approximations.ppt
Numerical Method
Error(Computer Oriented Numerical and Statistical Method)
Impact of error
Errors in Numerical Analysis
Engineering Numerical Analysis Lecture-1
Numerical approximation
Ad

More from ShoebAhmedSyed2 (14)

PDF
Dr.Shoeb_ME212_Lec-3_numerical methods_G
PDF
Dr.Shoeb_ME212_Lec-1_numerical methods_G
PPTX
Dr.Shoeb_ME311_Lec-1_2023.pptx
PPTX
Kinematics of Machinery Digital Material_VVVVImp.pptx
PPT
lecture-1-mechanismsof HT_524.ppt
PPT
Chap01_lecture_notes.ppt
PPTX
14_LectureOutline.pptx
PPTX
Lecture-1 (CDS11).pptx
PPTX
PPTs for Online Teaching Training(1).pptx
PPTX
OEP UNITECH.pptx
PDF
PNGUNITEC3_Game-basedquizzesforZoom (1).pdf
PPT
introduction-to-linear-kinematics.ppt
PPT
48.KVikramKumar (2).ppt
PPSX
Week 01 (3).ppsx
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Dr.Shoeb_ME212_Lec-1_numerical methods_G
Dr.Shoeb_ME311_Lec-1_2023.pptx
Kinematics of Machinery Digital Material_VVVVImp.pptx
lecture-1-mechanismsof HT_524.ppt
Chap01_lecture_notes.ppt
14_LectureOutline.pptx
Lecture-1 (CDS11).pptx
PPTs for Online Teaching Training(1).pptx
OEP UNITECH.pptx
PNGUNITEC3_Game-basedquizzesforZoom (1).pdf
introduction-to-linear-kinematics.ppt
48.KVikramKumar (2).ppt
Week 01 (3).ppsx
Ad

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
communication and presentation skills 01
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PPTX
Feature types and data preprocessing steps
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
Current and future trends in Computer Vision.pptx
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PPTX
Management Information system : MIS-e-Business Systems.pptx
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Information Storage and Retrieval Techniques Unit III
PPT
Occupational Health and Safety Management System
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PDF
Design Guidelines and solutions for Plastics parts
R24 SURVEYING LAB MANUAL for civil enggi
communication and presentation skills 01
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Feature types and data preprocessing steps
distributed database system" (DDBS) is often used to refer to both the distri...
Fundamentals of Mechanical Engineering.pptx
III.4.1.2_The_Space_Environment.p pdffdf
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Current and future trends in Computer Vision.pptx
August 2025 - Top 10 Read Articles in Network Security & Its Applications
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
Management Information system : MIS-e-Business Systems.pptx
Exploratory_Data_Analysis_Fundamentals.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
Information Storage and Retrieval Techniques Unit III
Occupational Health and Safety Management System
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
Design Guidelines and solutions for Plastics parts

Dr.Shoeb_ME212_Lec-2-NUMERICAL METHODS_g

  • 1. Introduction to Numerical Methods Numerical Methods (ME 212) Author: Dr. Shoeb Ahmed Syed Papua New Guinea University of Technology Department of Mechanical Engineering 1
  • 3. Two sources of numerical error 1) 2) Round off error Truncation error 3
  • 5. Round off Error • Caused by representing approximately a number 1 3  0.333333 1.4142... 2 5
  • 6. GET THESE RULES FOR ROUNDING OFF NUMBERS CASE 1: In rounding off numbers, the last figure kept should be unchanged if the first figure dropped is less than 5. For example, if only one decimal is to be kept, then 6.422 becomes 6.4. CASE 2: In rounding off numbers, the last figure kept should be increased by 1 if the first figure dropped is greater than 5. For example, if only two decimals are to be kept, then 6.4872 becomes 6.49. Similarly, 6.997 becomes 7.00. CASE 3: In rounding off numbers, if the first figure dropped is 5, and all the figures following the five are zero or if there are no figures after the 5, then the last figure kept should be unchanged if that last figure is even. For example, if only one decimal is to be kept, then 6.6500 becomes 6.6. For example, if only two decimals are to be kept, then 7.485 becomes
  • 7. GET THESE RULES FOR ROUNDING OFF NUMBERS CASE 4: In rounding off numbers, if the first figure dropped is 5, and all the figures following the five are zero or if there are no figures after the 5, then the last figure kept should be increased by 1 if that last figure is odd. For example, if only two decimals are to be kept, then 6.755000 becomes 6.76. For example, if only two decimals are to be kept, 8.995 becomes 9.00. CASE 5: In rounding off numbers, if the first figure dropped is 5, and there are any figures following the five that are not zero, then the last figure kept should be increased by 1. For example, if only one decimal is to be kept, then 6.6501 becomes 6.7. For example, if only two decimals are to be kept, then 7.4852007 becomes 7.49.
  • 8. Problems created by round off error • 28 Americans were killed on February 25, 1991 by an Iraqi Scud missile in Dhahran, Saudi Arabia. • The and patriot defense system failed to track intercept the Scud. Why? 6
  • 9. Problem with Patriot missile • Clock cycle of 1/10 seconds was represented in 24-bit fixed point register created an error of 9.5 x 10-8 seconds. • The battery was on for 100 consecutive hours, thus causing an inaccuracy of s 3600s 1hr = 9.5 10−8 = 0.342s 100hr  0.1s 7
  • 10. Problem (cont.) The shift calculated in the ranging system of the missile was 687 meters. • • The target was considered to be out of 137 range at meters. a distance greater than 8
  • 11. Some disasters caused by numerical errors? ➢ Explosion of the Ariane 5 ➢ EURO page: Conversion Arithmetic's ➢ The Vancouver Stock Exchange ➢ Rounding error changes Parliament makeup
  • 12. Explosion of the Ariane 5
  • 13. Explosion of the Ariane 5
  • 19. Effect of Carrying Significant Digits in Calculations 9
  • 20. RULES FOR SIGNIFICANT FIGURES 1. All non-zero numbers ARE significant. The number 33.2 has THREE significant figures because all of the digits present are non-zero. 2. Zeros between two non-zero digits ARE significant. 2051 has FOUR significant figures. The zero is between a 2 and a 5. 3. Leading zeros are NOT significant. They're nothing more than "place holders." The number 0.54 has only TWO significant figures. 0.0032 also has TWO significant figures. All of the zeros are leading. 4. Trailing zeros to the right of the decimal ARE significant. There are FOUR significant figures in 92.00. 92.00 is different from 92: a scientist who measures 92.00 milliliters knows his value to the nearest 1/100th milliliter; meanwhile his colleague who measured 92 milliliters only knows his value to the nearest 1 milliliter. It's important to understand that "zero" does not mean "nothing." Zero denotes actual information, just like any other number. You cannot tag on zeros that aren't certain to belong there.
  • 21. RULES FOR SIGNIFICANT FIGURES 5. Trailing zeros in a whole number with the decimal shown ARE significant. Placing a decimal at the end of a number is usually not done. By convention, however, this decimal indicates a significant zero. For example, "540." indicates that the trailing zero IS significant; there are THREE significant figures in this value. 6. Trailing zeros in a whole number with no decimal shown are NOT significant. Writing just "540" indicates that the zero is NOT significant, and there are only TWO significant figures in this value. 7. Exact numbers have an INFINITE number of significant figures. This rule applies to numbers that are definitions. For example, 1 meter = 1.00 meters = 1.0000 meters = 1.0000000000000000000 meters, etc. 8. For a number in scientific notation: N x 10x, all digits comprising N ARE significant by the first 6 rules; "10" and "x" are NOT significant. 5.02 x 104 has THREE significant figures: "5.02." "10 and "4" are not significant. Rule 8 provides the opportunity to change the number of significant figures in a value by manipulating its form. For example, let's try writing 1100 with THREE significant figures. By rule 6, 1100 has TWO significant figures; its two trailing zeros are not significant. If we add a decimal to the end, we have 1100., with FOUR significant figures (by rule 5.) But by writing it in scientific notation: 1.10 x 103, we create a THREE-significant-figure value.
  • 23. Truncation error • Error caused by truncating or mathematical approximating procedure. a
  • 24. Example of Truncation Error T aking only a few terms of a Maclaurin series to e x approximate 2 3 x x ex =1+ x + + +.................... 2! 3! If only 3 terms are used, x2   x Error = e −1+ x +    Truncation 2!
  • 25. Another Example of Truncation Error f (x) x Using a finite to approximate f (x +x) −f (x) f (x)  x P ine Figure 1. Approximate derivative using finite Δx secant line tangent l Q
  • 26. Another Example of Truncation Error Using finite integral. rectangles to approximate an y 90 y = x 2 60 30 0 x 0 1.5 3 4.5 6 7.5 9 10.5 12
  • 27. Example 1 —Maclaurin series e1.2 Calculate the value of with an absolute relative approximate error of less than 1%. 2 3 = 1 + 1.2 + 1.2 + 1.2 e1.2 + ................... 2! 3! 6 terms are required. How many are required to get at least 1 significant digit correct in your answer? n e1.2 Ea 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
  • 28. Example 2 —Differentiation f (x +x) −f (x) x2 f (x) = f (3) Find and for using f (x)  x x = 0.2 f (3 +0.2) −f (3) f ' (3) = 0.2 f (3.2) −f (3) 2 2 3.2 −3 10.24 −9 1.24 0.2 = = 6.2 = = = 0.2 0.2 0.2 The actual value is f ' (x) = 2x, f ' (3) = 2 3 = 6 Truncation error is then, 6 − 6.2 = −0.2 Can you find the truncation error with x = 0.1
  • 29. Example 3 — Integration Use two rectangles of equal width to approximate the area under the curve for over the interval [3,9] x2 (x) = f 9  3 x2 dx y 90 y = x 2 60 30 0 x 0 3 6 9 12
  • 30. Integration example (cont.) Choosing a width of 3, we have 9 x2 dx = (x 2 ) (6 − 3) + (x2 )  3 (9 − 6) x=3 x=6 = (32 )3 + (62 )3 = 27 +108 =135 Actual value is given by 9  x3  9  93 − 33  x2 dx = = = 234      3 3  3  3 Truncation error is then 234 −135 = 99 Can you find the truncation error with 4 rectangles 26 ?
  • 32. Propagation of Errors In numerical methods, the calculations are not made with exact numbers. How do these inaccuracies propagate through the calculations?
  • 33. Example 1: Find the bounds for the propagation in adding two if one is calculating X +Y where X = 1.5 0.05 Y = 3.4 0.04 Solution numbers. For example Maximum possible value of X 1.55 and Y = 3.44 = Maximum possible value of X Y = 1.55 + 3.44 = 4.99 + possible value of X = 1.45 and Y = 3.36. Minimum possible value of X + Y = 1.45 + 3.36 = 4.81 Minimum Hence 4.81 ≤ X + Y ≤4.99.
  • 34. Propagation of Errors In Formulas If f is a function of several variables possible value of X1 , X 2 , X 3 ,.......,X n−1 , is X n then the maximum the error in f ∂f ∂f ∂f ∂f ∆f ≈ ∆X1 + ∆X 2 +.......+ ∆X n−1 + ∆X n ∂X1 ∂X 2 ∂X n−1 ∂X n
  • 35. Example 2: square The strain in an axial member section is given by of a cross- F ∈= Given h2 E F = 72 ± 0.9 N h = 4 ± 0.1 mm E = 70 ±1.5 GPa Find the maximum possible strain. error in the measured
  • 36. Example 2: Solution 72 ∈= (4×10−3 )2 (70×109 ) 64.286 ×10−6 64.286µ = = ∂∈ ∂∈ ∂∈ ∆ ∈= ∆F + ∆h + ∆E ∂F ∂h ∂E
  • 37. Example 2: ∂∈ 1 ∂∈ ∂∈ − F − 2F = = = h2 E ∂F Thus ∆E h2 E 2 h3 E ∂E ∂h 1 ∆F 2F ∆h F ∆E = + + h2 E h3 E h2 E2 2×72 ×0.0001 1 ×0.9 = + (4×10−3 )2 (70×109 ) (4×10−3 )3 (70×109 ) 72 ×1.5×109 + (4×10−3 )2 (70×109 )2 = 5.3955µ Hence ∈= (64.286µ ± 5.3955µ)
  • 38. Example 3: Subtraction of numbers that are nearly equal can create unwanted inaccuracies. Using the formula for error propagation, show that this is true. Solution Let z = x − y Then ∂z ∆z = ∆x + ∆y ∂x = = (1)∆x + ∆y (−1)∆y ∆x + So the relative change is ∆x +∆y ∆z z = x − y ∂z ∂y (−
  • 39. Example 3: For example if x = 2 ± 0.001 y = 2.003 ± 0.001 0.001 + 0.001 ∆z z = | 2 − 2.003 | 0.6667 66.67% = =
  • 41. Why measure errors? 1) To determine the accuracy of numerical results. 2) To develop stopping criteria for iterative algorithms.
  • 42. True Error ◼ Defined as the difference between the true value in a calculation and the approximate value found using a numerical method etc. True Error = True Value – Approximate Value
  • 43. Example—True Error can be f ′(x) The derivative, of a function f (x) approximated by the equation, f (x +h) −f (x) f '(x) ≈ h h = 0.3 and 7e0.5x f (x) = a) b) c) If Find the approximate value of f '(2) True True value of error for f '(2) part (a)
  • 44. Example (cont.) Solution: a) For and x = 2 h = 0.3 f (2 +0.3) −f (2) f '(2) ≈ 0.3 f (2.3) −f (2) = 0.3 7e0.5(2.3) − 7e0.5(2) = 0.3 22.107 −19.028 = 10.263 = 0.3
  • 45. Example (cont.) Solution: b) The exact value of can be found by using f '(2) our knowledge of differential calculus. 7e0.5 x f (x) = f ' ( x) = 7 × 0.5 × e0.5x 3.5e0.5x = So the true value of is f '(2) 3.5e0.5(2) f '(2) = = 9.5140 True error is calculated as Et = True Value – Approximate Value = 9.5140 −10.263 = −0.722
  • 46. Relative True Error ◼ Defined as the ratio between the true error, and the true value. True Error ∈t ) = Relative True Error ( True Value
  • 47. Example—Relative True Error Following from the previous example for true error , find the relative true error for at f '(2) 7e0.5 x f (x) = with h = 0.3 From the previous example, Et = −0.722 Relative True Error is defined as True Error ∈ = t True Value −0.722 = = −0.075888 9.5140 as a percentage, ∈t = −0.075888×100% = −7.5888%
  • 48. Approximate Error ◼ What can be done known or are very ◼ Approximate error if true values are not difficult to obtain? is defined as the difference between the present approximation and the previous approximation. Approximate Error ( Ea ) = Present Approximation – Previous Approximation
  • 49. Example—Approximate Error For at find the following, x = 2 7e0.5x f (x) = f ′(2) f ′(2) a) b) c) using using h = 0.3 h = 0.15 f ′(2) approximate error for the value of for part b) Solution: a) For and x = 2 h = 0.3 f (x +h) −f (x) f '(x) ≈ h f (2 +0.3) −f (2) f '(2) ≈ 0.3
  • 50. Example Solution: (cont.) f (2.3) −f (2) (cont.) = 0.3 7e0.5(2.3) − 7e0.5(2) = 0.3 22.107 −19.028 = = 10.263 0.3 and b) For x = 2 h = 0.15 f (2 +0.15) −f (2) f ' (2) ≈ 0.15 f (2.15) −f (2) = 0.15
  • 51. Example Solution: (cont.) (cont.) 7e0.5(2.15) − 7e0.5(2) = 0.15 20.50 −19.028 = 9.8800 = 0.15 c) So Ea the approximate error , is Ea = Present Approximation – Previous Approximation = 9.8800 −10.263 = −0.38300
  • 52. Relative Approximate Error ◼ Defined as the ratio between the approximate error approximation. (∈a) and the present Approximate Error Relative Approximate Error = Present Approximation
  • 53. Example—Relative Approximate Error 7e0.5x f (x) = For at , find the relative approximate x = 2 error using values from Solution: and h = 0.3 h = 0.15 f ′(2) =10.263 From using Ea Example 3, the approximate value of and using h = 0.3 h = 0.15 f ′(2) = 9.8800 = Present Approximation – Previous Approximation = 9.8800 −10.263 = −0.38300
  • 54. Example Solution: (cont.) Approximate Error (cont.) ∈a = Present Approximation −0.38300 = −0.038765 = 9.8800 as a percentage, ∈a = −0.038765×100% = −3.8765% Absolute relative approximate errors be calculated, may also need to ∈a =| −0.038765 | = 0.038765 or 3.8765 %
  • 55. How is Absolute Relative Error used as stopping criterion? a If where is a pre-specified tolerance, then |∈a | ≤∈s ∈s no further iterations are necessary and the process stopped. is If at least m significant digits are required to be correct in the final answer , then 0.5 ×102−m % |∈ |≤ a
  • 56. Table of Values 7e0.5x = f (x) For at with varying step size, x = 2 h h f ′(2) ∈a m 0.3 10.263 N/A 0 0.15 9.8800 3.877% 1 0.10 9.7558 1.273% 1 0.01 9.5378 2.285% 1 0.001 9.5164 0.2249% 2