Infinity Rings

The unsigned infinity “ring” is the set of two elements

  1. infinity
  2. 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 take 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

  1. plus infinity
  2. a positive finite element
  3. zero
  4. a negative finite element
  5. 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.

Note: the shorthand oo is predefined in Sage to be the same as +Infinity in the infinity ring. It is considered equal to, but not the same as Infinity in the UnsignedInfinityRing:

sage: oo
+Infinity
sage: oo is InfinityRing.0
True
sage: oo is UnsignedInfinityRing.0
False
sage: oo == UnsignedInfinityRing.0
True

EXAMPLES:

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: unsigned_oo = P.0; unsigned_oo
Infinity

We compare finite numbers with infinity:

sage: 5 < unsigned_oo
True
sage: 5 > unsigned_oo
False
sage: unsigned_oo < 5
False
sage: unsigned_oo > 5
True

We do arithmetic:

sage: unsigned_oo + 5
Infinity

We make 1 / unsigned_oo return the integer 0 so that arithmetic of the following type works:

sage: (1/unsigned_oo) + 2
2
sage: 32/5 - (2.439/unsigned_oo)
32/5

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

sage: unsigned_oo/0
...
ValueError: unsigned oo times smaller number not defined

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/unsigned_oo
0
sage: unsigned_oo * 0
...
ValueError: unsigned oo times smaller number not defined
sage: unsigned_oo/unsigned_oo
...
ValueError: unsigned oo times smaller number not defined

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

The symbol oo is predefined as a shorthand for +Infinity:

sage: 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
0
sage: -1 / oo
0

We make 1 / oo and 1 / -oo return the integer 0 instead of the infinity ring Zero so that arithmetic of the following type works:

sage: (1/oo) + 2
2
sage: 32/5 - (2.439/-oo)
32/5

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

sage: oo - oo
...
SignError: cannot add infinity to minus infinity
sage: 0 * oo
...
SignError: cannot multiply infinity by zero
sage: P(2) + P(-3)
...
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
class sage.rings.infinity.AnInfinity
lcm(x)

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

EXAMPLES:

sage: oo.lcm(0)
0
sage: oo.lcm(oo)
+Infinity
sage: oo.lcm(-oo)
+Infinity
sage: oo.lcm(10)
+Infinity
sage: (-oo).lcm(10)
+Infinity
class sage.rings.infinity.FiniteNumber(parent, x)

Bases: sage.structure.element.RingElement

sqrt()

EXAMPLES:

sage: InfinityRing(7).sqrt()
A positive finite number
sage: InfinityRing(0).sqrt()
Zero
sage: InfinityRing(-.001).sqrt()
...
SignError: cannot take square root of a negative number
class sage.rings.infinity.InfinityRing_class

Bases: sage.rings.infinity._uniq, sage.rings.ring.Ring

fraction_field()

This isn’t really a ring, let alone an integral domain.

TEST:

sage: InfinityRing.fraction_field()
...
TypeError: infinity 'ring' has no fraction field
gen(n=0)

The two generators are plus and minus infinity.

EXAMPLES:

sage: InfinityRing.gen(0)
+Infinity
sage: InfinityRing.gen(1)
-Infinity
sage: InfinityRing.gen(2)
...
IndexError: n must be 0 or 1
gens()

The two generators are plus and minus infinity.

EXAMPLES:

sage: InfinityRing.gens()
[+Infinity, -Infinity]
ngens()

The two generators are plus and minus infinity.

EXAMPLES:

sage: InfinityRing.ngens()
2
sage: len(InfinityRing.gens())
2
class sage.rings.infinity.LessThanInfinity(parent=The Unsigned Infinity Ring)
Bases: sage.rings.infinity._uniq, sage.structure.element.RingElement
class sage.rings.infinity.MinusInfinity

Bases: sage.rings.infinity._uniq, sage.rings.infinity.AnInfinity, sage.structure.element.MinusInfinityElement

sqrt()

EXAMPLES:

sage: (-oo).sqrt()
...
SignError: cannot take square root of negative infinity
class sage.rings.infinity.PlusInfinity

Bases: sage.rings.infinity._uniq, sage.rings.infinity.AnInfinity, sage.structure.element.PlusInfinityElement

sqrt()

EXAMPLES:

sage: oo.sqrt()
+Infinity
exception sage.rings.infinity.SignError
Bases: exceptions.Exception
class sage.rings.infinity.UnsignedInfinity
Bases: sage.rings.infinity._uniq, sage.rings.infinity.AnInfinity, sage.structure.element.InfinityElement
class sage.rings.infinity.UnsignedInfinityRing_class

Bases: sage.rings.infinity._uniq, sage.rings.ring.Ring

fraction_field()

The unsigned infinity ring isn’t an integral domain.

EXAMPLES:

sage: UnsignedInfinityRing.fraction_field()
...
TypeError: infinity 'ring' has no fraction field
gen(n=0)

The “generator” of self is the infinity object.

EXAMPLES:

sage: UnsignedInfinityRing.gen()
Infinity
sage: UnsignedInfinityRing.gen(1)
...
IndexError: UnsignedInfinityRing only has one generator
gens()

The “generator” of self is the infinity object.

EXAMPLES:

sage: UnsignedInfinityRing.gens()
[Infinity]
less_than_infinity()

This is the element that represents a finite value.

EXAMPLES:

sage: UnsignedInfinityRing.less_than_infinity()
A number less than infinity
sage: UnsignedInfinityRing(5) is UnsignedInfinityRing.less_than_infinity()
True
ngens()

The unsigned infinity ring has one “generator.”

EXAMPLES:

sage: UnsignedInfinityRing.ngens()
1
sage: len(UnsignedInfinityRing.gens())
1
sage.rings.infinity.is_Infinite(x)

This is a type check for infinity elements.

EXAMPLES:

sage: sage.rings.infinity.is_Infinite(oo)
True
sage: sage.rings.infinity.is_Infinite(-oo)
True
sage: sage.rings.infinity.is_Infinite(unsigned_infinity)
True
sage: sage.rings.infinity.is_Infinite(3)
False
sage: sage.rings.infinity.is_Infinite(RR(infinity))
False
sage: sage.rings.infinity.is_Infinite(ZZ)
False

Previous topic

Space of homomorphisms between two rings.

Next topic

Fraction Field of Integral Domains

This Page