Free algebra elements#

AUTHORS:

  • David Kohel (2005-09)

class sage.algebras.free_algebra_element.FreeAlgebraElement(A, x)[source]#

Bases: IndexedFreeModuleElement, AlgebraElement

A free algebra element.

is_unit()[source]#

Return True if self is invertible.

EXAMPLES:

sage: A.<x, y, z> = FreeAlgebra(ZZ)
sage: A(-1).is_unit()
True
sage: A(2).is_unit()
False
sage: A(1 + x).is_unit()
False
sage: A.<x, y> = FreeAlgebra(QQ, degrees=(1,-1))
sage: A(x * y).is_unit()
False
sage: A(2).is_unit()
True
>>> from sage.all import *
>>> A = FreeAlgebra(ZZ, names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
>>> A(-Integer(1)).is_unit()
True
>>> A(Integer(2)).is_unit()
False
>>> A(Integer(1) + x).is_unit()
False
>>> A = FreeAlgebra(QQ, degrees=(Integer(1),-Integer(1)), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
>>> A(x * y).is_unit()
False
>>> A(Integer(2)).is_unit()
True
to_pbw_basis()[source]#

Return self in the Poincaré-Birkhoff-Witt (PBW) basis.

EXAMPLES:

sage: F.<x,y,z> = FreeAlgebra(ZZ, 3)
sage: p = x^2*y + 3*y*x + 2
sage: p.to_pbw_basis()
2*PBW[1] + 3*PBW[y]*PBW[x] + PBW[x^2*y]
 + 2*PBW[x*y]*PBW[x] + PBW[y]*PBW[x]^2
>>> from sage.all import *
>>> F = FreeAlgebra(ZZ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = F._first_ngens(3)
>>> p = x**Integer(2)*y + Integer(3)*y*x + Integer(2)
>>> p.to_pbw_basis()
2*PBW[1] + 3*PBW[y]*PBW[x] + PBW[x^2*y]
 + 2*PBW[x*y]*PBW[x] + PBW[y]*PBW[x]^2
variables()[source]#

Return the variables used in self.

EXAMPLES:

sage: A.<x,y,z> = FreeAlgebra(ZZ,3)
sage: elt = x + x*y + x^3*y
sage: elt.variables()
[x, y]
sage: elt = x + x^2 - x^4
sage: elt.variables()
[x]
sage: elt = x + z*y + z*x
sage: elt.variables()
[x, y, z]
>>> from sage.all import *
>>> A = FreeAlgebra(ZZ,Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
>>> elt = x + x*y + x**Integer(3)*y
>>> elt.variables()
[x, y]
>>> elt = x + x**Integer(2) - x**Integer(4)
>>> elt.variables()
[x]
>>> elt = x + z*y + z*x
>>> elt.variables()
[x, y, z]