5.2.1.1 FreeAbelianMonoid_class Objects

class FreeAbelianMonoid_class
Free abelian monoid on $ n$ generators.
FreeAbelianMonoid_class( n, [names=None])

Instances of class FreeAbelianMonoid_class have the following methods (in addition to inherited methods and special methods):

gen,$  $ ngens

Further documentation:

gen( i)

The $ i$ -th generator of the abelian monoid.

sage: F = FreeAbelianMonoid(5,'a')
sage: F.gen(0)
a_0
sage: F.gen(2)
a_2

ngens( )

The number of free generators of the abelian monoid.

sage: F = FreeAbelianMonoid(3000)
sage: F.ngens()
3000

Instances of class FreeAbelianMonoid_class also have the following special methods:

__call__,$  $ __contains__,$  $ __repr__

Further documentation:

__call__( x)

Create an element of this abelian monoid from $ x$ .

sage: F = FreeAbelianMonoid(10)
sage: F(F.gen(2))
x_2
sage: F(1)
1

__contains__( x)

Return True if $ x$ is an element of this abelian monoid.

sage: F = FreeAbelianMonoid(10)
sage: F.gen(2)*F.gen(3) in F
True

Note that a monoid on $ 9$ generators is not considered a submonoid of one on $ 10$ generators.

sage: FreeAbelianMonoid(9).gen(2) in F
False

However, multiple calls to the monoid constructor do not return multiple distinct monoids.

sage: FreeAbelianMonoid(10).gen(2) in F
True

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