Next: , Previous: Complex Numbers, Up: Data Types

5.5 Infinities

The word inf represents the mathematical concept of infinity. Calc actually has three slightly different infinity-like values: inf, uinf, and nan. These are just regular variable names (see Variables); you should avoid using these names for your own variables because Calc gives them special treatment. Infinities, like all variable names, are normally entered using algebraic entry.

Mathematically speaking, it is not rigorously correct to treat “infinity” as if it were a number, but mathematicians often do so informally. When they say that ‘1 / inf = 0’, what they really mean is that ‘1 / x’, as ‘x’ becomes larger and larger, becomes arbitrarily close to zero. So you can imagine that if ‘x’ got “all the way to infinity,” then ‘1 / x’ would go all the way to zero. Similarly, when they say that ‘exp(inf) = inf’, they mean that exp(x)’ grows without bound as ‘x’ grows. The symbol ‘-inf’ likewise stands for an infinitely negative real value; for example, we say that ‘exp(-inf) = 0’. You can have an infinity pointing in any direction on the complex plane: ‘sqrt(-inf) = i inf’.

The same concept of limits can be used to define ‘1 / 0’. We really want the value that ‘1 / x’ approaches as ‘x’ approaches zero. But if all we have is ‘1 / 0’, we can't tell which direction ‘x’ was coming from. If ‘x’ was positive and decreasing toward zero, then we should say that ‘1 / 0 = inf’. But if ‘x’ was negative and increasing toward zero, the answer is ‘1 / 0 = -inf’. In fact, ‘x’ could be an imaginary number, giving the answer ‘i inf’ or ‘-i inf’. Calc uses the special symbol ‘uinf’ to mean undirected infinity, i.e., a value which is infinitely large but with an unknown sign (or direction on the complex plane).

Calc actually has three modes that say how infinities are handled. Normally, infinities never arise from calculations that didn't already have them. Thus, ‘1 / 0’ is treated simply as an error and left unevaluated. The m i (calc-infinite-mode) command (see Infinite Mode) enables a mode in which ‘1 / 0’ evaluates to uinf instead. There is also an alternative type of infinite mode which says to treat zeros as if they were positive, so that ‘1 / 0 = inf’. While this is less mathematically correct, it may be the answer you want in some cases.

Since all infinities are “as large” as all others, Calc simplifies, e.g., ‘5 inf’ to ‘inf’. Another example is ‘5 - inf = -inf’, where the ‘-inf’ is so large that adding a finite number like five to it does not affect it. Note that ‘a - inf’ also results in ‘-inf’; Calc assumes that variables like a always stand for finite quantities. Just to show that infinities really are all the same size, note that ‘sqrt(inf) = inf^2 = exp(inf) = inf’ in Calc's notation.

It's not so easy to define certain formulas like ‘0 * inf’ and ‘inf / inf’. Depending on where these zeros and infinities came from, the answer could be literally anything. The latter formula could be the limit of ‘x / x’ (giving a result of one), or ‘2 x / x’ (giving two), or ‘x^2 / x’ (giving inf), or ‘x / x^2’ (giving zero). Calc uses the symbol nan to represent such an indeterminate value. (The name “nan” comes from analogy with the “NAN” concept of IEEE standard arithmetic; it stands for “Not A Number.” This is somewhat of a misnomer, since nan does stand for some number or infinity, it's just that which number it stands for cannot be determined.) In Calc's notation, ‘0 * inf = nan’ and ‘inf / inf = nan’. A few other common indeterminate expressions are ‘inf - inf’ and ‘inf ^ 0’. Also, ‘0 / 0 = nan’ if you have turned on Infinite mode (as described above).

Infinities are especially useful as parts of intervals. See Interval Forms.