t 1 mathematical-modeling
TRANSCRIPT
-
8/10/2019 t 1 Mathematical-Modeling
1/84
Motilal Nehru National Institute of Technology
Civil Engineering Department
Computer Based Numerical Techniques
CE-401
Introduction
-
8/10/2019 t 1 Mathematical-Modeling
2/84
Introduction
Consider the following equations.
-
8/10/2019 t 1 Mathematical-Modeling
3/84
Numerical Methods - Definitions
-
8/10/2019 t 1 Mathematical-Modeling
4/84
Numerical Methods
-
8/10/2019 t 1 Mathematical-Modeling
5/84
-
8/10/2019 t 1 Mathematical-Modeling
6/84
Analytical vs. Numerical methods
-
8/10/2019 t 1 Mathematical-Modeling
7/84
Mathematician and Engineer
-
8/10/2019 t 1 Mathematical-Modeling
8/84
Reasons to study numerical Analysis
Powerful problem solving techniques and can be
used to handle large systems of equations
It enables you to intelligently use the commercial
software packages as well as designing your ownalgorithm.
Numerical Methods are efficient vehicles in learning
to use computers
It Reinforce your understanding of mathematics;
where it reduces higher mathematics to basic
arithmetic operation.
-
8/10/2019 t 1 Mathematical-Modeling
9/84
Course
Contents
-
8/10/2019 t 1 Mathematical-Modeling
10/84
Motilal Nehru National Institute of Technology
Civil Engineering Department
Computer Based Numerical Techniques
CE-401
Mathematical Modeling
-
8/10/2019 t 1 Mathematical-Modeling
11/84
Chapter 1: Mathematical Modeling
Mathematical Model
A formulation or equation that expresses the essential
features of a physical system or process in mathematical
terms. Generally, it can be represented as a functional
relationship of the form
-
8/10/2019 t 1 Mathematical-Modeling
12/84
Mathematical Modeling
-
8/10/2019 t 1 Mathematical-Modeling
13/84
Simple Mathematical Model
Example: Newtons Second Law
(The time rate of change of momentum of a body is
equal to the resultant force acting on it)
a = acceleration (m/s2) .the dependent variable
m = mass of the object (kg) .the parameterrepresenting a property of the system.
f = forceacting on the body (N)
-
8/10/2019 t 1 Mathematical-Modeling
14/84
-
8/10/2019 t 1 Mathematical-Modeling
15/84
Complex Mathematical Model
Example: Newtons Second Law
Where:
c = drag coefficient (kg/s),
v = falling velocity (m/s)
-
8/10/2019 t 1 Mathematical-Modeling
16/84
Complex Mathematical Model
At rest: (v = 0 at t = 0),
Calculus can be used to solve the equation
-
8/10/2019 t 1 Mathematical-Modeling
17/84
-
8/10/2019 t 1 Mathematical-Modeling
18/84
Analytical solution to Newton's Second Law
-
8/10/2019 t 1 Mathematical-Modeling
19/84
Analytical solution to Newton's Second Law
-
8/10/2019 t 1 Mathematical-Modeling
20/84
Numerical Solution to Newton's Second Law
Numerical solution: approximates the exactsolution by arithmetic operations.
Suppose
-
8/10/2019 t 1 Mathematical-Modeling
21/84
-
8/10/2019 t 1 Mathematical-Modeling
22/84
Numerical Solution to Newton's Second Law
.
-
8/10/2019 t 1 Mathematical-Modeling
23/84
Comparison between Analytical vs. Numerical Solution
-
8/10/2019 t 1 Mathematical-Modeling
24/84
Motilal Nehru National Institute of Technology
Civil Engineering Department
Computer Based Numerical Techniques
CE-401
Accuracy and Errors
-
8/10/2019 t 1 Mathematical-Modeling
25/84
-
8/10/2019 t 1 Mathematical-Modeling
26/84
Figure 4.1
-
8/10/2019 t 1 Mathematical-Modeling
27/84
27
Measured Numbers
A measuring tool
is used to determine aquantity such as height
or the mass of an
object.
provides numbers for ameasurement called
measured numbers.Copyright 2009 by Pearson Education, Inc.
-
8/10/2019 t 1 Mathematical-Modeling
28/84
28
. l2. . . . l . . . . l3. . . . l . . . . l4. . cm
The markings on the meterstick at the end of the orangeline are read as:
the first digit 2
plus the second digit 2.7
The last digit is obtained by estimating.
The end of the line may beestimated between 2.72.8 ashalf way (0.5) or a little more (0.6), which gives a reportedlength of 2.75cm or 2.76cm.
Reading a Meterstick
-
8/10/2019 t 1 Mathematical-Modeling
29/84
29
Known & Estimated Digits
If the length is reported as 2.76 cm,
the digits 2 and 7 are certain (known).
the final digit, 6, is estimated (uncertain). all three digits (2, 7, and 6) are significant, including the
estimated digit.
-
8/10/2019 t 1 Mathematical-Modeling
30/84
-
8/10/2019 t 1 Mathematical-Modeling
31/84
31
. 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
The estimated digit may be slightly different. Both readingsare acceptable.
Solution
-
8/10/2019 t 1 Mathematical-Modeling
32/84
32
. l3. . . . l . . . . l4. . . . l . . . . l5. . cm
For this measurement, the first and second known digitsare 4 and 5.
When a measurement ends on a mark, the estimated digit
in the hundredths place is 0.
This measurement is reported as 4.50 cm.
Zero as a Measured Number
-
8/10/2019 t 1 Mathematical-Modeling
33/84
33
Significant Figures in
Measured Numbers
Significant Figures
obtained from a measurement include all of
the known digitsplusthe estimated digit. reported in a measurement depend on the
measuring tool.
-
8/10/2019 t 1 Mathematical-Modeling
34/84
34
Significant Figures
-
8/10/2019 t 1 Mathematical-Modeling
35/84
35
All nonzero numbersin a measured number aresignificant.
Number of
Measurement Significant Figures38.15 cm 4
5.6 ft 2
65.6 lb 3
122.55 m 5
Counting Significant Figures
-
8/10/2019 t 1 Mathematical-Modeling
36/84
36
Sandwiched Zeros
occur between nonzero numbers.
are significant.
Number of
Measurement Significant Figures
50.8 mm 3
2001 min 4
0.0702 lb 3
0.405 05 m 5
Sandwiched Zeros
-
8/10/2019 t 1 Mathematical-Modeling
37/84
37
Trailing Zeros
follow nonzero numbers in numbers without decimalpoints.
are usually placeholders.
are not significant.
Number of
Measurement Significant Figures
25 000cm 2
200kg 148 600mL 3
25 005 000g 5
Trailing Zeros
-
8/10/2019 t 1 Mathematical-Modeling
38/84
38
Leading Zeros precede nonzero digits in a decimal number.
are not significant.
Number ofMeasurement Significant Figures
0.008mm 1
0.0156 oz 3
0.0042 lb 20.000 262 mL 3
Leading Zeros
-
8/10/2019 t 1 Mathematical-Modeling
39/84
39
State the number of significant figures in each of thefollowing measurements.
A. 0.030 mB. 4.050 L
C. 0.0008 g
D. 2.80 m
Learning Check
-
8/10/2019 t 1 Mathematical-Modeling
40/84
-
8/10/2019 t 1 Mathematical-Modeling
41/84
41
Significant Figures in
Scientific Notation
In scientific notation all digits in the coefficient
including zeros are significant.
Number of
Measurement Significant Figures8 x 104 m 1
8.0 x 104m 2
8.00 x 104m 3
-
8/10/2019 t 1 Mathematical-Modeling
42/84
42
Study Tip: Significant Figures
The significant figures in a measured number are
all the nonzero numbers.
12.56 m 4 significant figures
zeros between nonzero numbers.4.05 g 3 significant figures
zeros that follow nonzero numbers in a decimalnumber.
25.800 L 5 significant figures
-
8/10/2019 t 1 Mathematical-Modeling
43/84
-
8/10/2019 t 1 Mathematical-Modeling
44/84
44
A. Which answer(s) contain 3 significant figures?
2) 0.00476 3) 4.76 x 103
B. All the zeros are significant in
2) 25.300. 3) 2.050 x 103.
C. The number of significant figures in 5.80 x 102 is
3) three (3).
Solution
-
8/10/2019 t 1 Mathematical-Modeling
45/84
45
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
Learning Check
-
8/10/2019 t 1 Mathematical-Modeling
46/84
46
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.
-
8/10/2019 t 1 Mathematical-Modeling
47/84
47
Examples of Exact Numbers
An exact numberis obtained
when objects are counted.
Counted objects
2 soccer balls4 pizzas
from numbers in a defined relationship.
Defined relationships
1 foot = 12 inches
1 meter = 100 cm
-
8/10/2019 t 1 Mathematical-Modeling
48/84
-
8/10/2019 t 1 Mathematical-Modeling
49/84
49
Learning Check
A. Exact numbers are obtained by
1. using a measuring tool.
2. counting.
3. definition.
B. Measured numbers are obtained by
1. using a measuring tool.
2. counting.3. definition.
-
8/10/2019 t 1 Mathematical-Modeling
50/84
50
Solution
A. Exact numbers are obtained by
2. counting.
3. definition.
B. Measured numbers are obtained by
1. using a measuring tool.
-
8/10/2019 t 1 Mathematical-Modeling
51/84
51
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
C.__The diameter of a red blood cell is 6 x 10-4 cm.
D.__There are 6 hats on the shelf.
E.__A can of soda contains 355 mL of soda.
-
8/10/2019 t 1 Mathematical-Modeling
52/84
-
8/10/2019 t 1 Mathematical-Modeling
53/84
53
Number Representation
Do machines represent integers and floating-
point numbers using the same
representation?
How does computer represent integers?
How does computer represent floating-point
numbers?
-
8/10/2019 t 1 Mathematical-Modeling
54/84
54
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
-
8/10/2019 t 1 Mathematical-Modeling
55/84
55
Exercise
What is the equivalent decimal number
represented by the following binary number?
1101012= ?
-
8/10/2019 t 1 Mathematical-Modeling
56/84
56
Representation of Floating-point Numbers
156.78 = 0.15678 x 103
in an "imaginary" base-10 floating-point system
3 15678+
N li d R t ti
-
8/10/2019 t 1 Mathematical-Modeling
57/84
57
Normalized Representation
(and notations used in this course)
is the sign is the base, e is the exponent
binary : =2
decimal : =10
1/ m < 1 (i.e., a1 0) binary: 0.5 m < 1
decimal: 0.1 m < 1
e
e
m
aaaz
...).0( 321
i f l i i b
-
8/10/2019 t 1 Mathematical-Modeling
58/84
58
Representation of Floating-point Numbers
form)Normalized(2)1101101.0()(
)101.1101(
212021
21202121625.13
4
2
2
321
0123
Sign Signed exponent (e) Mantissa (a)
-
8/10/2019 t 1 Mathematical-Modeling
59/84
59
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)?
What is the equivalent decimal value of
(0.110111)2x 23 ?
-
8/10/2019 t 1 Mathematical-Modeling
60/84
60
There are discrete points
on the number lines that
can be represented by our
computer.How about the space
between ?
-
8/10/2019 t 1 Mathematical-Modeling
61/84
-
8/10/2019 t 1 Mathematical-Modeling
62/84
62
Exercise
Consider the following floating-point representation The mantissa has only 3 bits
Exponent, e, ranges from -4 to 4
Can you give an integer that cannot be representedby this representation?
Can you give an integer between 0 and 14 thatcannot be represented by this representation?
eaaaz 2).0( 2321
-
8/10/2019 t 1 Mathematical-Modeling
63/84
-
8/10/2019 t 1 Mathematical-Modeling
64/84
64
Note on IEEE 754 Representation
Exponents of all 0's and 1's are reserved for specialnumbers.
Zero is a special value denoted with an exponentfield of zero and a mantissa field of zero, and we
could have +0 and -0.
+ an - are denoted with an exponent of all 1'sand a mantissa field of all 0's.
NaN (Not-a-number) is denoted with an exponent ofall 1's and a non-zero mantissa field.
-
8/10/2019 t 1 Mathematical-Modeling
65/84
65
Errors and Significant Digits
I paid $10 for 7 oranges. What is unit price of
each orange?
Rs. 1.528571429(that is the exact output from
my computer !!)
Is there any difference between
Rs. 1.527571429 and Rs. 1.5?
Is there any difference between Rs. 1.5 and
Rs. 1.50?
-
8/10/2019 t 1 Mathematical-Modeling
66/84
66
Significant figures, or digits
The significant digits of a number are thosethat can be used with confidence.
They correspond to the number of certain
digits plus one estimated digits.
x = 3.5(2 significant digits)3.45 x < 3.55
x = 0.51234(5 significant digits)
0.512335 x < 0.512345
-
8/10/2019 t 1 Mathematical-Modeling
67/84
67
Excercise
Supposex = 3.141592658979323
Show the value ofxup to 4 significant digits.
Show the value ofxup to 10 significant digits.
Calculate 22/7 up to 5 significant digits.
-
8/10/2019 t 1 Mathematical-Modeling
68/84
Motilal Nehru National Institute of Technology
Civil Engineering Department
Computer Based Numerical Techniques
CE-401
Approximations and Errors
-
8/10/2019 t 1 Mathematical-Modeling
69/84
Approximations and Errors
The major advantage of numerical analysis is thata numerical answer can be obtained even when a
problem has no analytical solution.
Although the numerical technique yielded close
estimates to the exact analytical solutions, there
are errors because the numerical methods involveapproximations.
A i ti d R d Off E
-
8/10/2019 t 1 Mathematical-Modeling
70/84
by Lale Yurttas, Texas A&M
University Chapter 3 70
Approximations and Round-Off ErrorsChapter 3
For many engineering problems, we cannot obtain analyticalsolutions.
Numerical methods yield approximate results, results that areclose to the exact analytical solution. Only rarely given data are exact, since they originate from
measurements. Therefore there is probably error in the inputinformation.
Algorithm itself usually introduces errors as well, e.g., unavoidableround-offs, etc
The output information will then contain error from both of thesesources.
How confident we are in our approximate result? The question is how much error is present in our calculation
and is it tolerable?
-
8/10/2019 t 1 Mathematical-Modeling
71/84
-
8/10/2019 t 1 Mathematical-Modeling
72/84
Significant Figures
Significant figuresof a number are those that can be used
with confidence.
Rules for identifying sig. figures:
All non-zero digits are considered significant. For example, 91has two significant digits (9 and 1), while 123.45 has fivesignificant digits (1, 2, 3, 4 and 5).
Zeros appearing anywhere between two non-zero digits aresignificant. Example: 101.12 has five significant digits.
Leading zeros are not significant. For example, 0.00052 has
two significant digits Trailing zeros are generally considered as significant. For
example, 12.2300 has six significant digits.
-
8/10/2019 t 1 Mathematical-Modeling
73/84
-
8/10/2019 t 1 Mathematical-Modeling
74/84
Error Definition
Numerical errors arise from the use of approximations
Truncation errors Round-off errors
Errors
Result when
approximations are usedto represent exact
mathematical procedure.
Result when numbers
having limited significantfigures are used to
represent exact numbers.
-
8/10/2019 t 1 Mathematical-Modeling
75/84
Round-off Errors
Numbers such as p, e, or cannot be expressed bya 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
7
-
8/10/2019 t 1 Mathematical-Modeling
76/84
Truncation Errors
Truncation errors are those that result using
approximation in place of an exact mathematical
procedure.
1
1
i i
i i
V t V t dv v
dt t t t
-
8/10/2019 t 1 Mathematical-Modeling
77/84
True Error
t
True error (Et) or Exact value of error
= true valueapproximated value
True error (Et)
True percent relative error ( )
(%)100
(%)100
valuetruevalueedapproximatvaluetrue
valueTrue
errorTrueerrorrelativepercentTrue t
See Example 3.1P 54
-
8/10/2019 t 1 Mathematical-Modeling
78/84
Example 3.1
l
-
8/10/2019 t 1 Mathematical-Modeling
79/84
Example 3.1
-
8/10/2019 t 1 Mathematical-Modeling
80/84
Approximate Error
The true error is known only when we deal with functions thatcan 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 errorusing the best available estimate ofthe true value as:
(%)100 ionapproximat
erroreApproximat
errorrelativepercenteApproximata
-
8/10/2019 t 1 Mathematical-Modeling
81/84
Approximate Error
In many numerical methods a present approximation iscalculated using previous approximation:
a t
(%)100
ionapproximatpresent
ionapproximatpreviousionapproximatpresenta
Note:
- The sign of or may be positive or negative
- 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):
sa
-
8/10/2019 t 1 Mathematical-Modeling
82/84
Prespecified Error
We can relate (s) to the number of significantfigures in the approximation,
So, we can assure that the result is correct to atleast nsignificant figures if the following criteriais met:
See Example 3.2 p56
%)105.0( 2 n
s
-
8/10/2019 t 1 Mathematical-Modeling
83/84
-
8/10/2019 t 1 Mathematical-Modeling
84/84