Package sage :: Package monoids :: Module free_monoid_element :: Class FreeMonoidElement
[hide private]
[frames] | no frames]

Class FreeMonoidElement

source code

                      object --+            
                               |            
structure.sage_object.SageObject --+        
                                   |        
           structure.element.Element --+    
                                       |    
         structure.element.MonoidElement --+
                                           |
                                          FreeMonoidElement
Known Subclasses:
string_monoid_element.StringMonoidElement


Element of a free monoid.

EXAMPLES:
        sage: a = FreeMonoid(5, 'a').gens()
        sage: x = a[0]*a[1]*a[4]**3
        sage: x**3
        a0*a1*a4^3*a0*a1*a4^3*a0*a1*a4^3
        sage: x**0
        1
        sage: x**(-1)
        Traceback (most recent call last):
        ...
        TypeError: bad operand type for unary ~: 'FreeMonoidElement'



Instance Methods [hide private]
 
__init__(self, F, x, check=True)
Create the element $x$ of the FreeMonoid $F$.
source code
 
_repr_(self)
File: sage/structure/element.pyx (starting at line 291)
source code
 
_latex_(self)
Return latex representation of self.
source code
 
__call__(self, *x, **kwds)
EXAMPLES: sage: M.<x,y,z>=FreeMonoid(3) sage: (x*y).subs(x=1,y=2,z=14) 2 sage: (x*y).subs({x:z,y:z}) z^2 sage: M1=MatrixSpace(ZZ,1,2) sage: M2=MatrixSpace(ZZ,2,1) sage: (x*y).subs({x:M1([1,2]),y:M2([3,4])}) [11] AUTHOR: -- Joel B.
source code
 
__mul__(self, y)
Multiply 2 free monoid elements.
source code
 
__len__(self)
Return the number of products that occur in this monoid element.
source code
 
__cmp__(self, y)
cmp(x,y)
source code

Inherited from structure.element.MonoidElement: __new__, __nonzero__, __pow__, __rmul__, __rpow__, _mul_, multiplicative_order, order

Inherited from structure.element.Element: __eq__, __ge__, __gt__, __hash__, __le__, __lt__, __ne__, __reduce__, __rxor__, __xor__, _cmp_, _im_gens_, _richcmp_, base_base_extend, base_base_extend_canonical_sym, base_extend, base_extend_canonical, base_extend_canonical_sym, base_extend_recursive, base_ring, category, is_zero, n, parent, subs, substitute

Inherited from structure.sage_object.SageObject: __repr__, _axiom_, _axiom_init_, _gap_, _gap_init_, _gp_, _gp_init_, _interface_, _interface_init_, _interface_is_cached_, _kash_, _kash_init_, _macaulay2_, _macaulay2_init_, _magma_, _magma_init_, _maple_, _maple_init_, _mathematica_, _mathematica_init_, _maxima_, _maxima_init_, _octave_, _octave_init_, _pari_, _pari_init_, _r_init_, _sage_, _singular_, _singular_init_, db, dump, dumps, plot, rename, reset_name, save, version

Inherited from object: __delattr__, __getattribute__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, F, x, check=True)
(Constructor)

source code 

Create the element $x$ of the FreeMonoid $F$.

This should typically be called by a FreeMonoid.

Overrides: structure.element.Element.__init__

_repr_(self)

source code 
File: sage/structure/element.pyx (starting at line 291)

Overrides: structure.element.Element._repr_
(inherited documentation)

_latex_(self)

source code 

Return latex representation of self.

EXAMPLES:
    sage: F = FreeMonoid(3, 'a')
    sage: z = F([(0,5),(1,2),(0,10),(0,2),(1,2)])
    sage: z._latex_()
    'a_{0}^{5}a_{1}^{2}a_{0}^{12}a_{1}^{2}'
    sage: F, (alpha,beta,gamma) = FreeMonoid(3, 'alpha,beta,gamma').objgens()
    sage: latex(alpha*beta*gamma)
    \alpha\beta\gamma

__call__(self, *x, **kwds)
(Call operator)

source code 

EXAMPLES:
    sage: M.<x,y,z>=FreeMonoid(3)
    sage: (x*y).subs(x=1,y=2,z=14)
    2
    sage: (x*y).subs({x:z,y:z})
    z^2
    sage: M1=MatrixSpace(ZZ,1,2)
    sage: M2=MatrixSpace(ZZ,2,1)
    sage: (x*y).subs({x:M1([1,2]),y:M2([3,4])})
    [11]

AUTHOR:
    -- Joel B. Mohler (2007.10.27)

__mul__(self, y)

source code 

Multiply 2 free monoid elements.

EXAMPLES:
    sage: a = FreeMonoid(5, 'a').gens()
    sage: x = a[0] * a[1] * a[4]**3
    sage: y = a[4] * a[0] * a[1]
    sage: x*y
    a0*a1*a4^4*a0*a1

Overrides: structure.element.MonoidElement.__mul__

__len__(self)
(Length operator)

source code 

Return the number of products that occur in this monoid element.
For example, the length of the identity is 0, and the length
of the monoid $x_0^2x_1$ is three.

EXAMPLES:
    sage: F = FreeMonoid(3, 'a')
    sage: z = F(1)
    sage: len(z)
    0
    sage: a = F.gens()
    sage: len(a[0]**2 * a[1])
    3

__cmp__(self, y)
(Comparison operator)

source code 
cmp(x,y)

Overrides: structure.element.Element.__cmp__
(inherited documentation)