Professional Documents
Culture Documents
Ramaz Botchorishvili
November 2, 2022
Ramaz Botchorishvili
November 2, 2022
fl(1 + µ) > 1
fl(1 + µ) > 1
Definition 7.3
Suppose x is real number and x̃ is its approximation. x̃ approximates x to s
significant digits if s is largest nonnegative integer for which relative error
satisfies the inequality:
|x − x̃ |
< 5 · 10−s
|x |
fl(1 + µ) > 1
Definition 7.3
Suppose x is real number and x̃ is its approximation. x̃ approximates x to s
significant digits if s is largest nonnegative integer for which relative error
satisfies the inequality:
|x − x̃ |
< 5 · 10−s
|x |
Example 7.4
▶ x = 1.31, x̃ = 1.3, |x − x̃ | = 0.01, |x|x−x̃| | = 0.007635
▶ 7.635 · 10−3 < 5 · 10−2 , agree up to two significant digits
Ramaz Botchorishvili (KIU) Lectures in NLA Fall Term 2022 6 / 34
Round-off errors, 3
▶ Round-off Error in Representation of a Real Number
Theorem 7.5
(
|x −fl(x )| 0.5β 1−m for rounding
|x | ≤µ=
β 1−m for chopping
Corollary 7.6
(
|x −fl(x )| 0.5β 1−m for rounding
|x | ≤µ= ⇒ fl(x ) = x (1 + δ), |δ| ≤ µ
β 1−m for chopping
Corollary 7.6
(
|x −fl(x )| 0.5β 1−m for rounding
|x | ≤µ= ⇒ fl(x ) = x (1 + δ), |δ| ≤ µ
β 1−m for chopping
Proof.
x −fl(x )
▶ ▶ We set: δ ≡ x
Corollary 7.6
(
|x −fl(x )| 0.5β 1−m for rounding
|x | ≤µ= ⇒ fl(x ) = x (1 + δ), |δ| ≤ µ
β 1−m for chopping
Proof.
x −fl(x )
▶ ▶ We set: δ ≡ x
▶ ⇒ |δ| ≤ µ
Corollary 7.6
(
|x −fl(x )| 0.5β 1−m for rounding
|x | ≤µ= ⇒ fl(x ) = x (1 + δ), |δ| ≤ µ
β 1−m for chopping
Proof.
x −fl(x )
▶ ▶ We set: δ ≡ x
▶ ⇒ |δ| ≤ µ
▶ ⇒ fl(x ) − x = x δ
Corollary 7.6
(
|x −fl(x )| 0.5β 1−m for rounding
|x | ≤µ= ⇒ fl(x ) = x (1 + δ), |δ| ≤ µ
β 1−m for chopping
Proof.
x −fl(x )
▶ ▶ We set: δ ≡ x
▶ ⇒ |δ| ≤ µ
▶ ⇒ fl(x ) − x = x δ
▶ ⇒ fl(x ) = x (1 + δ)
Example 7.7
▶ ▶ Floating point system β = 10, m = 2, emin = −3, emax = 3
Example 7.7
▶ ▶ Floating point system β = 10, m = 2, emin = −3, emax = 3
▶ x1 = 0.99 · 101 , x2 = 0.11 · 100
Example 7.7
▶ ▶ Floating point system β = 10, m = 2, emin = −3, emax = 3
▶ x1 = 0.99 · 101 , x2 = 0.11 · 100
▶ x1 + x2 = 9.9 + 0.11 = 10.01 = 0.1001 · 102
Example 7.7
▶ ▶ Floating point system β = 10, m = 2, emin = −3, emax = 3
▶ x1 = 0.99 · 101 , x2 = 0.11 · 100
▶ x1 + x2 = 9.9 + 0.11 = 10.01 = 0.1001 · 102
▶ fl(x1 + x2 ) = 0.10 · 102
Example 7.7
▶ ▶ Floating point system β = 10, m = 2, emin = −3, emax = 3
▶ x1 = 0.99 · 101 , x2 = 0.11 · 100
▶ x1 + x2 = 9.9 + 0.11 = 10.01 = 0.1001 · 102
▶ fl(x1 + x2 ) = 0.10 · 102
▶ (x1 + x2 ) − fl(x1 + x2 ) = −0.0001 · 102 = 0.1 · 10−1
Example 7.7
▶ ▶ Floating point system β = 10, m = 2, emin = −3, emax = 3
▶ x1 = 0.99 · 101 , x2 = 0.11 · 100
▶ x1 + x2 = 9.9 + 0.11 = 10.01 = 0.1001 · 102
▶ fl(x1 + x2 ) = 0.10 · 102
▶ (x1 + x2 ) − fl(x1 + x2 ) = −0.0001 · 102 = 0.1 · 10−1
(x1 +x2 )−fl(x1 +x2 )
▶ δ= x1 +x2 ≈ −0.999 · 10−3
Example 7.7
▶ ▶ Floating point system β = 10, m = 2, emin = −3, emax = 3
▶ x1 = 0.99 · 101 , x2 = 0.11 · 100
▶ x1 + x2 = 9.9 + 0.11 = 10.01 = 0.1001 · 102
▶ fl(x1 + x2 ) = 0.10 · 102
▶ (x1 + x2 ) − fl(x1 + x2 ) = −0.0001 · 102 = 0.1 · 10−1
(x1 +x2 )−fl(x1 +x2 )
▶ δ= x1 +x2 ≈ −0.999 · 10−3
▶ δ =≈ 0.999000 · 10−3 < 0.5 · 10−2
Example 7.7
▶ ▶ Floating point system β = 10, m = 2, emin = −3, emax = 3
▶ x1 = 0.99 · 101 , x2 = 0.11 · 100
▶ x1 + x2 = 9.9 + 0.11 = 10.01 = 0.1001 · 102
▶ fl(x1 + x2 ) = 0.10 · 102
▶ (x1 + x2 ) − fl(x1 + x2 ) = −0.0001 · 102 = 0.1 · 10−1
(x1 +x2 )−fl(x1 +x2 )
▶ δ= x1 +x2 ≈ −0.999 · 10−3
▶ δ =≈ 0.999000 · 10−3 < 0.5 · 10−2
▶ |δi | ≤ µ, 2 ≤ i ≤ n
▶ |δi | ≤ µ, 2 ≤ i ≤ n
Proof.
▶ s = x1 + x2 + ... + xn
▶ |δi | ≤ µ, 2 ≤ i ≤ n
Proof.
▶ s = x1 + x2 + ... + xn
▶ s2 = fl(x1 + x2 ) = (x1 + x2 )(1 + δ2 ), |δ2 | ≤ µ
▶ |δi | ≤ µ, 2 ≤ i ≤ n
Proof.
▶ s = x1 + x2 + ... + xn
▶ s2 = fl(x1 + x2 ) = (x1 + x2 )(1 + δ2 ), |δ2 | ≤ µ
▶ si = fl(si−1 + xi ) = (si−1 + xi )(1 + δi ), |δi | ≤ µ, 2 ≤ i ≤ n
▶ |δi | ≤ µ, 2 ≤ i ≤ n
Proof.
▶ s = x1 + x2 + ... + xn
▶ s2 = fl(x1 + x2 ) = (x1 + x2 )(1 + δ2 ), |δ2 | ≤ µ
▶ si = fl(si−1 + xi ) = (si−1 + xi )(1 + δi ), |δi | ≤ µ, 2 ≤ i ≤ n
▶ s3 = fl(s2 + x3 ) = (s2 + x3 )(1 + δ3 ) =
((xBotchorishvili
Ramaz 1 + x2 )(1(KIU)
+ δ2 ) + x3 )(1 + δLectures
3 ) = in(x1 + x2 )(1 + δ2 )(1 + δ3Fall
NLA ) +Term
x3 (1
2022+11
δ3/)34
Round-off errors, 8
Round-off error in floating point addition, cont.
Proof. cont.
▶ s3 = (x1 + x2 )(1 + δ2 + δ3 ) + x3 (1 + δ3 ) + O(µ2 )
fl(x ⊙ y ) = (x ⊙ y )(1 + δ)
⊙ = +, −, ∗, /
|δ| ≤ µ
fl(x ⊙ y ) = (x ⊙ y )(1 + δ)
⊙ = +, −, ∗, /
|δ| ≤ µ
Example 7.10
Biswa Nath Datta, 2010
|δi | ≤ µ, 2 ≤ i ≤ n
|δi | ≤ µ, 2 ≤ i ≤ n
Example 7.13
Pn 1 P1 1
S1 = i=1 i , S2 = i=n i
Theorem 7.14
Round-off error in floating point addition: xi ∈ R, 2 ≤ i ≤ n
fl(x1 + x2 + ... + xn ) − (x1 + x2 + ... + xn ) ≈
(x1 + x2 )(δ2 + δ3 + ... + δn ) + x3 (δ3 + δ4 + ... + δn )+... + xn δn
|δi | ≤ µ, 2 ≤ i ≤ n
Theorem 7.14
Round-off error in floating point addition: xi ∈ R, 2 ≤ i ≤ n
fl(x1 + x2 + ... + xn ) − (x1 + x2 + ... + xn ) ≈
(x1 + x2 )(δ2 + δ3 + ... + δn ) + x3 (δ3 + δ4 + ... + δn )+... + xn δn
|δi | ≤ µ, 2 ≤ i ≤ n
Example 7.15
▶ S1 = ni=1 1i , S2 = 1i=n 1i
P P
▶ Recommendation:
summation from smallest to largest terms is more accurate
A = LU
A, L, U-square matrices, L-lower triangular, U - upper triangular
A = LU
A, L, U-square matrices, L-lower triangular, U - upper triangular
Example 7.21
a11 a12 ... a1n l11 0 ... 0 u11 u12 ... u1n
a
21 a22 ... a2n l21 l22 ... 0 0 u22 ... u2n
=
.. .. ... .. .. .. ... .. .. .. ... ..
an1 an2 ... ann ln1 ln2 ... lnn 0 0 ... unn
A = LU
A, L, U-square matrices, L-lower triangular, U - upper triangular
Example 7.21
a11 a12 ... a1n l11 0 ... 0 u11 u12 ... u1n
a
21 a22 ... a2n l21 l22 ... 0 0 u22 ... u2n
=
.. .. ... .. .. .. ... .. .. .. ... ..
an1 an2 ... ann ln1 ln2 ... lnn 0 0 ... unn
Example 7.22
LU factoriozation for solving linear systems
Example 7.24
a1 c1 . . . . 0 x1 f1
b2 a2 c2 . . . . x2 f2
. . . . . . . . .
. . bi ai ci . . xi = fi
. . . . . . . . .
. . . . . . . . .
0 . . . . b n an xn fn
Theorem 7.25
If LU decomposition of a tridiagonal matrix exists then matrices L and U
are bi-diagonal
2. Forward substitution
2. Forward substitution
y1 = f1 , yi = fi − βi yi−1 , i = 2, 3, ..., n
3. Backward substitution
2. Forward substitution
y1 = f1 , yi = fi − βi yi−1 , i = 2, 3, ..., n
3. Backward substitution
2. Forward substitution
y1 = f1 , yi = fi − βi yi−1 , i = 2, 3, ..., n
3. Backward substitution
2. Forward substitution
y1 = f1 , yi = fi − βi yi−1 , i = 2, 3, ..., n
3. Backward substitution
2. Forward substitution
y1 = f1 , yi = fi − βi yi−1 , i = 2, 3, ..., n
3. Backward substitution
2. Forward substitution
y1 = f1 , yi = fi − βi yi−1 , i = 2, 3, ..., n
3. Backward substitution
Example 7.26
▶ ▶ Finding inverse of a matrix
Example 7.26
▶ ▶ Finding inverse of a matrix
▶ AB = I or BA = I ⇒ B = A−1
Example 7.26
▶ ▶ Finding inverse of a matrix
▶ AB = I or BA = I ⇒ B = A−1
1 0 ... 0 1 0 0
0 1 ... 0 0 1 0
▶ I= I = I = ...I = ⇒ I = (I1 I2 ... In )
... 0 1 2 n
0 0 ... 1 0 0 1
Example 7.26
▶ ▶ Finding inverse of a matrix
▶ AB = I or BA = I ⇒ B = A−1
1 0 ... 0 1 0 0
0 1 ... 0 0 1 0
▶ I= I = I = ...I = ⇒ I = (I1 I2 ... In )
... 0 1 2 n
0 0 ... 1 0 0 1
▶ AB = I ⇒ Abi = Ii , i = 1, 2, ..n ⇒ B = (b1 b2 ...bn ) = A−1
Example 7.27
Example 7.29