Chapter 1 Introduction
Chapter 1 Introduction
Prof. Mingwu Li
Department of Mechanics and Aerospace Engineering
Southern University of Science and Technology
[email protected]
• Education background
2013 B. Eng in Engineering Mechanics,
Huazhong University of Science and Technology
2016 M. Eng in Computational Mechanics
Dalian University of Technology
2020 PhD in Mechanical Engineering,
University of Illinois at Urbana-Champaign, USA
• Work experience
2020 – 2022: Postdoc in ETH Zurich, Switzerland
2023 Jan – present: SUSTech
Introduction
• Textbook
• M. T. Heath, Scientific Computing - An Introductory
Survey
• Baidu, Google, Zhihu, Bilibili, YouTube, Stack
Overflow, Math.Stackexhange, ChatGPT……
• https://bb.sustech.edu.cn/ (Blackboard)
• Lecture slides
• Homework assignments, …
Other useful reading materials
Yu Gui (桂雨),
[email protected]
• Scientific computing
• Approximations
• Floating-Point Arithmetic
Scientific Computing
What Is Scientific Computing?
Design and analysis of algorithms for solving mathematical problems
arising in science and engineering numerically
Computer
Sc i en c e
S c i en tific
Computing
Ap p l i e d S c i en c e &
Mathematics Engineering
Approximations
Before computation
o modeling
o empirical measurements
o previous computations
During computation
o truncation or discretization (mathematical approximations)
o rounding (arithmetic approximations)
absolute error
Relative error:
true value
Computational error:
( interactive example )
Example: Finite Difference Approximation
f (x + h) − f (x)
f’(x) ≈
h
exhibits tradeoff between rounding error and truncation error
∆ x = x̂ − x
Example: Forward and Backward Error
How much data error in input would explain all error in computed
result?
ŷ = fˆ (x) = 1 − x 2/ 2
f (x̂) = fˆ (x)
For x = 1,
Condition number :
|relative change in solution|
cond =
|relative change in input data|
ŷ ŷ
x̂ x̂ ŷ
x̂
x x x y
y y
Condition number usually is not known exactly and may vary with
input, so rough estimate or upper bound is used for cond, yielding
f (x + ∆ x) − f (x) f’ (x) ∆ x
Relative forward error:
f (x) ≈
f (x)
Condition number:
where 0 ≤ di ≤ β − 1, i = 0, . . . , p − 1, and L ≤ E ≤ U
Floating-Point Numbers, continued
U+1(1 − β − p )
Largest floating-point number: OFL = β
Not all real numbers exactly representable; those that are are called
machine numbers
Example: Floating-Point System
Type eps in MATLAB and see what you get (For IEEE DP, 𝛽 = 2, 𝑝
= 53)
Machine Precision, continued
Last two digits of y do not affect result, and with even smaller
exponent, y could have had no effect on result
Possible explanations
o Partial sum eventually overflows
o 1/ n eventually underflows
o Partial sum ceases to change once 1/ n becomes negligible relative to
partial sum
( interactive example )
53
Cancellation
For example,
Cancellation, continued
Cancellation, continued
x2 x3
ex = 1 + x + + + ···
2! 3!
for x < 0, may give disastrous results due to catastrophic
cancellation
57
Example: Cancellation