23.5 Infinity Rings

Module: sage.rings.infinity

Infinity Rings

The unsigned infinity ``ring'' is the set of two elements

        * infinity
        * A number less than infinity

The rules for arithmetic are that the unsigned infinity ring does not canonically coerce to any other ring, and all other rings canonically coerce to the unsigned infinity ring, sending all elements to the single element ``a number less than infinity'' of the unsigned infinity ring. Arithmetic and comparisons then takes place in the unsigned infinity ring, where all arithmetic operations that are well defined are defined.

The infinity ``ring'' is the set of five elements

        * plus infinity
        * a positive finite element
        * zero
        * a negative finite element
        * negative infinity

The infinity ring coerces to the unsigned infinity ring, sending the infinite elements to infinity and the non-infinite elements to ``a number less than infinity.'' Any ordered ring coerces to the infinity ring in the obvious way.

We fetch the unsigned infinity ring and create some elements:

sage: P = UnsignedInfinityRing; P
The Unsigned Infinity Ring
sage: P(5)
A number less than infinity
sage: P.ngens()
1
sage: oo = P.0; oo
Infinity

We compare finite numbers with infinity.

sage: 5 < oo
True
sage: 5 > oo
False
sage: oo < 5
False
sage: oo > 5
True

We do arithmetic.

sage: oo + 5
Infinity

Note that many operations are not defined, since the result is not well defined.

sage: oo/0
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for '/': 'The Unsigned Infinity
Ring' and 'Integer Ring'

What happened above is that 0 is canonically coerced to "a number less than infinity" in the unsigned infinity ring, and the quotient is then not well defined.

sage: 0/oo
A number less than infinity
sage: oo * 0
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for '*': 'The Unsigned Infinity
Ring' and 'Integer Ring'
sage: oo/oo
Traceback (most recent call last):
...
TypeError: infinity 'ring' has no fraction field

In the infinity ring, we can negate infinity, multiply positive numbers by infinity, etc.

sage: P = InfinityRing; P
The Infinity Ring
sage: P(5)
A positive finite number
sage: oo = P.0; oo
+Infinity

We compare finite and infinite elements

sage: 5 < oo
True
sage: P(-5) < P(5)
True
sage: P(2) < P(3)
False
sage: -oo < oo
True

We can do more arithmetic than in the unsigned infinity ring.

sage: 2 * oo
+Infinity
sage: -2 * oo
-Infinity
sage: 1 - oo
-Infinity
sage: 1 / oo
Zero
sage: -1 / oo
Zero

If we try to subtract infinities or multiply infinity by zero we still get an error.

sage: oo - oo
Traceback (most recent call last):
...
SignError: cannot add infinity to minus infinity
sage: 0 * oo
Traceback (most recent call last):
...
SignError: cannot multiply infinity by zero
sage: P(2) + P(-3)
Traceback (most recent call last):
...
SignError: cannot add positive finite value to negative finite value

TESTS:

sage: P = InfinityRing
sage: P == loads(dumps(P))
True

sage: P(2) == loads(dumps(P(2)))
True

The following is assumed in a lot of code (i.e., "is" is used for testing whether something is infinity), so make sure it is satisfied:

sage: loads(dumps(infinity)) is infinity
True

Module-level Functions

is_Infinite( x)

Class: FiniteNumber

class FiniteNumber
FiniteNumber( self, parent, x)

Functions: sqrt,$ \,$ square_root

Special Functions: __abs__,$ \,$ __cmp__,$ \,$ __init__,$ \,$ __invert__,$ \,$ _add_,$ \,$ _div_,$ \,$ _latex_,$ \,$ _mul_,$ \,$ _neg_,$ \,$ _repr_,$ \,$ _sub_

Class: InfinityRing_class

class InfinityRing_class
InfinityRing_class( self)

Functions: fraction_field,$ \,$ gen,$ \,$ gens,$ \,$ ngens

Special Functions: __call__,$ \,$ __cmp__,$ \,$ __init__,$ \,$ _coerce_impl,$ \,$ _repr_

Class: LessThanInfinity

class LessThanInfinity
LessThanInfinity( self, [parent=The Unsigned Infinity Ring])

Special Functions: __cmp__,$ \,$ __init__,$ \,$ _add_,$ \,$ _div_,$ \,$ _latex_,$ \,$ _mul_,$ \,$ _repr_,$ \,$ _sub_

Class: MinusInfinity

class MinusInfinity
MinusInfinity( self)

Functions: lcm,$ \,$ sqrt,$ \,$ square_root

lcm( self, x)

Return the least common multiple of -oo and x, which is by definition oo unless x is 0.

sage: moo = InfinityRing.gen(1)
sage: moo.lcm(0)
0
sage: moo.lcm(oo)
+Infinity
sage: moo.lcm(10)
+Infinity

Special Functions: __abs__,$ \,$ __cmp__,$ \,$ __init__,$ \,$ __invert__,$ \,$ _add_,$ \,$ _div_,$ \,$ _latex_,$ \,$ _maxima_init_,$ \,$ _mul_,$ \,$ _neg_,$ \,$ _repr_,$ \,$ _sub_

_maxima_init_( self)

sage: maxima(-oo)
minf

Class: PlusInfinity

class PlusInfinity
PlusInfinity( self)

Functions: lcm,$ \,$ sqrt,$ \,$ square_root

lcm( self, x)

Return the least common multiple of oo and x, which is by definition oo unless x is 0.

sage: oo = InfinityRing.gen(0)
sage: oo.lcm(0)
0
sage: oo.lcm(oo)
+Infinity
sage: oo.lcm(10)
+Infinity

Special Functions: __abs__,$ \,$ __cmp__,$ \,$ __init__,$ \,$ __invert__,$ \,$ __repr__,$ \,$ _add_,$ \,$ _div_,$ \,$ _latex_,$ \,$ _maxima_init_,$ \,$ _mul_,$ \,$ _neg_,$ \,$ _sub_

_maxima_init_( self)

sage: maxima(oo)
inf

Class: SignError

class SignError

Class: UnsignedInfinity

class UnsignedInfinity
UnsignedInfinity( self)

Functions: lcm

lcm( self, x)

Return the least common multiple of oo and x, which is by definition oo unless x is 0.

sage: oo = UnsignedInfinityRing.gen(0)
sage: oo.lcm(0)
0
sage: oo.lcm(oo)
Infinity
sage: oo.lcm(10)
Infinity

Special Functions: __cmp__,$ \,$ __init__,$ \,$ _add_,$ \,$ _latex_,$ \,$ _maxima_init_,$ \,$ _mul_,$ \,$ _repr_,$ \,$ _sub_

Class: UnsignedInfinityRing_class

class UnsignedInfinityRing_class
UnsignedInfinityRing_class( self)

Functions: fraction_field,$ \,$ gen,$ \,$ gens,$ \,$ less_than_infinity,$ \,$ ngens

Special Functions: __call__,$ \,$ __cmp__,$ \,$ __init__,$ \,$ _coerce_impl,$ \,$ _repr_

See About this document... for information on suggesting changes.