# Inf

Inf is a calculator that can handle infinite and infinitesimal numbers. Type an expression at the : prompt and hit Enter. For more documentation, scroll down.

### Basic use

Inf is a calculator that can handle infinite and infinitesimal numbers.

Special constants and variables:

• d -- an infinitesimally small positive number
• pi -- the ratio of a circle's circumference to its diameter
• i -- the square root of -1

Built-in operators:

• +, -, *, / -- arithmetic
• ^ -- exponentiation
• <, >, == -- comparisons (note the double equals sign to test for equality)
• ()[]{} -- All three styles of parentheses can be used.

Built-in functions:

• sin, cos, tan
• asin, acos, atan
• sqrt, abs
• exp, ln

Inf represents infinite and infinitesimal quantities as Levi-Civita numbers. Calculus students often get the impression that the notion of an infinite or infinitesimal number can never be defined in any rigorous or self-consistent way. That's not true. Tullio Levi-Civita defined the Levi-Civita numbers around 1900, so it's been known for over a century that there were rigorously definable number systems that included infinities. Great mathematicians like Newton, Gauss, and Euler used infinitesimals, and now that modern mathematicians have put them on a more rigorous footing, there's no reason to shy away from them. To learn more about the application of infinitesimals to calculus, see my free calculus book. (If you've ended up here because the calculus book tells you about the calculator, one thing you should realize is that the Levi-Civita numbers used by Inf are not the full hyperreal number system referred to in the book. They are a subset of them, in the same way that the rational numbers are a subset of the real numbers. This is why certain calculations give an error in the calculator, even though they are well defined in the hyperreals.)

1. The Levi-Civita numbers obey all the same elementary axioms of arithmetic as the real numbers.
2. The system contains many different sizes of infinite numbers, and many sizes of infinitesimals, but all of them are expressed in terms of the basic building block d, which is a positive infinitesimal that we arbitrarily single out and give a name.

Here are some examples you can try in the calculator to get a feeling for how all this works:

• d>0 ... true, because although d is infinitesimal, it's still greater than zero
• d<10^-10 ... true, because d is smaller than any positive real number
• 1/0 ... undefined

The expression 1/0 comes up as undefined, not an infinite number. This is because one of the elementary axioms of arithmetic is that division by zero is undefined. To get an infinite result, you could do something like 1/d, where d is the symbol built in to the calculator to represent one particular infinitesimal number.

• 1/d ... doesn't cause an error like 1/0 did
• 1/d>1000000 ... true, because 1/d is infinite
• d^2<d ... true, showing that we have different sizes of infinitesimals
• sqrt(d)>d ... true

To see why there have to be many different sizes of infinities, and of infinitesimals, consider the following example. We can prove from the elementary axioms of arithmetic is that if x is greater than zero, then 2x is greater than x. This applies to Levi-Civita numbers as well, so infinite and infinitesimal numbers have to come in different sizes. In particular, there isn't anything in the Levi-Civita system that plays the role of ∞, which is usually used as a generic symbol for infinity.

• d^2>0 ... true, because even though d^2 is infinitesimally small compared to d, it's still not zero

This shows that the traditional practice of neglecting the square of an infinitesimal can't be formalized in the Levi-Civita system simply by equating it to zero. We can, however, say that neglecting a d2 term compared to a d is an infinitely good approximation. Here is an example of numerical calculus, in which we calculate the derivative of x4, evaluated at x=2:

• [(2+d)^4-2^4]/d

The result is 32+(24)d+8d2+d3, corresponding to the fact that the derivative is 32. The right way to handle this is not to say that the trailing terms are zero, but simply to define the derivative as the standard part of the quotient dy/dx, meaning its leading term that has no d in it.

• 1/(1-d) ... is calculated using the geometric series, up to a certain level of precision
• exp(d) ... is calculated using a Taylor series
• (1-cos d)/d ... gives an infinitesimal result, which is equivalent to the statement that limx→0[(1-cos d)/d]=0, as can be verified by L'Hôpital's rule
For convenience in the following, let's define an infinite variable h.
• h=1/d
• h ... spits back its representation in terms of the basic building block d
• 2*h>h ... true, because 2h is a bigger infinity than h
• 2*h+1>2*h ... and an even bigger infinity
• sqrt(h+1)-sqrt(h-1) ... shows that this expression is (perhaps counterintuitively) infinitesimal
• exp(h) ... is undefined in the Levi-Civita system

To amplify on statement 2 above, the infinitesimal d doesn't have any special properties that would allow it to be picked out from among all the other positive infinitesimals. We just assume it can be picked arbitrarily from the set of positive infinitesimals. The arbitrariness of this choice can be understood by analogy with the complex numbers. To construct the complex numbers, we start by assuming that a solution to the equation x2+1=0 exists. It follows from the axioms of algebra that there are two such solutions with opposite signs, since the sign of x doesn't affect the value of x2. We call one of these i, and the other -i. Note that it makes absolutely no difference which one is i and which is -i. Similarly in the case of the Levi-Civita numbers, we assume that a positive solution exists to the infinite set of simultaneous equations {x<1, x<1/2, x<1/3, ...}. Assuming such a solution, which is interpreted as an infinitesimal number, it follows that we can find many other solutions as we like. Out of all the solutions, we arbitrarily pick one and call it d.

The undefined result for exp(1/d) is an example of how the Levi-Civita numbers are a smaller system than the hyperreals, which were defined by Abraham Robinson around 1960. The hyperreals match the properties of the real numbers even better than the Levi-Civita numbers do. For example, the exponential function can take a positive infinite argument in the hyperreal system, but that doesn't work in the Levi-Civita numbers. However, the hyperreals cannot be conveniently represented on a computer.

### Fancy features

More special variables:

• levi_civita_n -- sets the number of terms to maintain in series expansions of Levi-Civita numbers
• precision -- sets the number of digits of precision to print in output

More built-in operators:

• ; -- separates multiple statements on the same line
• , -- builds arrays, e.g., (1,2)
• = -- assigns the expression on the right to the variable named on the left-hand side

More built-in functions:

• floor, ceil -- round down or up to an integer
• array -- converts a Levi-Civita number, complex number, or rational number to a representation in terms of an array

User-defined functions:

• f x = x^2

In Firefox, you can use up-arrow and down-arrow to get back lines you've typed in previously. Depending on your browser, it may also be possible to accomplish this using control-P and control-N.

## Open source

Inf is open source software by Ben Crowell and Mustafa Khafateh. It's under the GPL v. 2 license. Since it's all written in client-side javascript, you can see the source code simply by doing "view source" in your browser; actually most of the code is in separate modules pointed to from the html source code, but you can view those through your browser as well by pointing it at each URL. Alternatively, you can access it via a web browser or git, at via github.