| .. | ||
| Readme.md | ||
Error Analysis
In computational applications there are two main sources of error that we need to worry about:
- roundoff (or rounding) errors
- approximation errors
Rounding errors originate from the necessity of having to represent numbers in a computer using a finite number of digits. Approximation errors, instead, refer to those errors that are intrinsic of the way we numerically solve a specific problem. In particular, these would be present even in the ideal case where we were able to carry out the computation without rounding errors.
A simple example of approximation error can be seen in the case where we estimate the value of the function
e^x = \sum_{n=0}^{\infty} {x^n\over n!} = 1 + x + {x^2\over 2} + {x^3\over 3!} + \ldots
\
\approx
\sum_{n=0}^{n_{\rm max}} {x^n\over n!},,
by evaluating the series only up to a finite order n_{\rm max}<\infty. In this case, the approximation comes with a truncation error of {\rm O}(x^{n_{\rm max}+1}).
:::i "Info" aasdasdasd :::
Note
Let
f(x)andg(x)be two functions defined on some unbounded subsetDof the positive real numbers, andg(x)be non-zero in a neighborhood ofa\in D(oftena=0). We writef(x)={\rm O}(g(x)) \quad \text{as} \quad x\to a
if there exist positive numbers
\deltaandMsuch that for allxwith0 < |x-a| < \delta,
|f(x)| \leq M |g(x)|,.
Equivalently, we may say that
f(x)={\rm O}(g(x))if
\underset{x\to a}{\lim \sup}{|f(x)|\over |g(x)|}<\infty,.
If, instead, it holds that
\underset{x\to a}{\lim}{f(x)\over g(x)}=1,,
we write
f(x) \sim g(x)asx\to a.
In this chapter, we present a general discussion on roundoff errors, not tied to a specific numerical problem we want to solve. In later chapters, we discuss several different methods to solve specific problems and study their approximation errors in detail.
Exercises
-
Consider the function
f(x)=e^xin the intervalx\in [0,1]. Write a program that calculates the corresponding approximating series:g_N(x)=\sum_{n=0}^N {x^n\over n!},.(a) Verify that the absolute error
\Delta=|f(x)-g_N(x)|scales approximately withx^{N+1}/(N+1)!forN=1,2,3,4.(b) The error
\Delta, in the given interval inx, differs fromx^{N+1}/(N+1)!. Why is that and for which values ofx?