Error: Hoang Hai Ha
Error: Hoang Hai Ha
Error: Hoang Hai Ha
ELECTRONIC LECTURE
Hoang Hai Ha
HCMUT-OISP
Email: hoanghaiha@hcmut.edu.vn
ERROR DEFINITIONS
DEFINITION
In a computational model, let assign a be the
approximate value and A be the true value, denote
a ≈ A . We will use a ( instead of A ) in calculations.
DEFINITION
Suppose that a is an approximation of A . The
absolute error is ∆a = |a − A|
REMARK
We often cannot find ∆a accurately, instead, we find a
positive number M such that ∆a ≤ M , in other word,
we estimate an upper bound for the absolute error
which give us a “worst-case”.
EXAMPLE
We measure the lengths of a bridge and a rivet and
come up with 9999cm and 9 cm , respectively and
obtain the same absolute error with 0.5cm . The
measurement in which case is more accurate?
RELATIVE ERROR
DEFINITION
∆a
The relative error of an approximation a is δa = .
|A|
DEFINITION
Every real number a can be written in the form:
m
d k × 10k
X
a = ±d m d m−1 ...d 1 d 0 .d −1 d −2 ...d −n = ±
k=−n
EXAMPLE
How many significant digits each below number has?
1
a = 0.01230
2
a = 2.31200
EXAMPLE
How many significant digits each below number has?
1
a = 0.01230
2
a = 2.31200
The trailling zeros ( those to right of the last non-zero
digit ) are significant because they provide the
information about the place that it is precise.
DEFINITION
Suppose a is an approximation of a true value A , but
in calculations, we need to replace a by another
number ae which is simpler than a and nearest to a by
cutting some digits after the decimal point from the
right of a . This procedure is called rounding a .
DEFINITION
The error that results from the rounding approximate
value a to ae is called round-off error and denote
θae = |a − a|
e
REMARK
∆ae ≥ ∆a
∆ae ≤ θae + ∆a
EXAMPLE
The number a = 4.56756 has error δa = 0.56%, find the
absolute error of a . Round the result to four decimal
digits.
EXAMPLE
The number a = 4.56756 has error δa = 0.56%, find the
absolute error of a . Round the result to four decimal
digits.
EXAMPLE
The number a = 4.56756 has error δa = 0.56%. Round a
to two decimal digits to obtain ae. Find the round-off
error θae
A = a ± ∆a
∆u = |U − u| = | f (X , Y ) − f (x, y)|
∆u = |U − u| = | f (X , Y ) − f (x, y)|
¯ ∂u ∂u
¯ ¯
¯
≈ ¯¯ (x, y).∆x + (x, y).∆ y ¯¯
∂x ∂y
∆u = |U − u| = | f (X , Y ) − f (x, y)|
¯ ∂u ∂u
¯ ¯
¯
≈ ¯¯ (x, y).∆x + (x, y).∆ y ¯¯
∂x ∂y
¯ ∂u ¯ ∂u
¯ ¯ ¯ ¯
¯ ¯
É ¯¯ (x, y)¯¯ .∆x + ¯¯ (x, y)¯¯ .∆ y
∂x ∂y
∆u = |U − u| = | f (X , Y ) − f (x, y)|
¯ ∂u ∂u
¯ ¯
¯
≈ ¯¯ (x, y).∆x + (x, y).∆ y ¯¯
∂x ∂y
¯ ∂u ¯ ∂u
¯ ¯ ¯ ¯
¯ ¯
É ¯¯ (x, y)¯¯ .∆x + ¯¯ (x, y)¯¯ .∆ y
∂x ∂y
Then absolute error of u ≤
¯ ∂u ¯ ∂u
¯ ¯ ¯ ¯
¯ ¯
¯ (x, y)¯ .∆x + ¯ (x, y)¯ .∆ y
¯ ∂x ¯ ¯ ∂y ¯
Relative error of u
¯ ∂u ¯ ∂u
¯ ¯ ¯ ¯
¯ ¯
¯ (x, y)¯ .∆x + ¯ (x, y)¯ .∆ y
∆u ¯ ∂x ¯ ¯ ∂y ¯
δu = =
|u| |u|
¯∂ ¯∂
¯ ¯ ¯ ¯
¯ ¯
= ¯¯ ln f (x, y)¯¯ .∆x + ¯¯ ln f (x, y)¯¯ .∆ y
∂x ∂y
Relative error of y
n ¯ ∂f ¯
¯ ¯
P ¯ .∆
∆ y i =1 ¯ ∂x i ¯ xi
¯
δy = =
|y| |f |
n ¯
∂
¯ ¯
X ¯
= ¯¯ ln f (x 1 , x 2 , . . . , x n )¯¯ .∆xi
i =1 ∂x i
EXAMPLE
Find the absolute and relative error for volume
1
V = πd 3 of a sphere whose diameter is
6
d = 3.70cm ± 0.05cm and π = 3.14 ± 0.0016.
EXAMPLE
Find the absolute and relative error for volume
1
V = πd 3 of a sphere whose diameter is
6
d = 3.70cm ± 0.05cm and π = 3.14 ± 0.0016.
EXAMPLE
Find absolute and relative error of y = a − b + c with
a = −47.132 ± 0.003; b = 47.111 ± 0.02; c = 45.234 ± 0.5.
EXAMPLE
Find the absolute and relative error for volume
1
V = πd 3 of a sphere whose diameter is
6
d = 3.70cm ± 0.05cm and π = 3.14 ± 0.0016.
EXAMPLE
Find absolute and relative error of y = a − b + c with
a = −47.132 ± 0.003; b = 47.111 ± 0.02; c = 45.234 ± 0.5.
EXAMPLE
Given f (x, y) = x 3 − x y + y 2 , where x = 2.3 ± 0.0056,
y = 0.45 ± 0.0012. Estimate the absolute and relative
error of f .
Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 19 / 21
Error of function
EXAMPLE
Given f = abc , where a = 2.3 ± 0.035, b = −3.4 ± 0.0231,
c = 4.5 ± 0.0023. Find absolute and relative error of f .
Rounding to four decimal digits.
EXAMPLE
Given f = abc , where a = 2.3 ± 0.035, b = −3.4 ± 0.0231,
c = 4.5 ± 0.0023. Find absolute and relative error of f .
Rounding to four decimal digits.
EXAMPLE
The result of a calculation is a = 3.45678 and rounded
to 2 decimal digits. Knowing that error of a is
δa = 0.25%. Determine ∆ae.
DEFINITION
An algorithm is a procedure which describes a finite
sequence steps to approximate a solution to a given
problem.
DEFINITION
An algorithm is a procedure which describes a finite
sequence steps to approximate a solution to a given
problem.
DEFINITION
Suppose we use algorithm (A) to build an
approximate sequence of solutions x n , if x n → x ,
where x is the exact solution of the problem, then we
say that the algorithm (A) converges.