In numerical analysis, catastrophic cancellation [1] [2] is the phenomenon that subtracting good approximations to two nearby numbers may yield a very bad approximation to the difference of the original numbers.
For example, if there are two studs, one long and the other long, and they are measured with a ruler that is good only to the centimeter, then the approximations could come out to be and . These may be good approximations, in relative error, to the true lengths: the approximations are in error by less than 2% of the true lengths, .
However, if the approximate lengths are subtracted, the difference will be , even though the true difference between the lengths is . The difference of the approximations, , is in error by almost 100% of the magnitude of the difference of the true values, .
Catastrophic cancellation is not affected by how large the inputs are—it applies just as much to large and small inputs. It depends only on how large the difference is, and on the error of the inputs. Exactly the same error would arise by subtracting from as approximations to and , or by subtracting from as approximations to and .
Catastrophic cancellation may happen even if the difference is computed exactly, as in the example above—it is not a property of any particular kind of arithmetic like floating-point arithmetic; rather, it is inherent to subtraction, when the inputs are approximations themselves. Indeed, in floating-point arithmetic, when the inputs are close enough, the floating-point difference is computed exactly, by the Sterbenz lemma —there is no rounding error introduced by the floating-point subtraction operation.
Formally, catastrophic cancellation happens because subtraction is ill-conditioned at nearby inputs: even if approximations and have small relative errors and from true values and , respectively, the relative error of the difference of the approximations from the difference of the true values is inversely proportional to the difference of the true values:
Thus, the relative error of the exact difference of the approximations from the difference of the true values is
which can be arbitrarily large if the true values and are close.
Subtracting nearby numbers in floating-point arithmetic does not always cause catastrophic cancellation, or even any error—by the Sterbenz lemma, if the numbers are close enough the floating-point difference is exact. But cancellation may amplify errors in the inputs that arose from rounding in other floating-point arithmetic.
Given numbers and , the naive attempt to compute the mathematical function by the floating-point arithmetic is subject to catastrophic cancellation when and are close in magnitude, because the subtraction can expose the rounding errors in the squaring. The alternative factoring , evaluated by the floating-point arithmetic , avoids catastrophic cancellation because it avoids introducing rounding error leading into the subtraction. [2]
For example, if and , then the true value of the difference is . In IEEE 754 binary64 arithmetic, evaluating the alternative factoring gives the correct result exactly (with no rounding), but evaluating the naive expression gives the floating-point number , of which less than half the digits are correct and the other (underlined) digits reflect the missing terms , lost due to rounding when calculating the intermediate squared values.
When computing the complex arcsine function, one may be tempted to use the logarithmic formula directly:
However, suppose for . Then and ; call the difference between them —a very small difference, nearly zero. If is evaluated in floating-point arithmetic giving
with any error , where denotes floating-point rounding, then computing the difference
of two nearby numbers, both very close to , may amplify the error in one input by a factor of —a very large factor because was nearly zero. For instance, if , the true value of is approximately , but using the naive logarithmic formula in IEEE 754 binary64 arithmetic may give , with only five out of sixteen digits correct and the remainder (underlined) all incorrect.
In the case of for , using the identity avoids cancellation because but , so the subtraction is effectively addition with the same sign which does not cancel.
Numerical constants in software programs are often written in decimal, such as in the C fragment doublex=1.000000000000001;
to declare and initialize an IEEE 754 binary64 variable named x
. However, is not a binary64 floating-point number; the nearest one, which x
will be initialized to in this fragment, is . Although the radix conversion from decimal floating-point to binary floating-point only incurs a small relative error, catastrophic cancellation may amplify it into a much larger one:
doublex=1.000000000000001;// rounded to 1 + 5*2^{-52}doubley=1.000000000000002;// rounded to 1 + 9*2^{-52}doublez=y-x;// difference is exactly 4*2^{-52}
The difference is . The relative errors of x
from and of y
from are both below , and the floating-point subtraction y - x
is computed exactly by the Sterbenz lemma.
But even though the inputs are good approximations, and even though the subtraction is computed exactly, the difference of the approximations has a relative error of over from the difference of the original values as written in decimal: catastrophic cancellation amplified a tiny error in radix conversion into a large error in the output.
Cancellation is sometimes useful and desirable in numerical algorithms. For example, the 2Sum and Fast2Sum algorithms both rely on such cancellation after a rounding error in order to exactly compute what the error was in a floating-point addition operation as a floating-point number itself.
The function , if evaluated naively at points , will lose most of the digits of in rounding . However, the function itself is well-conditioned at inputs near . Rewriting it as
exploits cancellation in to avoid the error from evaluated directly. [2] This works because the cancellation in the numerator and the cancellation in the denominator counteract each other; the function is well-enough conditioned near zero that gives a good approximation to , and thus gives a good approximation to .
In numerical analysis, the condition number of a function measures how much the output value of the function can change for a small change in the input argument. This is used to measure how sensitive a function is to changes or errors in the input, and how much error in the output results from an error in the input. Very frequently, one is solving the inverse problem: given one is solving for x, and thus the condition number of the (local) inverse must be used.
In computing, floating-point arithmetic (FP) is arithmetic that represents subsets of real numbers using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. Numbers of this form are called floating-point numbers. For example, 12.345 is a floating-point number in base ten with five digits of precision:
In numerical analysis, polynomial interpolation is the interpolation of a given bivariate data set by the polynomial of lowest possible degree that passes through the points of the dataset.
In thermodynamics, the Helmholtz free energy is a thermodynamic potential that measures the useful work obtainable from a closed thermodynamic system at a constant temperature (isothermal). The change in the Helmholtz energy during a process is equal to the maximum amount of work that the system can perform in a thermodynamic process in which temperature is held constant. At constant temperature, the Helmholtz free energy is minimized at equilibrium.
Quantization, in mathematics and digital signal processing, is the process of mapping input values from a large set to output values in a (countable) smaller set, often with a finite number of elements. Rounding and truncation are typical examples of quantization processes. Quantization is involved to some degree in nearly all digital signal processing, as the process of representing a signal in digital form ordinarily involves rounding. Quantization also forms the core of essentially all lossy compression algorithms.
The great-circle distance, orthodromic distance, or spherical distance is the distance along a great circle.
In computing, a roundoff error, also called rounding error, is the difference between the result produced by a given algorithm using exact arithmetic and the result produced by the same algorithm using finite-precision, rounded arithmetic. Rounding errors are due to inexactness in the representation of real numbers and the arithmetic operations done with them. This is a form of quantization error. When using approximation equations or algorithms, especially when using finitely many digits to represent real numbers, one of the goals of numerical analysis is to estimate computation errors. Computation errors, also called numerical errors, include both truncation errors and roundoff errors.
In control theory and signal processing, a linear, time-invariant system is said to be minimum-phase if the system and its inverse are causal and stable.
In statistics, G-tests are likelihood-ratio or maximum likelihood statistical significance tests that are increasingly being used in situations where chi-squared tests were previously recommended.
In statistics, the delta method is a method of deriving the asymptotic distribution of a random variable. It is applicable when the random variable being considered can be defined as a differentiable function of a random variable which is asymptotically Gaussian.
In mathematics, the lemniscate elliptic functions are elliptic functions related to the arc length of the lemniscate of Bernoulli. They were first studied by Giulio Fagnano in 1718 and later by Leonhard Euler and Carl Friedrich Gauss, among others.
In any quantitative science, the terms relative change and relative difference are used to compare two quantities while taking into account the "sizes" of the things being compared, i.e. dividing by a standard or reference or starting value. The comparison is expressed as a ratio and is a unitless number. By multiplying these ratios by 100 they can be expressed as percentages so the terms percentage change, percent(age) difference, or relative percentage difference are also commonly used. The terms "change" and "difference" are used interchangeably.
The differentiation of trigonometric functions is the mathematical process of finding the derivative of a trigonometric function, or its rate of change with respect to a variable. For example, the derivative of the sine function is written sin′(a) = cos(a), meaning that the rate of change of sin(x) at a particular angle x = a is given by the cosine of that angle.
In computational learning theory, Rademacher complexity, named after Hans Rademacher, measures richness of a class of sets with respect to a probability distribution. The concept can also be extended to real valued functions.
In mathematics, Pythagorean addition is a binary operation on the real numbers that computes the length of the hypotenuse of a right triangle, given its two sides. According to the Pythagorean theorem, for a triangle with sides and , this length can be calculated as
For certain applications in linear algebra, it is useful to know properties of the probability distribution of the largest eigenvalue of a finite sum of random matrices. Suppose is a finite sequence of random matrices. Analogous to the well-known Chernoff bound for sums of scalars, a bound on the following is sought for a given parameter t:
In statistics, Whittle likelihood is an approximation to the likelihood function of a stationary Gaussian time series. It is named after the mathematician and statistician Peter Whittle, who introduced it in his PhD thesis in 1951. It is commonly used in time series analysis and signal processing for parameter estimation and signal detection.
In quantum information and computation, the Solovay–Kitaev theorem says that if a set of single-qubit quantum gates generates a dense subgroup of SU(2), then that set can be used to approximate any desired quantum gate with a short sequence of gates that can also be found efficiently. This theorem is considered one of the most significant results in the field of quantum computation and was first announced by Robert M. Solovay in 1995 and independently proven by Alexei Kitaev in 1997. Michael Nielsen and Christopher M. Dawson have noted its importance in the field.
In floating-point arithmetic, the Sterbenz lemma or Sterbenz's lemma is a theorem giving conditions under which floating-point differences are computed exactly. It is named after Pat H. Sterbenz, who published a variant of it in 1974.
A Stein discrepancy is a statistical divergence between two probability measures that is rooted in Stein's method. It was first formulated as a tool to assess the quality of Markov chain Monte Carlo samplers, but has since been used in diverse settings in statistics, machine learning and computer science.
{{cite book}}
: CS1 maint: location (link)