Free algebra elements

AUTHORS:

  • David Kohel (2005-09)

TESTS:

sage: R.<x,y> = FreeAlgebra(QQ,2)
sage: x == loads(dumps(x))
True
sage: x*y
x*y
sage: (x*y)^0
1
sage: (x*y)^3
x*y*x*y*x*y
class sage.algebras.free_algebra_element.FreeAlgebraElement(A, x)

A free algebra element.

__call__(*x, **kwds)

EXAMPLES:

sage: A.<x,y,z>=FreeAlgebra(ZZ,3)
sage: (x+3*y).subs(x=1,y=2,z=14)
7
sage: (2*x+y).subs({x:1,y:z})
2 + z
sage: f=x+3*y+z
sage: f(1,2,1/2)
15/2
sage: f(1,2)
...
ValueError: must specify as many values as generators in parent

AUTHORS:

  • Joel B. Mohler (2007-10-27)
__cmp__(left, right)

Compare two free algebra elements with the same parents.

The ordering is the one on the underlying sorted list of (monomial,coefficients) pairs.

EXAMPLES:

sage: R.<x,y> = FreeAlgebra(QQ,2)
sage: x < y
True
sage: x * y < y * x
True
sage: y * x < x * y
False
__init__(A, x)
Create the element x of the FreeAlgebra A.
__weakref__
list of weak references to the object (if defined)
_add_(y)

Return sum of self and y (another free algebra element with the same parents)

EXAMPLES:

sage: R.<x,y> = FreeAlgebra(QQ,2)
sage: x + y
x + y
_latex_()

Return latex representation of self.

EXAMPLES:

sage: A.<x,y,z>=FreeAlgebra(ZZ,3)
sage: latex(-x+3*y^20*z)
\left(-1\right)x + 3y^{20}z
sage: alpha,beta,gamma=FreeAlgebra(ZZ,3,'alpha,beta,gamma').gens()
sage: latex(alpha-beta)
\alpha + \left(-1\right)\beta
_mul_(y)

Return product of self and y (another free algebra element with the same parents)

EXAMPLES:

sage: A.<x,y,z>=FreeAlgebra(ZZ,3)
sage: (x+y+x*y)*(x+y+1)
x + y + x^2 + 2*x*y + y*x + y^2 + x*y*x + x*y^2
_neg_()

Return negation of self

EXAMPLES:

sage: R.<x,y> = FreeAlgebra(QQ,2)
sage: -(x+y)
-x - y
_repr_()

Return string representation of self.

EXAMPLES:

sage: A.<x,y,z>=FreeAlgebra(ZZ,3)
sage: repr(-x+3*y*z)
'-x + 3*y*z'
_sub_(y)

Return self minus y (another free algebra element with the same parents)

EXAMPLES:

sage: R.<x,y> = FreeAlgebra(QQ,2)
sage: x - y
x - y

Previous topic

Free algebras

Next topic

Free algebra quotients

This Page