# Numerical stability

In the mathematical subfield of numerical analysis, numerical stability is a property of numerical algorithms. It describes how errors in the input data propagate through the algorithm. In a stable method, the errors due to the approximations get damped out as the computation proceeds. In an unstable method, any errors in processing get magnified as the calculation proceeds. Unstable methods quickly generate garbage and are useless for numerical processing.

The numerical stability of a method together with the condition number defines how good a result we can get when using approximated methods to calculate a certain mathematical problem.

Sometimes a single calculation can be achieved in several ways, all of which are algebraically identically in terms of ideal real or complex numbers, but in practice yield different results as they have different levels of numerical stability. One of the common tasks of numerical analysis is to try to select algorithms which are robust -- that is to say, have good numerical stability in a wide range of situations. These methods are often made available to users of programming languages as mathematical computing libraries. The appropriate use of mathematical computing libraries is usually far superior to "roll you own" numerical algorithms.

## Definition

Given an algorithm f(x), with x the input data and ε the error in the input data, we say the algorithm is numerically stable for the relative error if

[itex]x - (x + \epsilon) \simeq f(x) - f(x + \epsilon)[itex]

and numerically stable for the absolute error if

[itex]\frac{x - (x + \epsilon)}{x} \simeq \frac{f(x) - f(x + \epsilon)}{f(x)}[itex]

We say an algorithm is numerically unstable if

[itex]x - (x + \epsilon) << f(x) - f(x + \epsilon)\ [itex]

and numerically unstable for the absolute error if

[itex]\frac{x - (x + \epsilon)}{x} << \frac{f(x) - f(x + \epsilon)}{f(x)}[itex]

## Notes

In calculating numerical solutions to certain partial differential equations, stability is sometimes achieved by including numerical diffusion. Numerical diffusion is a mathematical term which insures that roundoff and other errors in the calculation get spread out and do not add up to cause the calculation to "blow up".

Numerical stability is the reason why you usually can't test a numerical code such as a climate simulation by running it backward. Running the code forward includes numerical methods to insure that the random approximation errors become less and less important as the calculation proceed insuring numerical stability. Running the code backward causes those mechanisms to magnify those errors generating useless results.

When solving a numerical problem with an approximated method, two types of errors can occur:

• Truncation errors: One can only make a finite number of calculations. Examples: calculating a transcendental function using its Taylor expansion, integrating using a sum of finite rectangles.
• Roundoff errors: Certain numbers need an infinite number of digits to be represented (pi), when rounding these numbers the roundoff errors will propagate through the calculation.cs:Stabilita numerické metody

• Art and Cultures
• Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
• Space and Astronomy