Академический Документы
Профессиональный Документы
Культура Документы
Introduction
Introduction
Consider the following equations.
Numerical Methods
Course
Contents
Mathematical Modeling
Mathematical Modeling
Where:
c = drag coefficient (kg/s),
v = falling velocity (m/s)
At rest: (v = 0 at t = 0),
Calculus can be used to solve the equation
Suppose
Terms
Errors are mainly associated with calculations
and measurements
Accuracy: How closely a computed value or
measured value agrees with true value
Precision: How individual computed values or
measured values agree with one another.
Inaccuracy is also called bias
Imprecision is also called uncertainty
Figure 4.1
Measured Numbers
A measuring tool
is used to determine a
27
Reading a Meterstick
. l2. . . . l . . . . l3 . . . . l . . . . l4. .
cm
28
29
Learning Check
. l8. . . . l . . . . l9. . . . l . . . . l10. . cm
What is the length of the orange line?
1) 9.0 cm
2) 9.04 cm
3) 9.05 cm
30
Solution
. l8. . . . l . . . . l9. . . . l . . . . l10. . cm
The length of the orange line could be reported as
2) 9.04 cm
or
3) 9.05 cm
31
Significant Figures in
Measured Numbers
Significant Figures
33
Significant Figures
34
Measurement
38.15 cm
5.6 ft
65.6 lb
122.55 m
Number of
Significant Figures
4
2
3
5
35
Sandwiched Zeros
Sandwiched Zeros
occur between nonzero numbers.
are significant.
Measurement
50.8 mm
2001 min
0.0702 lb
0.405 05 m
Number of
Significant Figures
3
4
3
5
36
Trailing Zeros
Trailing Zeros
follow nonzero numbers in numbers without decimal
points.
are usually placeholders.
are not significant.
Number of
Measurement
Significant Figures
25 000 cm
2
200 kg
1
48 600 mL
3
25 005 000 g
5
37
Leading Zeros
Leading Zeros
precede nonzero digits in a decimal number.
are not significant.
Measurement
0.008 mm
0.0156 oz
0.0042 lb
0.000 262 mL
Number of
Significant Figures
1
3
2
3
38
Learning Check
State the number of significant figures in each of the
following measurements.
A. 0.030 m
B.
C.
D.
4.050 L
0.0008 g
2.80 m
39
Solution
State the number of significant figures in each of the
following measurements.
A.
0.030 m
B.
C.
D.
4.050 L
0.0008 g
2.80 m
4
1
3
40
Significant Figures in
Scientific Notation
In scientific notation all digits in the coefficient
including zeros are significant.
Measurement
8 x 104 m
8.0 x 104 m
8.00 x 104 m
Number of
Significant Figures
1
2
3
41
42
Learning Check
A. Which answer(s) contain 3 significant figures?
1) 0.4760 2) 0.00476
3) 4.76 x 103
B. All the zeros are significant in
1) 0.00307.
2) 25.300.
3) 2.050 x 103.
43
Solution
A. Which answer(s) contain 3 significant figures?
2) 0.00476
3) 4.76 x 103
3) 2.050 x 103.
44
Learning Check
In which set(s) do both numbers contain the same
number of significant figures?
1) 22.0 and 22.00
2) 400.0 and 40
3) 0.000 015 and 150 000
45
Solution
In which set(s) do both numbers contain the same
number of significant figures?
3) 0.000 015 and 150 000
Both numbers contain 2 significant figures.
46
Exact Numbers
48
Learning Check
49
Solution
50
Learning Check
Classify each of the following as (1) exact or (2) measured
numbers.
A.__Gold melts at 1064 C.
B.__1 yard = 3 feet
51
Solution
Classify each of the following as (1) exact or (2) measured
numbers.
A. 2 A measuring tool is required.
B. 1 This is a defined relationship.
52
Number Representation
Do machines represent integers and floatingpoint numbers using the same
representation?
How does computer represent integers?
Representation of Integers
13 as 8-bit unsigned integers (no negative #)
1310 = 000011012
= 0 x 27 + 1 x 26 + 0 x 25 + 0 x 24 +
1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
=8+4+0+1
54
Exercise
What is the equivalent decimal number
represented by the following binary number?
1101012 = ?
55
15678
Normalized Representation
(and notations used in this course)
z (0.a1a2 a3 ...) e
m e
is the sign
is the base, e is the exponent
binary : =2
decimal : =10
1/ m < 1
(i.e., a1 0)
57
58
( Normalized form)
Mantissa (a)
Exercise
What is the normalized floating-point
representation of 12.7510 (for = 2)?
What is the normalized floating-point
representation of 2.210 (for = 2)?
61
Exercise
Consider the following floating-point representation
The mantissa has only 3 bits
z (0.a1a2a3 ) 2 2e
Exponent, e, ranges from -4 to 4
62
Sign
(0=+ve,
1 = -ve)
Exponent
Single
precision
(float)
32 bits
1 bit
8 bits
(-126 to
+127)
127
23 bits
double
precision
(double)
64 bits
1 bit
11 bits
(-1022 to
+1023)
1023
52 bits
64
Excercise
Suppose x = 3.141592658979323
Show the value of x up to 4 significant digits.
Show the value of x up to 10 significant digits.
67
Chapter 3
70
Significant Figures
Significant figures of a number are those that can be used
with confidence.
Significant Figures
Scientific Notation
If it is not clear how many, if any, of zeros are significant. This
problem can be solved by using the scientific notation
0.0013 = 1.3*10-3
0.00130 = 1.30*10-3
2 sig. figures
3 sig. figures
Error Definition
Numerical errors arise from the use of approximations
Errors
Truncation errors
Result when
approximations are used
to represent exact
mathematical procedure.
Round-off errors
Result when numbers
having limited significant
figures are used to
represent exact numbers.
Round-off Errors
Numbers such as p, e, or 7 cannot be expressed by
a fixed number of significant figures.
Computers use a base-2 representation, they cannot
precisely represent certain exact base-10 numbers
Fractional quantities are typically represented in
computer using floating point form, e.g.,
Example:
p = 3.14159265358 to be stored carrying 7 significant digits.
p = 3.141592 chopping
p = 3.141593 rounding
Truncation Errors
Truncation errors are those that result using
approximation in place of an exact mathematical
procedure.
dv v V t i 1 V t i
dt t
t i 1 t i
True Error
True error (Et)
True error (Et) or Exact value of error
= true value approximated value
True percent relative error ( t
True percent relative error t
True error
100 (%)
True value
true value approximated value
100 (%)
true value
Example 3.1
Example 3.1
Approximate Error
The true error is known only when we deal with functions that
can be solved analytically.
In many applications, a prior true value is rarely available.
For this situation, an alternative is to calculate an
approximation of the error using the best available estimate of
the true value as:
a Approximate percent relative error
Approximate error
100 (%)
approximation
Approximate Error
In many numerical methods a present approximation is
calculated using previous approximation:
present approximation previous approximation
a
100 (%)
present approximation
Note:
- The sign of
may be positive or negative
a t or
- We interested in whether the absolute value is lower
than a prespecified tolerance (s), not to the sign of error.
Thus, the computation is repeated until (stopping criteria):
a s
Prespecified Error
We can relate (s) to the number of significant
figures in the approximation,
So, we can assure that the result is correct to at
least n significant figures if the following criteria
is met:
s (0.5 10
See Example 3.2 p56
2 n
) %
Example
The exponential function can be computed using Maclaurin
series as follows:
2
3
n
e x 1 x
x
x
2! 3!
x
n!
Estimate e0.5 using series, add terms until the absolute value of
approximate error a fall below a pre-specified error s
conforming with three significant figures.
{The exact value of e0.5=1.648721}
Solution
s 0.5 1023 % 0.05%