0% found this document useful (0 votes)
11 views

CHAPTER1-Concept of error

Uploaded by

fzahrakihel
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)
11 views

CHAPTER1-Concept of error

Uploaded by

fzahrakihel
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/ 11

1 Concepts of Errors in Numerical

Computation

In beginning chemistry courses, we often come across Charles’s Law, which states
that for a given amount of gas at constant pressure, the volume V of the gas is
directly proportional to its temperature T in kelvins:
V1 V2
=
T1 T2

Here, V1 and V2 are the initial and final volumes of the gas, while T1 and T2 are
the initial and final temperatures in kelvins, respectively.
Let’s consider an example. Suppose two experiments are conducted to test
Charles’s Law using the same gas sample. In the first experiment:

V1 = 2.0 L
T1 = 273 K (which is 0◦ C)
According to Charles’s Law, if we increase the temperature to 373 K (which is

100 C), the new volume V2 can be predicted by:
V1 V2 2.0 V2
= ⇒ =
T1 T2 273 373
Solving for V2 , we find:
2.0 × 373
V2 = ≈ 2.73 L
273
So, the predicted final volume of the gas is 2.73 L.
However, when we measure the final volume experimentally, we find that it is
actually 2.65 L. This indicates a difference between the predicted and measured
volumes, suggesting some experimental error.
We then repeat the experiment, but this time we double both the initial temper-
ature and the initial volume and we set the final temperature to 373K as the first
experiment hence the predected volume (by Charles’s Law) is still 2.73
2V1 V2
= ⇒ V2 = 2.73
2T1 T2
This time, the measured volume turns out to be 3.50 L, which is higher than the
predicted value.

5
Numerical Analysis

Clearly, the differences between the predicted and measured volumes in both
experiments indicate some error, but before concluding that Charles’s Law is invalid
in this situation, we should examine the sources of the error. These might include
measurement inaccuracies in temperature, volume, or both.
In this case, the errors might be due to factors like heat loss to the surroundings
or imperfections in the gas used in the experiment, which prevent it from behaving
as an ideal gas. Analysing these errors helps us determine how much more accurate
our experimental setup needs to be to reduce such discrepancies.
Numerical errors are an inevitable part of computational mathematics. These
errors arise due to rounding, truncation, and other approximations that are made
during calculations. Understanding the types of errors, how they arise, and their
implications is crucial for achieving precision in scientific and engineering compu-
tations. This chapter will explore key concepts in error analysis, including decimal
notation of approximated numbers, the exact digit of an approximated decimal,
truncation and rounding errors, and relative errors.

1.1 Decimal Notation of Approximated Numbers

In numerical computations, we use frequently approximated values rather than exact


values. When representing real numbers, it becomes impossible to write them in full
precision due to limitations in computational resources or the nature of the number
itself (e.g., irrational numbers). This is where decimal approximations come into
play.

6
Numerical Analysis

Example

For example the values 2, 0.5, 19 , π, e and 2 are exact numbers, while
1

9
≈ 0.11111, π ≈ 3.14159, e ≈ 2.71828 and 2 ≈ 41421 are approximated
numbers to five digits.

Definition. A decimal representation of a non-negative real number r is a way


of expressing the number using digits from 0 to 9, separated into two parts: the
integer part and the fractional part. These two parts are divided by a decimal point.
It looks like this:

r = an an−1 . . . a1 a0 .b1 b2 . . . bm

Where:

• an an−1 . . . a0 represents the integer part of the number(Commonly an 6= 0 for


n ≥ 1),

• The decimal point . separates the integer and fractional parts,

• b1 b2 . . . bm represents the fractional part (the sequence bm is generally infinite.


If it is finite, the lacking digits are assumed to be 0. If all bm are 0, then sep-
arator is also omitted, resulting in a finite sequence of digits, which represents
a natural number).

In other words, this representation is based on the decimal system, which is a base
10 numeral system.

Example
For instance, the number 31.457 cas be expressed as:

31.457 = 3 × 101 + 1 × 100 + 4 × 10−1 + 5 × 10−2 + 7 × 10−3

Decimal representations can vary based on the type of real number:

• Natural numbers have a finite decimal expansion, such as 367.

• Rational numbers either have a finite decimal expansion, like 43 =


0.75, or a repeating periodic one 19 = 0.1111, 17 = 0.142857142857.

• Irrational numbers, such as π = 3.14159 . . . , 2 = 1.4142135 . . . ,
have non-terminating, non-repeating decimal expansions.

7
Numerical Analysis

Remark

When performing a computation by calculator, for example ( 2)2 , we often
assume that the result is exactly
√ 2. However this not the case. In the world
of arithmetic multiplying 2 by its self gives exactly 2. In the computa- √
tional world though, we obtain a value sufficiently close to 2 because 2 is
an irrational number and is represented with a finite number of digits. This
limitation is due to the precision of the calculator. The difference between the
exact result and the result obtained by the calculator is called a round-off
error.

1.2 Absolute and relative errors


Definition. Let x be the true value and let x∗ the approximated value of x. The
absolute error is defined by

Ea (x) = |x − x∗ |.

Example

An approximate value of x = π ≈ 3.14159265358979 is given by x∗ = 22


7

3.1428571428571.
The absolute error in this case is: Ea (x) = |x − x∗ | = 0.001264489.

Three approximate values for the number 19 are provided: 0.10, 0.11, and 0.12.
Which of these values is the most accurate approximation?
We have:
Ea1 (x) = | 19 − 0.10| = 90
1
≈ 0.0111;
Ea2 (x) = | 19 − 0.11| = 900
1
≈ 0.0011;
1 2
Ea3 (x) = | 9 − 0.12| = 225 ≈ 0.0089.
The smallest absolute error is Ea2 (x) ≈ 0.0011, thus 0.11 is the best approxi-
mation for 91 .

In practice, it is often impossible to evaluate the absolute error because x is


frequently unknown. Consequently, we introduce the concept of the upper bound of
this error.
Definition. The upper bound of the absolute error ∆x of an approximate value x∗
is defined as:

Ea (x) = |x − x∗ | ≤ ∆x ⇐⇒ x∗ − ∆x ≤ x ≤ x∗ + ∆x.

By a misuse of language, one may confuse the bound ∆x with Ea (x).

8
Numerical Analysis

Definition. Let x be the true value and let x∗ the approximated value of x. The
relative error is defined by
Ea (x) |x − x∗ |
Er (x) = = .
|x| |x|
Definition. The upper bound of the relative error δx is defined as:
Ea (x)
Er (x) = ≤ δx.
|x|

Since x ≈ x∗ , we have δx = ∆x
|x∗ |
.

Example 1
Let x = 3.14159265358979 and x∗ ≈ 3.1428571428571. We have seen that the
absolute error is:

Ea = |x − x∗ | = |3.14159265358979 − 3.1428571428571| ≈ 0.001264489

From this, the relative error is:


Ea 0.001264489
Er = = ≈ 0.0004025.
|x| 3.14159265358979

Example 2

A surface is given by x = 20 m2 ± 5%. The relative error for the approximate


value x∗ = 20 m2 is given by δx = 0.05. Thus,

∆x = |x∗ | · δx = 20 · 0.05 = 1.00


From this, the exact surface is x ∈ [19, 21].

1.2.1 Propagation of errors


Let x and y be two positive values, and x∗ and y ∗ be approximate values of x and
y, respectively. Then we have the following properties:
• For Addition:

– ∆(x + y) = ∆x + ∆y
– δ(x + y) ≤ max(δx, δy)

• For Subtraction:

– ∆(x − y) = ∆x + ∆y
x∗ +y ∗
– δ(x − y) ≤ x∗ −y ∗
max(δx, δy)

9
Numerical Analysis

• For Multiplication:

– ∆(xy) = x∗ ∆y + y ∗ ∆x
– δ(xy) = δx + δy

• For Division:
  ∗ ∗ ∆x
– ∆ xy = x ∆y+y
(y ∗ )2
 
– δ xy = δx + δy

1.3 Significant digits


Definition. Significant digits, also known as significant figures, are the digits
in a number that contribute to its precision. This concept is essential in scientific
measurement and calculations because it reflects the certainty of the values being
represented. Understanding significant figures helps to communicate how accurate a
measurement is and allows for proper rounding in calculations.

Basic Rules to Identify Significant Digits:

1. Non-Zero Digits:

• All non-zero digits are always considered significant.


• Example: In 791.365, all six digits (7, 9, 1, 3, 6, 5) are significant. Thus
it has six significant digits.

2. Leading Zeros:

• Zeros that precede the first non-zero digit are not significant.
• Example: In 0.000279,the leading zeros (0.000) are not significant. Thus
it has three significant digits.

3. Captive Zeros:

• Zeros that are between non-zero digits are significant.


• Example: In 140008, the zeros between 4 and 8 are significant. Thus,
this number has six significant digits.

4. Trailing Zeros:

• Trailing zeros in a decimal number are significant.


• Example: In 9.300 the trailing zeros are significant, giving this number
four significant digits.

10
Numerical Analysis

It is important to note that all digits are significant except for the leading
zeros.

Remark
The number of significant figures of any value expressed in scientific notation
as A × 10k is determined by applying the above rules only to the value of A

In case of ambiguity, scientific notation should be used. For example, the


number of significant digits in 197000 is uncertain, whereas 1.97 × 105 has
three significant digits, 1.970 × 105 has four significant digits and 1.9700 × 105
has five significant digits.

1.3.1 Operations Involving Significant Digits


Addition and subtraction

The result must have the same number of decimal places as the number with
the fewest decimal places among the original numbers.

Example
12.0 + 5 = 17
1.03 + 4.5 + 454.14 = 459.67 (rounded to 459.7);
18.423 + 0.32 = 18.743 (rounded to 18.74).

Multiplication and division

The result must have the same number of significant digits as the number with the
fewest significant digits among the original numbers.

Example

1.1 × 3.28 = 3.608 (rounded to 3.6);


5.2 × 3.12 = 16.224 (rounded to 16);
9.02 ÷ 3.1 = 2.909677 . . . (rounded to 2.9).

1.3.2 Exact significant digits


Definition. The exact or correct significant digit of an approximated value,
refers to any significant digit of that value, determined by the following conditions:

11
Numerical Analysis

• The n-th significant digit after the decimal point is exact (correct) if:

∆x ≤ 0.5 × 10−n

where ∆x represents the absolute error in the approximation.

• The n-th significant digit before the decimal point is exact (correct) if:

∆x ≤ 0.5 × 10n−1

Remark

• If a significant digit is correct, all significant digits to its left are also
correct.

• If a significant digit is not correct, all significant digits to its right are
also not correct.

Example: Let x∗ = 227


≈ 3.1428571428571 an approximate value for x = π ≈
3.14159265358979.The absolute error is given by

Ea (x) = |x∗ − x| ≈ |3.1428571428571 − 3.14159265358979| ≈ 0.001264489.

To check if the significant digits are exact, we compare:

∆x ≤ 0.5 × 10−2 .

Since

0.001264489 ≤ 0.5 × 10−2 ,

this condition holds. Thus, n = 2; furthermore, the digits 3, 1, and 4 are correct
significant digits.
Relation between Relative Error and correct Significant Digits

1. If an approximate number has n correct significant digits, then its rela-


tive error satisfies:
Er(x) ≤ 5 × 10−n

2. If the relative error of x satisfies:

Er(x) ≤ 0.5 × 10−n

then x has at least n correct significant digits.

12
Numerical Analysis

1.4 Rounding-off a number


Rounding a number is an approximate value of that number obtained by reducing
the number of significant figures from its decimal expansion. To round a number to
n significant figures, one must eliminate the digits to the right of the n-th significant
figure preserved; if this occurs after the decimal point, the eliminated digits are
replaced by zeros. The process is as follows:

1. If the (n+1)-th significant figure is greater than 5, add 1 to the n-th significant
figure.

2. If the (n + 1)-th significant figure is less than 5, the retained figures remain
unchanged.

3. If the (n + 1)-th significant figure is equal to 5, then two cases arise:

(a) If all digits discarded after the (n + 1)-th significant figure are zeros:
Then,
• the n-th figure remains unchanged if it is even,
• the n-th figure is increased by 1 if it is odd.
(b) If among the discarded digits after the (n + 1)-th significant figure there
is at least one non-zero digit: Add 1 to the n-th significant figure.

Example
The numbers bellow are rounded-off to five significant digits:

2.14791 to 2.1479 (1 < 5).


0.9843673 to 0.98437 (7 > 5).
12.9835000 to 12.984 (3 is odd).
12.9865000 to 12.986 (6 is even).
99.54350643 to 99.544 there is at least one non-zero digit
among the discarded digits.

If the number x is rounded to n decimal places, then ∆x = 0.5 × 10−n .

1.4.1 Rounding errors


Definition. Rounding error occurs when a number is approximated to a certain
number of decimal places or significant figures. This can lead to a loss of precision in
calculations, as the rounded value may not represent the original number accurately.

13
Numerical Analysis

Example
The true value of π is approximately 3.14159265 . . .. Rounding it to two
decimal places gives:
π ≈ 3.14
The rounding error is:

Eround = |3.1416 − 3.14| = 0.0016

1.5 Truncation error


The term truncation error refers to the error that arises when a smooth function is
approximated by truncating its Taylor series expansion to a finite number of terms.
Example
A third degree polynomial approximation to

f (x) = sin(x), x ∈ [0, 1]

is given by:

x3 sin() 4
sin(x) ≈ x − + x, where  ∈ [0, x]
6 24
Therefore, the truncation error is given by

sin() 4
Etr = x.
24

14
Numerical Analysis

Figure 1.1: Comparison of Sin(x) and its Taylor Series Approximations

15

You might also like