You are on page 1of 24

ERROR

E LECTRONIC LECTURE

Hoang Hai Ha
HCMUT-OISP
Email: hoanghaiha@hcmut.edu.vn

January 4, 2022

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 1 / 12


Error definitions

ERROR DEFINITIONS

D EFINITION 1.1
Let A be true and approximate values of some
quantity.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 2 / 12


Error definitions

ERROR DEFINITIONS

D EFINITION 1.1
Let A be true and approximate values of some
quantity.
Actual error is defined by: |a − A|.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 2 / 12


Error definitions

T HE ABSOLUTE ERROR

D EFINITION 1.2
We often cannot find actual error accurately, instead, we
find a positive number ∆a as small as possible such that
|a − A| ≤ ∆ A , in other word, we estimate an upper bound
for the absolute error which give us a “worst-case”. Then
∆a is called absolute error of a.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 3 / 12


Error definitions

T HE ABSOLUTE ERROR

D EFINITION 1.2
We often cannot find actual error accurately, instead, we
find a positive number ∆a as small as possible such that
|a − A| ≤ ∆ A , in other word, we estimate an upper bound
for the absolute error which give us a “worst-case”. Then
∆a is called absolute error of a.

E XAMPLE 1.1
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?
Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 3 / 12
Error definitions

R ELATIVE ERROR

D EFINITION 1.3
∆a
The relative error of an approximation a is δa = .
|A|

The relative error is more meaningful because it takes


into account the size of the value.
In the above formula, the true value A we cannot find, so
we replace A by its approximation a, that is
∆a
δa = .
|a|
We often represent relative error in percentage form.
Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 4 / 12
Error of function

F UNCTION OF TWO VARIABLES

Consider function u = f (x, y).


1 x is approx value of exact value X . Let ∆x = |X − x|.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 5 / 12


Error of function

F UNCTION OF TWO VARIABLES

Consider function u = f (x, y).


1 x is approx value of exact value X . Let ∆x = |X − x|.
2 y is approx value of exact value Y . Let ∆ y = |Y − y|.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 5 / 12


Error of function

F UNCTION OF TWO VARIABLES

Consider function u = f (x, y).


1 x is approx value of exact value X . Let ∆x = |X − x|.
2 y is approx value of exact value Y . Let ∆ y = |Y − y|.
3 u = f (x, y) is approx value of exact value of
U = f (X , Y ).

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 5 / 12


Error of function

F UNCTION OF TWO VARIABLES

Consider function u = f (x, y).


1 x is approx value of exact value X . Let ∆x = |X − x|.
2 y is approx value of exact value Y . Let ∆ y = |Y − y|.
3 u = f (x, y) is approx value of exact value of
U = f (X , Y ).
Find absolute error and relative error of function
u = f (x, y)?

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 5 / 12


Error of function

∆u = |U − u| = | f (X , Y ) − f (x, y)|

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 6 / 12


Error of function

∆u = |U − u| = | f (X , Y ) − f (x, y)|

¯ ∂u ∂u
¯ ¯
¯
≈ ¯¯ (x, y).∆x + (x, y).∆ y ¯¯
∂x ∂y

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 6 / 12


Error of function

∆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

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 6 / 12


Error of function

∆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 ¯

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 6 / 12


Error of function

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

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 7 / 12


Error of function

E RROR OF FUNCTIONS OF MULTIVARIABLES

Given continous differential function of multivariables


y = f (x 1 , x 2 , . . . , x n ) and absolute errors ∆xi of variables
x i (i = 1..n). Let X i , Y và x i , y (i = 1..n) are the true and
approx values of function and variables , respectively.
Then

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 8 / 12


Error of function

E RROR OF FUNCTIONS OF MULTIVARIABLES

Given continous differential function of multivariables


y = f (x 1 , x 2 , . . . , x n ) and absolute errors ∆xi of variables
x i (i = 1..n). Let X i , Y và x i , y (i = 1..n) are the true and
approx values of function and variables , respectively.
Then ¯ |Y¯ − y| = | f (X 1 , X¯2 , . . .¯, X n ) − f (x 1 , x 2 , . . . , x n )| É
P ¯¯ ∂ f ¯¯
n Pn ¯ ∂f ¯
.|X
¯ ∂x ¯ i − x i | É ¯ ∂x ¯ .∆xi . So absolute error of y
¯ ¯
i =1 ¯ i i =1 i
n ¯ ∂f ¯
¯
P ¯ .∆x
É ¯¯
i =1 ∂x i
¯ i

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 8 / 12


Error of function

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

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 9 / 12


Error of function

E XAMPLE 2.1
1
Find the absolute and relative error for volume V = πd 3
6
of a sphere whose diameter is d = 3.70cm ± 0.05cm and
π = 3.14 ± 0.0016.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 10 / 12


Error of function

E XAMPLE 2.1
1
Find the absolute and relative error for volume V = πd 3
6
of a sphere whose diameter is d = 3.70cm ± 0.05cm and
π = 3.14 ± 0.0016.

E XAMPLE 2.2
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.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 10 / 12


Error of function

E XAMPLE 2.1
1
Find the absolute and relative error for volume V = πd 3
6
of a sphere whose diameter is d = 3.70cm ± 0.05cm and
π = 3.14 ± 0.0016.

E XAMPLE 2.2
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.

E XAMPLE 2.3
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 January 4, 2022 10 / 12
Error of function

E XAMPLE 2.4
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.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 11 / 12


Algorithm

D EFINITION 3.1
An algorithm is a procedure which describes a finite
sequence steps to approximate a solution to a given
problem.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 12 / 12


Algorithm

D EFINITION 3.1
An algorithm is a procedure which describes a finite
sequence steps to approximate a solution to a given
problem.

D EFINITION 3.2
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.

Hoang Hai Ha (BK TPHCM) ERROR January 4, 2022 12 / 12

You might also like