Error definitions

TME 310 - Computational Physical Modeling

Lorne Arnold, PhD, PE

University of Washington Tacoma

Absolute and relative error (true)

The true absolute error, \(E_t\), is the difference between the true value and our approximation:

\[E_t = \text{true} - \text{approx}\]

The true relative error, \(\epsilon_t\) is:

\[\epsilon_t = \frac{\text{true} - \text{approx}}{\text{true}} (\text{often}\times 100\%)\]

\[\epsilon_t = \frac{E_t}{\text{true}} (\text{often}\times 100\%)\]

Absolute and relative error (approx.)

We rarely know the true value (why approximate what we know exactly?)

The approximate absolute error, \(E_a\) is:

\[E_a = \text{current approx} - \text{previous approx}\]

The approximate relative error, \(\epsilon_a\) is:

\[\epsilon_a = \frac{E_a}{\text{current approx}} (\text{often}\times 100\%)\]

Key differences

With approximate errors:

  • We do not need to know the true value
  • We must perform the calculation iteratively
  • We assume that our solution converges
    • If it doesn’t we likely have a problem with our model.

Example - \(\sqrt[3]{250}\)

num = 250.0; guess = 100.0 # find cubed root of "num" with initial "guess"
for i in range(10):
    new_guess = (2 * guess + num / guess**2) / 3 # some approx. method
    E_a = new_guess - guess # Approx. absolute error
    e_a = E_a / new_guess  # Approx. relative error
    guess = new_guess
Iter.       Guess        E_a     e_a(%)
---------------------------------------
1        66.675000 -33.3250   -49.98
2        44.468745 -22.2063   -49.94
3        29.687972 -14.7808   -49.79
4        19.886530  -9.8014   -49.29
5        13.468404  -6.4181   -47.65
6         9.438331  -4.0301   -42.70
7         7.227688  -2.2106   -30.59
8         6.413676  -0.8140   -12.69
9         6.301622  -0.1121    -1.78
10        6.299606  -0.0020    -0.03

Example - cubed root of 250 (plot)

Visualize the algorithm’s convergence with a plot

Which to use?

Think about each scenario critically.

Often best to use an approximate relative error method (\(\epsilon_a\)) when:

  • Target unknown
  • Not converging near zero

When converging to zero (known target), true absolute error method often best.