CHAPTER1-Concept of error
CHAPTER1-Concept of error
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.
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.
r = an an−1 . . . a1 a0 .b1 b2 . . . bm
Where:
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:
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.
Ea (x) = |x − x∗ |.
Example
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 .
Ea (x) = |x − x∗ | ≤ ∆x ⇐⇒ x∗ − ∆x ≤ x ≤ x∗ + ∆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:
Example 2
– ∆(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. Non-Zero 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:
4. Trailing Zeros:
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
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).
The result must have the same number of significant digits as the number with the
fewest significant digits among the original numbers.
Example
11
Numerical Analysis
• The n-th significant digit after the decimal point is exact (correct) if:
∆x ≤ 0.5 × 10−n
• 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.
∆x ≤ 0.5 × 10−2 .
Since
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
12
Numerical Analysis
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.
(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:
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:
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
15