No history yet

Error Analysis

The Reality of Numbers

In a perfect world, our calculations would be exact. Every number would be precise, and every answer would be spot on. But in the world of computing and numerical methods, things are a little different. Computers, for all their power, can't store numbers with infinite precision. This simple fact is the starting point for understanding numerical errors.

Think of it this way: when we solve problems with numbers, especially on a computer, we are often working with approximations. These aren't mistakes in the sense of a wrong calculation, but rather tiny inaccuracies inherent in how numbers are represented and manipulated. Error analysis is the study of these inaccuracies. It helps us understand how reliable our results are.

Two Types of Errors

Numerical errors generally fall into two main categories: round-off error and truncation error. They come from different sources, but both can affect the outcome of your calculations.

Round-off error happens because computers have a limited amount of memory to store numbers. Irrational numbers like π\pi or fractions like 1/31/3 have decimal representations that go on forever. A computer has to cut, or "round off," these numbers at some point.

For example, 1/31/3 is 0.33333...0.33333... A computer might store this as 0.33333333333333330.3333333333333333. The tiny piece that's missing is the round-off error. While one small error might seem harmless, these can add up in long calculations, leading to significant inaccuracies.

Lesson image

Truncation error occurs when we use an approximation to stand in for an exact mathematical procedure. Many complex calculations, like finding the area under a curve (integration), are impossible to solve perfectly with simple arithmetic. Instead, we use methods that get us very close to the answer.

Imagine approximating the area under a curve by filling it with rectangles and summing their areas. The small gaps between the tops of the rectangles and the curve itself represent the truncation error. You are "truncating," or cutting short, an infinite process to get a usable answer. Using more, narrower rectangles reduces the error, but it never completely disappears.

Lesson image

How Errors Grow

Errors are rarely static. An initial round-off or truncation error in one step of a process can affect all subsequent steps. This is called error propagation.

Imagine building a tower of LEGO blocks. If the very first block is placed at a slight angle—a tiny initial error—the next block will be a bit more tilted. As you build higher, the tilt gets worse and worse. By the top, the tower might be leaning significantly. The initial small error propagated through the entire construction.

In calculations, this can happen when you subtract two numbers that are very close to each other. If both numbers have a small round-off error, subtracting them can cancel out the accurate leading digits, leaving you with a result that is mostly noise. This is known as catastrophic cancellation and is a dramatic example of error propagation.

Stable vs. Unstable

This leads to the crucial concept of numerical stability. A numerical algorithm is considered stable if it doesn't cause errors to grow uncontrollably. An unstable algorithm, on the other hand, is like that leaning tower of blocks—small initial errors can get magnified to the point where the final result is meaningless.

stable

adjective

An algorithm where initial errors remain small and do not grow wildly during computation.

For example, consider an iterative process where the result of one step is the input for the next. If the calculation at each step is unstable, the error can multiply exponentially. After a hundred iterations, the accumulated error might be larger than the actual answer you were looking for.

The goal in numerical analysis isn't just to find an algorithm that works in theory, but to find one that is stable in practice. A stable algorithm gives you confidence that your answer is a reasonable approximation of the true value.

Understanding these types of errors and how they behave is the first step toward performing accurate and reliable numerical computations. It allows us to choose the right methods for a problem and to interpret our results with a healthy dose of reality.