Professional Documents
Culture Documents
Engineering Tools
Lecture #01
L01 F20
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Practical Information
Instructor:
Dr. Sameh Nassar, P.Eng.
snassar@ucalgary.ca
Practical Information
Required Textbook:
2nd Edition
2011
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Practical Information
Recommended Textbook:
McGraw-Hill
6th Edition
2009
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Practical Information
Course Grading:
Assignments (4 ): 20%
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Numerical Methods
Numerical
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
• Civil Engineering
Structure health monitoring……………………
• Electrical & Computer Engineering
Design of electric circuits………………………
• Biomedical & Biomechanical Engineering
Modeling of motion of joints……………………
• Mechanical Engineering
Vibration analysis……………………………………
• Chemical & Petroleum Engineering
Gas Laws, Reactors…………………………………
• Geomatics Engineering
Satellite tracking, Position determination……
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Complicated
continuous function
Tabulated function
© Sameh Nassar
Numerical integration
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
2
• The probability for a specific value x1 (area
under the curve from -∞ to x1) is obtained by
integrating the above equation. i.e.:
1
x 2
x1 1
Ρ x x 1 e 22
dx
2
© Sameh Nassar
x1
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
b b 2 4ac Analytic
f ( x ) ax bx c 0
2
x Solution
2a
Roots (zeros) of f(x)
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
• Although numerical
methods are approximate,
they employ “systematic”
strategies to estimate the
solution.
• In this case, the
convergence “quickness”
and the accuracy
“correctness” of the
approximate solution
depends on the increment
value, the used interval and
the initial value (Does this
remind you with
Programming Courses?).
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Representation of Numbers
Representation of Numbers
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
• The integer “p” (i.e. the power of 10) is called the exponent.
• For example:
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
• (b) Then, convert the mantissa and the power of 2 of the normalized
decimal number from decimal to binary.
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Textbook Examples:
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
• In both cases (single & double precisions), the first bit stores the sign
of the number (0 for + and 1 for -).
• The following 8 bits in single precision (11 bits in double precision) are
used to store the exponent.
• Then, the next 23 bits in single precision (52 bits in double precision)
are used to store the mantissa.
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
• Here is how the decimal number 22.5 is stored (as a floating point
representation) using double precision.
• Normalization:
• Exponent with bias (11 bits): 4+1023 = 1027 10000000011 (in binary).
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
In double precision:
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
• Numbers outside the ranges given in the previous slide will cause
either overflow errors or underflow errors (depending on the
case, see figure below).
• Limit of a function.
• Continuity of a function.
• Intermediate value theorem.
• Derivative of a function.
• Chain rule for ordinary differentiation.
• Mean value theorem for derivatives.
• Integral of a function.
• Fundamental theorem of calculus.
• Mean value theorem for integrals.
• Derivatives of functions of two independent variables (Partial derivatives &
Chain rule).
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Example #1
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Example #1 (Sol.)
c a 2 b 2 2 2 12 5
c14 = 2.23606797749979 (assumed true value)
2.236 - 2.23606797749979
(1) | εt3 | 100% 0.003%
2.23606797749979
2.2361 - 2.23606797749979
(1) | εt4 | 100% 0.001%
2.23606797749979
2.2361 - 2.236
(2) | εa4,3 | 100% 0.005% Comment!
2.2361
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Example #2
2.2361- 2.236
c3=2.236 , c4= 2.2361 | εa4,3 | 100% 0.005%
2.2361
2.23607 - 2.2361
c4=2.2361 , c5= 2.23607 | εa5,4 | 100% 0.001%
2.23607
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Rule #1:
• Same significant digit must be used in a coherent set of engineering
operations and data processing.
• When different significant digits are involved in an operation, a
truncation and rounding operation must be carried out in processing
the result.
Rule #2:
• The rule of rounding in significant digits processing is to truncate 4
and round up 5. For Example:
6.2548 6.3 (for 1 significant decimal digit)
6.2548 6.25 (for 2 significant decimal digits)
6.2548 6.255 (for 3 significant decimal digits)
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Rule #3:
•The result of addition and subtraction should show significant
digits only as far to the right as is seen in the least precise number
in the calculation.
•The insignificant digits following the least significant figure should
be rounded to the least significant figure.
Examples:
1725.463 - 189.2 = 1536.263 1536.3
23578.3 + 0.1892 = 23578.4892 23578.5
3.510 + 2.246 + 0.0192 = 5.7752 5.775
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Rule #4:
• The result of multiplication or division should show significant
digits only as far to the right as that are contained in the number
with the fewest significant digits.
• The insignificant digits following the least significant figure
should be rounded to the least significant figure.
Examples:
2.43 × 17.675 = 42.950250 42.95
75.22 ÷ 25.1 = 2.9968127 3.0
75.220 ÷ 25.100 = 2.9968127 2.997
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Taylor Series
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Taylor Series
Taylor Series
'' (n)
f ( x ) f ( xi ) n
f ( xi 1 ) f ( xi ) f ' ( xi )h i
h 2 .... h Rn
2! n!
f ( k ) ( xi ) k
f ( xi 1 ) h
k 0 k!
f ( xi 1 ) f ( xi ) zero order approximation
f ( xi 1 ) f ( xi ) f ' ( xi )h 1st order approximation
f '' ( xi ) 2
f ( xi 1 ) f ( xi ) f ( xi )h
'
h 2nd order approximation
2!
'' (n)
f ( x ) f ( xi ) n th
f ( xi 1 ) f ( xi ) f ' ( xi )h i
h 2 .... h n order approx.
© Sameh Nassar 2! n!
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Example #3
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Example #3 (Sol.”1/5”)
Example #3 (Sol.”2/5”)
Example #3 (Sol.”3/5”)
Example #3 (Sol.”4/5”)
0.717356090899523 - 0.716739215540704
| εt4 | 100% 0.086%
0.717356090899523
Comment!
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Example #3 (Sol.”5/5”)
f(x)
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
R0
f ' ( )
h
f(xi+1)
R 0 f ' ()h O(h)
f(xi) Similarly:
f " ( ) 2
R1 h O(h 2 )
2!
R n O(h n1
) Truncation Error
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
4
5
f ( x ) ln x cos( x ) ..... k sin( x ) 2 x
k 0 x
Remember:
In Taylor series expansion, we evaluate the f(x) value within a
specific interval (not for the whole range of x values)
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Textbook Readings
• Sections Covered:
1.1, 1.2, 1.3, 1.4, 2.1, 2.2, 2.7
© Sameh Nassar
ENGG 681
320 L60
L60
L01 Summer
Summer
Fall 2020
2010
2011 Lecture
Section
#01#01 Dr.Dr.
Dr.
Sameh
Sameh
Sameh
Nassar
Nassar
Extra Example
In (c):
Use zero order, 1st order, 2nd order,….etc. approximations.
After adding each new term, compute the true and approximate
percent relative errors.
Add terms until the approximate percent relative error is < 0.5%.
Use your calculator to obtain the true value of cos /3!
© Sameh Nassar