Introduction
Theory
HOWTO
Examples
Questions
Matlab
Maple

# Introduction

There are two techniques for measuring error: the absolute
error of an approximation and the relative error of the
approximation. The first gives how large the error is, while
the second gives how large the error is relative to the correct value.

## Background

None.

## References

# Theory

# Absolute Error

Given an approximation *a* of a correct value *x*, we define the absolute
value of the difference between the two values to be the *absolute error*. We
will represent the absolute error by *E*_{abs}, therefore

It is often sufficient to record only two decimal digits of the absolute
error. Thus, it is sufficient to state that the absolute error of the
approximation 3.55 to the correct value 3.538385 is 0.012.

There are two problems with using the absolute error:

## Significance

It gives you a feeling of the size of the error but how significant is the
error? If the absolute error was 3.52, is this significant? If the correct value
is *x* = 5030235.23,
then probably not, however if the correct value is *x* = 5.03023523, then
an absolute error 3.52 is probably very significant.

## Units

The absolute error will change depending on the units used. The absolute
error of the approximation 2.4 MV of an actual voltage of 2.573243 MV is
0.17 MV, whereas the absolute error of the approximation 2400000 V to an actual
voltage of 2573243 V is 170000 V.

# Relative Error

To solve the problems of significance and units, we may compare the absolute error
relative to the correct value. Thus, we define the *relative error* to be the
ratio between the absolute error and the absolute value of the correct value and
denote it by *E*_{rel}:

In this equation, any units cancel, so the relative errors of the
approximations 2.4 MV and 2400000 V versus the actual voltages of 2.573243 MV
and 2573243 V, respectively, are equal. Also, a relative error of 0.01 means
that the approximation is correct to within one part in one hundred, regardless
of the size of the actual value. Whether this is sufficiently accurate depends
on the requirements.

In this class, we will usually use the relative error, though if we are only
trying to show that a sequence of errors is decreasing to zero, we may use the absolute error
(if a sequence of absolute errors is going to zero, then the relative errors will go to zero, too).

One problem with using the relative error is when the correct value is zero (0), but
this seldom appears in real-life situations.

On occasion, the relative error by 100 and refer to
as the *percent relative error*.

# HOWTO

# Calculating Absolute Error

Given an approximation *a* of a value *x*, the absolute
error *E*_{abs} is calculated using the formula:

# Calculating Relative Error

Given an approximation *a* of a value *x*, the relative
error *E*_{rel} is calculated using the formula:

# Examples

1. What are the absolute and relative errors of the approximation
3.14 to the value
π?

E_{abs} = |3.14 - π| ≈ 0.0016

E_{rel} = |3.14 - π|/|π| ≈ 0.00051

2. A resistor labeled as 240 Ω is actually 243.32753 Ω. What are the
absolute and relative errors of the labeled value?

E_{abs} = |240 - 243.32753| ≈ 3.3 Ω

E_{rel} = |240 - 243.32753|/|243.32753| ≈ 0.014

Note: the label is the approximation of the actual value.

3. The voltage in a high-voltage transmission line is stated to be
2.4 MV while
the actual voltage may range from 2.1 MV to 2.7 MV. What is the maximum absolute
and relative error of voltage?

E_{abs} = |2.4 - 2.1| = 0.3 MV

E_{rel} = |2.4 - 2.1|/|2.1| ≈ 0.14

E_{abs} = |2.4 - 2.7| = 0.3 MV

E_{rel} = |2.4 - 2.7|/|2.7| ≈ 0.11

Thus, the maximum absolute error is 0.3 MV but the maximum relative error is 0.14.

Note: as before, the stated voltage is an approximation of the actual voltage.

# Questions

1. What are the absolute and relative errors of the approximation 22/7 of π? (0.0013 and 0.00040)

2. What are the absolute and relative errors of the approximation 355/113 of π? (2.7e-7 and 8.5e-8)

3. A capacitor is labeled as 100 mF whereas it is actually 108.2532 mF. What are the absolute and
relative errors of the label? (8.2 mF and 0.076)

# Matlab

Absolute and relative errors may be easily calculated in Matlab:

>> abs( 22/7 - pi )
>> abs( 22/7 - pi ) / abs( pi )

# Maple

Absolute and relative errors may be easily calculated in Maple:

abs( 22/7 - Pi );
evalf( % ); # % refers to the previous calculation
abs( 22/7 - Pi ) / abs( Pi );
evalf( % ); # % refers to the previous calculation