Affine Arithmetic
   HOME

TheInfoList



OR:

Affine arithmetic (AA) is a model for self-validated
numerical analysis Numerical analysis is the study of algorithms that use numerical approximation (as opposed to symbolic computation, symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete mathematics). It is the study of ...
. In AA, the quantities of interest are represented as
affine combination In mathematics, an affine combination of is a linear combination : \sum_^ = \alpha_ x_ + \alpha_ x_ + \cdots +\alpha_ x_, such that :\sum_^ =1. Here, can be elements ( vectors) of a vector space over a field , and the coefficients \alpha_ a ...
s (affine forms) of certain primitive variables, which stand for sources of uncertainty in the data or approximations made during the computation. Affine arithmetic is meant to be an improvement on
interval arithmetic Interval arithmetic (also known as interval mathematics, interval analysis, or interval computation) is a mathematical technique used to put bounds on rounding errors and measurement errors in mathematical computation. Numerical methods using ...
(IA), and is similar to generalized interval arithmetic, first-order Taylor arithmetic, the center-slope model, and ellipsoid calculus — in the sense that it is an automatic method to derive first-order guaranteed approximations to general formulas. Affine arithmetic is potentially useful in every numeric problem where one needs guaranteed enclosures to smooth functions, such as solving
system A system is a group of Interaction, interacting or interrelated elements that act according to a set of rules to form a unified whole. A system, surrounded and influenced by its environment (systems), environment, is described by its boundaries, ...
s of non-linear equations, analyzing
dynamical system In mathematics, a dynamical system is a system in which a Function (mathematics), function describes the time dependence of a Point (geometry), point in an ambient space. Examples include the mathematical models that describe the swinging of a ...
s, integrating functions,
differential equation In mathematics, a differential equation is an equation that relates one or more unknown functions and their derivatives. In applications, the functions generally represent physical quantities, the derivatives represent their rates of change, an ...
s, etc. Applications include ray tracing, plotting
curve In mathematics, a curve (also called a curved line in older texts) is an object similar to a line (geometry), line, but that does not have to be Linearity, straight. Intuitively, a curve may be thought of as the trace left by a moving point (ge ...
s, intersecting
implicit Implicit may refer to: Mathematics * Implicit function * Implicit function theorem * Implicit curve * Implicit surface * Implicit differential equation Other uses * Implicit assumption, in logic * Implicit-association test, in social psychology ...
and
parametric surface A parametric surface is a surface in the Euclidean space \R^3 which is defined by a parametric equation with two parameters Parametric representation is a very general way to specify a surface, as well as implicit representation. Surfaces that oc ...
s,
error analysis (mathematics) In mathematics, error analysis is the study of kind and quantity of error, or uncertainty, that may be present in the solution to a problem. This issue is particularly prominent in applied areas such as numerical analysis and statistics. Error an ...
,
process control An industrial process control in continuous production processes is a discipline that uses industrial control systems to achieve a production level of consistency, economy and safety which could not be achieved purely by human manual control. I ...
, worst-case analysis of
electric circuit An electrical network is an interconnection of electrical components (e.g., batteries, resistors, inductors, capacitors, switches, transistors) or a model of such an interconnection, consisting of electrical elements (e.g., voltage sources, c ...
s, and more.


Definition

In affine arithmetic, each input or computed quantity ''x'' is represented by a formula x = x_0 + x_1 \epsilon_1 + x_2 \epsilon_2 + \cdots + x_n \epsilon_n where x_0, x_1, x_2,\dots, x_n are known floating-point numbers, and \epsilon_1, \epsilon_2,\dots,\epsilon_n are symbolic variables whose values are only known to lie in the range
1,+1 Onekama ( ) is a village in Manistee County in the U.S. state of Michigan. The population was 411 at the 2010 census. The village is located on the shores of Portage Lake and is surrounded by Onekama Township. The town's name is derived from "On ...
Thus, for example, a quantity ''X'' which is known to lie in the range ,7can be represented by the affine form x = 5 + 2 \epsilon_k, for some ''k''. Conversely, the form x = 10 + 2 \epsilon_3 - 5 \epsilon_8 implies that the corresponding quantity ''X'' lies in the range ,17 The sharing of a symbol \epsilon_j among two affine forms x, y implies that the corresponding quantities ''X'', ''Y'' are partially dependent, in the sense that their joint range is smaller than the
Cartesian product In mathematics, specifically set theory, the Cartesian product of two sets ''A'' and ''B'', denoted ''A''×''B'', is the set of all ordered pairs where ''a'' is in ''A'' and ''b'' is in ''B''. In terms of set-builder notation, that is : A\ti ...
of their separate ranges. For example, if x = 10 + 2 \epsilon_3 - 6 \epsilon_8 and y = 20 + 3 \epsilon_4 + 4 \epsilon_8, then the individual ranges of ''X'' and ''Y'' are ,18and 3,27 but the joint range of the pair (''X'',''Y'') is the
hexagon In geometry, a hexagon (from Ancient Greek, Greek , , meaning "six", and , , meaning "corner, angle") is a six-sided polygon. The total of the internal angles of any simple polygon, simple (non-self-intersecting) hexagon is 720°. Regular hexa ...
with corners (2,27), (6,27), (18,19), (18,13), (14,13), (2,21) — which is a proper subset of the
rectangle In Euclidean plane geometry, a rectangle is a quadrilateral with four right angles. It can also be defined as: an equiangular quadrilateral, since equiangular means that all of its angles are equal (360°/4 = 90°); or a parallelogram containi ...
,183,27


Affine arithmetic operations

Affine forms can be combined with the standard arithmetic operations or elementary functions, to obtain guaranteed approximations to formulas.


Affine operations

For example, given affine forms x,y for ''X'' and ''Y'', one can obtain an affine form z for ''Z'' = ''X'' + ''Y'' simply by adding the forms — that is, setting z_j \gets x_j + y_j for every ''j''. Similarly, one can compute an affine form z for ''Z'' = \alpha''X'', where \alpha is a known constant, by setting z_j \gets \alpha x_j for every ''j''. This generalizes to arbitrary affine operations like ''Z'' = \alpha''X'' + \beta''Y'' + \gamma.


Non-affine operations

A non-affine operation Z \gets F(X,Y,\dots), like multiplication Z \gets X Y or Z \gets \sin(X), cannot be performed exactly, since the result would not be an affine form of the \epsilon_i. In that case, one should take a suitable affine function ''G'' that approximates ''F'' to first order, in the ranges implied by x and y; and compute z \gets G(x,y,\dots) + z_k\epsilon_k, where z_k is an upper bound for the absolute error , F-G, in that range, and \epsilon_k is a new symbolic variable not occurring in any previous form. The form z then gives a guaranteed enclosure for the quantity ''Z''; moreover, the affine forms x,y,\dots,z jointly provide a guaranteed enclosure for the point (''X'',''Y'',...,''Z''), which is often much smaller than the Cartesian product of the ranges of the individual forms.


Chaining operations

Systematic use of this method allows arbitrary computations on given quantities to be replaced by equivalent computations on their affine forms, while preserving first-order correlations between the input and output and guaranteeing the complete enclosure of the joint range. One simply replaces each arithmetic operation or elementary function call in the formula by a call to the corresponding AA library routine. For smooth functions, the approximation errors made at each step are proportional to the square ''h''2 of the width ''h'' of the input intervals. For this reason, affine arithmetic will often yield much tighter bounds than standard interval arithmetic (whose errors are proportional to ''h'').


Roundoff errors

In order to provide guaranteed enclosure, affine arithmetic operations must account for the roundoff errors in the computation of the resulting coefficients z_j. This cannot be done by rounding each z_j in a specific direction, because any such rounding would falsify the dependencies between affine forms that share the symbol \epsilon_j. Instead, one must compute an upper bound \delta_j to the roundoff error of each z_j, and add all those \delta_j to the coefficient z_k of the new symbol \epsilon_k (rounding up). Thus, because of roundoff errors, even affine operations like ''Z'' = \alpha''X'' and ''Z'' = ''X'' + ''Y'' will add the extra term z_k\epsilon_k. The handling of roundoff errors increases the code complexity and execution time of AA operations. In applications where those errors are known to be unimportant (because they are dominated by uncertainties in the input data and/or by the linearization errors), one may use a simplified AA library that does not implement roundoff error control.


Affine projection model

Affine arithmetic can be viewed in matrix form as follows. Let X_1,X_2,\dots,X_m be all input and computed quantities in use at some point during a computation. The affine forms for those quantities can be represented by a single coefficient matrix ''A'' and a vector ''b'', where element A_ is the coefficient of symbol \epsilon_j in the affine form of ''X_i''; and b_i is the independent term of that form. Then the joint range of the quantities — that is, the range of the point (X_1,X_2,\dots,X_m) — is the image of the hypercube U^n =
1,+1 Onekama ( ) is a village in Manistee County in the U.S. state of Michigan. The population was 411 at the 2010 census. The village is located on the shores of Portage Lake and is surrounded by Onekama Township. The town's name is derived from "On ...
n by the affine map from U^n to R^m defined by \epsilon \to A \epsilon + b. The range of this affine map is a
zonotope In geometry, a zonohedron is a convex polyhedron that is centrally symmetric, every face of which is a polygon that is centrally symmetric (a zonogon). Any zonohedron may equivalently be described as the Minkowski sum of a set of line segments in ...
bounding the joint range of the quantities X_1,X_2,\dots,X_m. Thus one could say that AA is a "zonotope arithmetic". Each step of AA usually entails adding one more row and one more column to the matrix ''A''.


Affine form simplification

Since each AA operation generally creates a new symbol \epsilon_k, the number of terms in an affine form may be proportional to the number of operations used to compute it. Thus, it is often necessary to apply "symbol condensation" steps, where two or more symbols \epsilon_k are replaced by a smaller set of new symbols. Geometrically, this means replacing a complicated zonotope ''P'' by a simpler zonotope ''Q'' that encloses it. This operation can be done without destroying the first-order approximation property of the final zonotope.


Implementation


Matrix implementation

Affine arithmetic can be implemented by a global array ''A'' and a global vector ''b'', as described above. This approach is reasonably adequate when the set of quantities to be computed is small and known in advance. In this approach, the programmer must maintain externally the correspondence between the row indices and the quantities of interest. Global variables hold the number ''m'' of affine forms (rows) computed so far, and the number ''n'' of symbols (columns) used so far; these are automatically updated at each AA operation.


Vector implementation

Alternatively, each affine form can be implemented as a separate vector of coefficients. This approach is more convenient for programming, especially when there are calls to library procedures that may use AA internally. Each affine form can be given a mnemonic name; it can be allocated when needed, be passed to procedures, and reclaimed when no longer needed. The AA code then looks much closer to the original formula. A global variable holds the number ''n'' of symbols used so far.


Sparse vector implementation

On fairly long computations, the set of "live" quantities (that will be used in future computations) is much smaller than the set of all computed quantities; and ditto for the set of "live" symbols \epsilon_j. In this situation, the matrix and vector implementations are too wasteful of time and space. In such situations, one should use a sparse implementation. Namely, each affine form is stored as a list of pairs (j,x_j), containing only the terms with non-zero coefficient x_j. For efficiency, the terms should be sorted in order of ''j''. This representation makes the AA operations somewhat more complicated; however, the cost of each operation becomes proportional to the number of nonzero terms appearing in the operands, instead of the number of total symbols used so far. This is the representation used by LibAffa.


References


External links



Stolfi's page on AA.

LibAffa, an LGPL implementation of affine arithmetic. **

ASOL, a branch-and-prune method to find all solutions to systems of nonlinear equations using affine arithmetic

YalAA, an object-oriented C++ based template library for affine arithmetic (AA). *{{GitHub, mskashi/kv (
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
library which can use affine arithmetic) Numerical analysis Affine geometry