Professional Documents
Culture Documents
2 ErrorAnalysis
2 ErrorAnalysis
AND APPROXIMATIONS
Lec. 2.1: Errors in Numerical Methods
Dr. Niket Kaisare
Department of Chemical Engineering
IIT–Madras
• Just like these devices, real numbers also have a “least count”
Example
n
0. x x x x x ×10
• Floating Point representation of a number:
2
• Example: 23.217 becomes 0. 2 3 2 1 7 ×10
• 23.218 becomes 2
0. 2 3 2 1 8 ×10
• But, 23.2172 remains 2
0. 2 3 2 1 7 ×10
• Thus, the least count of this decimal machine: ~ 0.00001 3
End of Lecture 2.1
• Taylor’s series:
ℎ' AA ℎ-
? 3+ℎ =? 3 + ℎ? A 3 + ? 3 + ⋯+ ? - 3 + B ℎ-C1
2! .!
"
&' &* &-
! = 1+&+ + +⋯+ + B &-C1
2! 3! .!
• The last term implies error in retaining only finite number of terms of the series
MacLaurin Series from 1 to 5
&' &
= & ×
• 1 term: ! " = 1 + & + B &' 2! 2
"D
• 2 terms: ! " = 1 + & + '! + B &* &*
=
&'
×
&
3! 2! 3
"D "F
• 3 terms: ! " ≈ 1 + & + '! + *!
Truncation Error in ea
-2
10
-4
10
-6
-7
10
• Slope = . + 1 10
-8
-9
• Slope is the order of accuracy!!
10
-10
10 -2 -1
10 10
step, a
End of Lecture 2.2
• From definition of ? A 3 :
? 3 +ℎ −? 3 ? 3+ℎ −? 3
? A 3 = lim ⇒ ? A 3 ≈
S→/ ℎ ℎ
B ℎ
• Numerical Differentiation:
? 3+ℎ −? 3
?A 3 = +B ℎ
ℎ
• Truncation error decreases with ℎ
• However, machine precision may determine how small ℎ we can use
• Roundoff error increases with ℎ
Direct vs. Iterative Methods
• Direct methods:
An algorithm (sequence of operations) to “directly” compute a solution
"D "W
• MacLaurin Series: ! " ≈ 1 + & + '!
+⋯+ -!
X "CS YX "
• Numerical derivative: ?A & ≈ S
• Iterative methods:
Improve an initial guess by repeatedly using computational steps until “convergence”
ZC1
1 Z
2
3 = 3 +
2 3 Z
• Use Taylor’s series 10 times with step size of 0.01 to obtain ? 0.1 :
& = 0, ℎ = 0.01, \ = 10
Example: e0.1
Single Term of Taylor’s Series Error decreases as \ increases
• ⋮ • ⋮
• Definitions of error:
• True error: 2 Z = 3 4567 −3 Z
• Notes:
• We used “true error” to analyze errors and approximations in this module
• We used “current approximation error” for stopping an iterative method
Summary
• Direct Methods
X "CS YX "
• Numerical Derivative: ?A & ≈ S
direct application
• Iterative Methods
ZC1 1 Z '
• Héron’s Algorithm: 3 =' 3 +< f until convergence
• Step-wise Methods
• Multi-step Taylor’s series: ! <f CS ≈ ! <f + ℎ! <f until we reach destination
End of Lecture 2.4