1.10
Numerical Errors: Basic definitions
Definition 1: error
and absolute error
Consider a quantity \(x\), and
\(\tilde{x}\) as an approximation for \(x\), then \(D_{\tilde{x}} = \tilde{x} - x\)
is called the error of \(\tilde{x}\) and \(\left|D_{\tilde{x}}\right|=\left|\tilde{x}-x\right|\)
the absolute error of \(\tilde{x}\).
Examples:
| | \begin{equation*} \begin{array}{lrcr}
1.\quad & x=2.1, \ \tilde{x}=2 & & \Rightarrow \ D_{\tilde{x}}=-0.1, \left|D_{\tilde{x}}\right|=0.1\\ \rule{0mm}{0.7em}
2.\quad & x=\sqrt{2}, \ \tilde{x}=1.4 & \ & \Rightarrow \ D_{\tilde{x}}=\; ?\\ \rule{0mm}{0.7em} 3.\quad & x=\pi, \ \tilde{x}=3.14
& & \Rightarrow \ D_{\tilde{x}}=\; ? \end{array} \end{equation*} | (1.12) |
In general, the error cannot be determined exactly, because we don’t know the exact
value of \(x\). In this case, we try a (possibly small) bound for specifying the absolute error.
Definition 2:
absolute maximum error
Consider a quantity \(x\),
and \(\tilde{x}\) as an approximation for \(x\), and \(a\gt 0\) a number with \(\left|D_{\tilde{x}}\right|\leq a\), then \(a\) is an absolute maximum error of \(\tilde{x}\).
Example:
| | \begin{equation*} \begin{split}
&\text{Consider } x=\sqrt{2}, \ \tilde{x} =1.4; \ \text{estimation for $a$?}\\ &\rule{0mm}{0.6em} \text{Since} \ 1.4^2=1.96\lt2
\ \text{and} \ 1.42^2=2.0164\gt 2, \\ &\rule{0mm}{0.6em} \text{one has that } 1.4\lt\sqrt{2}\lt 1.42, \text{ therefore}
\\ &\rule{0mm}{0.6em} \mbox{$\left|\sqrt{2}-1.4\right|$}=\sqrt{2}-1.4 \lt 1.42-1.4 = 0.02 = a. \end{split} \end{equation*} | (1.13) |
(0.015 could also be derived as a maximum error for this example.)
Definition 3:
relative error
Consider a quantity \(x\), and \(\tilde{x}\) as an approximation for \(x\), \(x\neq0\), then \({\left|D_{\tilde{x}}\right|}/{\left|x\right|}\)
is called the relative (percentage) error of \(\tilde{x}\). Since \(x\) is often not known, the
relative error is estimated by \({\left|D_{\tilde{x}}\right|}/{\left|\tilde{x}\right|}\).
Examples:
| | \begin{equation*} \begin{array}{rl}
1. \quad x&=100\,\text{m}=10000\,\text{cm}, \ \left|D_{\tilde{x}}\right|=1\,\text{cm} \ \Rightarrow \ \displaystyle\frac{\left|D_{\tilde{x}}\right|}{\left|x\right|}=\frac{1}{10000}=0.0001=
0.01\,\ \\ 2. \quad x&=2\,\text{cm}, \ \left|D_{\tilde{x}}\right|=1\,\text{cm} \ \Rightarrow \ \displaystyle\frac{\left|D_{\tilde{x}}\right|}{\left|x\right|}=\frac{1}{2}=0.5=
50\,\ \end{array} \end{equation*} | (1.14) |
Definition 4:
significant digits
The amount of significant digits is a measure
of the accuracy
of an approximative number. It is determined as follows:
1. Consider a quantity \(x\),
\(\left|x\right|\geq 1\), and \(\tilde{x}\) as an approximation for \(x\), given
as a decimal number with the digits \(\pm a_k\,a_{k-1}\,\ldots\,a_1\,a_0\,.\,a_{-1}\,a_{-2}\,\ldots\,a_{-n}\),
i.e. each \(a_i\in\{0,1,...,9\}\) representing the value \(a_i \times 10^i\), \(a_k\neq0\).
Let \(j\) denote the smallest integer with \(\left|\tilde{x}-x\right|\leq\frac{1}{2}\times10^j\).
Then we call the digit \(a_j\) of \(\tilde{x}\) significant (or secure) and likewise, all the
digits on the left of \(a_j\).
Example:
| | \begin{equation*} \begin{split}
&\text{Consider }x=23.494321, \ \tilde{x}=23.496; \text{ how many significant digits?}\\ &\text{Since } 0.0005\lt\left|\tilde{x}-x\right|=0.001679\leq0.005=\textstyle\frac{1}{2}\times10^{-2},
\ \text{one has that} \ j=-2.\\ &\tilde{x}=23.496 \ \Rightarrow \ \text{start\ counting\ from\ the\ 9\ until\ the\ beginning\
of\ the\ number}\\ &\mbox{$\Rightarrow$} \ \text{4\ significant\ digits\ (places).} \end{split} \end{equation*} | (1.15) |
2. Consider a quantity \(x\), \(\left|x\right|\lt 1\), and \(\tilde{x}\) as an approximation
for \(x\), given as a decimal number with the digits \(\pm 0.\,a_{-1}\,a_{-2}\,\ldots\,a_{-n}\),
i.e. each \(a_i\in\{0,1,...,9\}\) representing the value \(a_i \times 10^i\). Let \(j\) denote the smallest integer with \(\left|\tilde{x}-x\right|\leq\frac{1}{2}\times10^j\). Then we
call the digit \(a_j\) of \(\tilde{x}\) significant (or secure) and likewise, all the digits on
the left of \(a_j\) up to the front digit \(\neq 0\).
Example:
| | \begin{equation*} \begin{split}
&\text{Consider }x=0.02144, \ \tilde{x}=0.02138; \text{ how many significant digits?}\\ &\text{Since } 0.00005\lt\left|\tilde{x}-x\right|=0.00006\leq0.0005=\textstyle\frac{1}{2}\times10^{-3},
\ \text{one has that} \ j=-3.\\ &\tilde{x}=0.02138 \ \Rightarrow \ \text{start\ counting\ from\ the\ 1\ to\ the\ left\ until\
the\ last\ digit\ $\neq0$} \\ &\text{(i.e.,\ until\ only\ zeros\ follow)} \ \mbox{$\Rightarrow$} \ \text{2\ significant\
digits\ (places).} \end{split} \end{equation*} | (1.16) |
Remark: accuracy
vs. precision
A number can be highly precise but completely inaccurate
(many places, but none of them significant).
© J. Carstensen (Comp. Math.)