Error Analysis in Numerical Methods

Error analysis is critical for ensuring accuracy in numerical computations, where approximations deviate from exact solutions. The total error is:

\[ E = |x_{\text{exact}} - x_{\text{approx}}| \]

Used in fields like physics, engineering, and data science, error analysis quantifies truncation and round-off errors, their propagation, and control methods. This MathMultiverse guide provides detailed examples, equations, and interactive visualizations to master error analysis.

Types of Errors

Errors in numerical methods are primarily truncation and round-off errors.

Truncation Error

Truncation error results from approximating continuous processes. For the Trapezoidal Rule:

\[ E_{\text{trunc}} = -\frac{(b - a)^3}{12 n^2} f''(\xi), \quad \xi \in [a, b] \]

This \( O(h^2) \) error decreases with smaller step sizes \( h \).

Round-off Error

Round-off error arises from finite-precision arithmetic (e.g., IEEE 754):

\[ \frac{|x - \text{fl}(x)|}{|x|} \leq \epsilon, \quad \epsilon \approx 2.22 \times 10^{-16} \text{ (double precision)} \]

Error Propagation

For \( z = f(x, y) \), absolute error is:

\[ \Delta z \approx \left| \frac{\partial f}{\partial x} \right| \Delta x + \left| \frac{\partial f}{\partial y} \right| \Delta y \]

Ill-conditioned problems amplify errors.

Error Examples

Example 1: Round-off in Summation

Adding 0.1 ten times (single precision, \( \epsilon \approx 1.19 \times 10^{-7} \)) yields \( \approx 0.99999994 \):

\[ \text{Error} = 1 - 0.99999994 = 6 \times 10^{-8} \]

Round-off Error Accumulation

Error growth in iterative summation of 0.1.

Example 2: Truncation in Euler’s Method

For \( \frac{dy}{dt} = -y \), \( y(0) = 1 \), Euler’s Method (\( h = 0.5 \)):

\[ y_2 = 0.25, \quad \text{Exact: } e^{-1} \approx 0.3679 \] \[ \text{Error} = 0.3679 - 0.25 = 0.1179 \]

Example 3: Ill-Conditioning

For \( x^2 - 10000x + 1 = 0 \), roots are \( x_1 \approx 9999.9999 \), \( x_2 \approx 0.0001 \). Floating-point yields \( x_2 \approx 0 \).

Error Control Strategies

Reducing Truncation Error

Smaller \( h \):

\[ E_{\text{trunc}} \propto h^2 \]

Mitigating Round-off

Kahan summation for \( 0.1 \times 10 \):

\[ s = s + (x_i + c), \quad c = (x_i + c) - (s - s_{\text{old}}) \]

Adaptive Methods

Runge-Kutta error estimate:

\[ \text{Error} = |y_{n+1}^{\text{high}} - y_{n+1}^{\text{low}}| \]

Condition Number

For \( f(x) \):

\[ \kappa = \left| \frac{x f'(x)}{f(x)} \right| \]