0% found this document useful (0 votes)
118 views35 pages

Error: Hoang Hai Ha

1. The document discusses various types of errors in numerical approximations including absolute error, relative error, and round-off error. 2. It provides definitions and examples of absolute error as the difference between the approximate and true values, and relative error as the absolute error divided by the true value. 3. Methods for rounding approximations are covered, including rounding to a given decimal place and rounding for inequalities.

Uploaded by

Thanh Huy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views35 pages

Error: Hoang Hai Ha

1. The document discusses various types of errors in numerical approximations including absolute error, relative error, and round-off error. 2. It provides definitions and examples of absolute error as the difference between the approximate and true values, and relative error as the absolute error divided by the true value. 3. Methods for rounding approximations are covered, including rounding to a given decimal place and rounding for inequalities.

Uploaded by

Thanh Huy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

ERROR

ELECTRONIC LECTURE

Hoang Hai Ha
HCMUT-OISP
Email: [email protected]

TP. HCM — 2019.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 1 / 21


Approximation-error

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.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 2 / 21


Approximation-error

THE ABSOLUTE ERROR

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”.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 3 / 21


Approximation-error

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?

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 4 / 21


Approximation-error

RELATIVE ERROR

DEFINITION
∆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 , i.e
∆a
δa =
|a|

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 5 / 21


Approximation-error

REPRESENTATION OF A DECIMAL NUMBER

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

where dm ∈ {1, ..., 9}, dk ∈ {0, ..9}.


The digits dk , k = −n, ..m are called significant digits
or significant figures of a decimal number.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 6 / 21


Approximation-error

EXAMPLE
How many significant digits each below number has?
1
a = 0.01230
2
a = 2.31200

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 7 / 21


Approximation-error

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.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 7 / 21


Approximation-error

ROUNDING DECIMAL NUMBER

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 .

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 8 / 21


Approximation-error

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

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 9 / 21


Approximation-error

ROUNDING FOR EQUALITY

To round a number at k t h place after the decimal


point (digit d k ), look at the (k + 1)t h place digit d k+1 , if
d k+1 < 5, simply drop all digits on the right of
d k (round down), if d k+1 ≥ 5, add d k to 1 and drop all
digits on the right of d k (round up)

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 10 / 21


Approximation-error

ROUNDING FOR EQUALITY

To round a number at k t h place after the decimal


point (digit d k ), look at the (k + 1)t h place digit d k+1 , if
d k+1 < 5, simply drop all digits on the right of
d k (round down), if d k+1 ≥ 5, add d k to 1 and drop all
digits on the right of d k (round up)
EXAMPLE
The number π = 3.14159265359 is rounded to two,
three, four decimal places will be 3.14, 3.142, 3.1416,
respectively

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 10 / 21


Approximation-error

ROUNDING FOR INEQUALITY

For inequalities, the rule of rounding depends on


their direction and specific purpose.
EXAMPLE
For inequality a ≤ 4.5628, rounding to two decimal
places means rounding up ⇒ a ≤ 4.57.
For inequality a > 4.5628, rounding to two decimal
places means rounding down ⇒ a > 4.56

Importance: In calculation of error, the result is


always rounded up

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 11 / 21


Approximation-error

EXAMPLE
The number a = 4.56756 has error δa = 0.56%, find the
absolute error of a . Round the result to four decimal
digits.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 12 / 21


Approximation-error

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

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 12 / 21


Approximation-error

THE REPRESENTATION OF AN APPROXIMATE VALUE IN


NUMERICAL METHOD

A true value A with approx a and absolute error ∆a is


expressed in the form:

A = a ± ∆a

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 13 / 21


Error of function

FUNCTION 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 TP. HCM — 2019. 14 / 21


Error of function

FUNCTION 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 TP. HCM — 2019. 14 / 21


Error of function

FUNCTION 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 TP. HCM — 2019. 14 / 21


Error of function

FUNCTION 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 và relative error of function
u = f (x, y)?

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 14 / 21


Error of function

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

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 15 / 21


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 TP. HCM — 2019. 15 / 21


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 TP. HCM — 2019. 15 / 21


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 TP. HCM — 2019. 15 / 21


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 TP. HCM — 2019. 16 / 21


Error of function

ERROR 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 TP. HCM — 2019. 17 / 21


Error of function

ERROR 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| =¯
n ¯ ∂f ¯
¯
P
| f (X 1 , X 2 , . . . , X n ) − f (x 1 , x 2 , . . . , x n )| É ¯¯ ¯ .|X i − x i |
i =1 ∂x i ¯
¯
n ¯ ∂f ¯ n ¯ ∂f ¯
¯ ¯ ¯
.∆xi . So absolute error of y É ¯
P P ¯ .∆x
É ¯ ¯ ¯ ¯
i =1 ∂x i i =1 ∂x i
¯ ¯ i

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 17 / 21


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 TP. HCM — 2019. 18 / 21


Error of function

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.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 19 / 21


Error of function

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.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 19 / 21


Error of function

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.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 20 / 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
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.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 20 / 21


Error of function

DEFINITION
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 TP. HCM — 2019. 21 / 21


Error of function

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.

Hoang Hai Ha (BK TPHCM) ERROR TP. HCM — 2019. 21 / 21

You might also like