\(q\)-Commuting Polynomials - Algebras

Skip to content
Back to top
View this page
Edit this page

# \(q\)-Commuting Polynomials

AUTHORS:

- Travis Scrimshaw (2022-08-23): Initial version

- Travis Scrimshaw (2023-02-10): Added Laurent polynomials

class sage.algebras.q_commuting_polynomials.qCommutingLaurentPolynomials(q, B, names)

  Bases: `qCommutingPolynomials_generic`

  The algebra of \(q\)-commuting Laurent polynomials.

  Let \(R\) be a commutative ring, and fix an element \(q \in R\). Let \(B = (B_{xy})_{x,y \in I}\) be a skew-symmetric bilinear form with index set \(I\). Let \(R[I]_{q,B}\) denote the Laurent polynomial ring in the variables \(I\) such that we have the \(q\)-commuting relation for \(x, y \in I\):

  \[y x = q^{B_{xy}} \cdot x y.\]

  This is a graded \(R\)-algebra with a natural basis given by monomials written in increasing order with respect to some total order on \(I\).

  EXAMPLES:

  Sage

      sage: q = ZZ['q'].fraction_field().gen()
      sage: R.<x,y> = algebras.qCommutingLaurentPolynomials(q)

  Python

      >>> from sage.all import *
      >>> q = ZZ['q'].fraction_field().gen()
      >>> R = algebras.qCommutingLaurentPolynomials(q, names=('x', 'y',)); (x, y,) = R._first_ngens(2)

  We verify a case of the \(q\)-binomial theorem using inverse variables:

  Sage

      sage: f = (x^-1 + y^-1)^10
      sage: all(f[b] == q_binomial(10, -b.list()[0]) for b in f.support())
      True

  [Python]

      >>> from sage.all import *
      >>> f = (x**-Integer(1) + y**-Integer(1))**Integer(10)
      >>> all(f[b] == q_binomial(Integer(10), -b.list()[Integer(0)]) for b in f.support())
      True

  We now do a computation with a non-standard \(B\) matrix:

  Sage

      sage: B = matrix([[0,1,2],[-1,0,3],[-2,-3,0]])
      sage: B
      [ 0  1  2]
      [-1  0  3]
      [-2 -3  0]
      sage: q = ZZ['q'].gen()
      sage: R.<x,y,z> = algebras.qCommutingLaurentPolynomials(q, B)
      sage: y^-1 * x
      1/q*x*y^-1
      sage: z^-1 * x
      1/q^2*x*z^-1
      sage: z^-1 * y^-1
      q^3*y^-1*z^-1

      sage: f = (x + z^-1)^10
      sage: all(f[b] == q_binomial(10, b.list()[0], q^-2) for b in f.support())
      True

      sage: f = (y^-1 + z^-1)^10
      sage: all(f[b] == q_binomial(10, -b.list()[1], q^3) for b in f.support())
      True

  Python

      >>> from sage.all import *
      >>> B = matrix([[Integer(0),Integer(1),Integer(2)],[-Integer(1),Integer(0),Integer(3)],[-Integer(2),-Integer(3),Integer(0)]])
      >>> B
      [ 0  1  2]
      [-1  0  3]
      [-2 -3  0]
      >>> q = ZZ['q'].gen()
      >>> R = algebras.qCommutingLaurentPolynomials(q, B, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
      >>> y**-Integer(1) * x
      1/q*x*y^-1
      >>> z**-Integer(1) * x
      1/q^2*x*z^-1
      >>> z**-Integer(1) * y**-Integer(1)
      q^3*y^-1*z^-1

      >>> f = (x + z**-Integer(1))**Integer(10)
      >>> all(f[b] == q_binomial(Integer(10), b.list()[Integer(0)], q**-Integer(2)) for b in f.support())
      True

      >>> f = (y**-Integer(1) + z**-Integer(1))**Integer(10)
      >>> all(f[b] == q_binomial(Integer(10), -b.list()[Integer(1)], q**Integer(3)) for b in f.support())
      True

  class Element

    Bases: `IndexedFreeModuleElement`

  one_basis()

    Return the basis index of the element \(1\).

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)
        sage: R.one_basis()
        1

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> R.one_basis()
        1

  product_on_basis(x, y)

    Return the product of two monomials given by `x` and `y`.

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y> = algebras.qCommutingLaurentPolynomials(q)
        sage: R.product_on_basis(x.leading_support(), y.leading_support())
        x*y
        sage: R.product_on_basis(y.leading_support(), x.leading_support())
        q*x*y

        sage: x * y
        x*y
        sage: y * x
        q*x*y
        sage: y^2 * x
        q^2*x*y^2
        sage: y * x^2
        q^2*x^2*y
        sage: y^-2 * x
        1/q^2*x*y^-2
        sage: y * x^-2
        1/q^2*x^-2*y
        sage: x * y * x
        q*x^2*y
        sage: x * y * ~x
        1/q*y
        sage: y^2 * x^2
        q^4*x^2*y^2
        sage: y^-2 * x^2
        1/q^4*x^2*y^-2
        sage: y^-2 * x^-2
        q^4*x^-2*y^-2
        sage: (x + y)^4
        x^4 + (q^3+q^2+q+1)*x^3*y + (q^4+q^3+2*q^2+q+1)*x^2*y^2 + (q^3+q^2+q+1)*x*y^3 + y^4

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingLaurentPolynomials(q, names=('x', 'y',)); (x, y,) = R._first_ngens(2)
        >>> R.product_on_basis(x.leading_support(), y.leading_support())
        x*y
        >>> R.product_on_basis(y.leading_support(), x.leading_support())
        q*x*y

        >>> x * y
        x*y
        >>> y * x
        q*x*y
        >>> y**Integer(2) * x
        q^2*x*y^2
        >>> y * x**Integer(2)
        q^2*x^2*y
        >>> y**-Integer(2) * x
        1/q^2*x*y^-2
        >>> y * x**-Integer(2)
        1/q^2*x^-2*y
        >>> x * y * x
        q*x^2*y
        >>> x * y * ~x
        1/q*y
        >>> y**Integer(2) * x**Integer(2)
        q^4*x^2*y^2
        >>> y**-Integer(2) * x**Integer(2)
        1/q^4*x^2*y^-2
        >>> y**-Integer(2) * x**-Integer(2)
        q^4*x^-2*y^-2
        >>> (x + y)**Integer(4)
        x^4 + (q^3+q^2+q+1)*x^3*y + (q^4+q^3+2*q^2+q+1)*x^2*y^2 + (q^3+q^2+q+1)*x*y^3 + y^4

    With a non-standard \(B\) matrix:

    Sage

        sage: B = matrix([[0,1,2],[-1,0,3],[-2,-3,0]])
        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingLaurentPolynomials(q, B=B)
        sage: x * y
        x*y
        sage: y * x^2
        q^2*x^2*y
        sage: z^2 * x
        q^4*x*z^2
        sage: z^2 * x^3
        q^12*x^3*z^2
        sage: z^2 * y
        q^6*y*z^2
        sage: z^2 * y^3
        q^18*y^3*z^2
        sage: x * y^-1
        x*y^-1
        sage: y * x^-2
        1/q^2*x^-2*y
        sage: z^-2 * x
        1/q^4*x*z^-2
        sage: z^-2 * x^-3
        q^12*x^-3*z^-2
        sage: z^2 * y^-1
        1/q^6*y^-1*z^2
        sage: z^2 * y^-3
        1/q^18*y^-3*z^2

    [Python]

        >>> from sage.all import *
        >>> B = matrix([[Integer(0),Integer(1),Integer(2)],[-Integer(1),Integer(0),Integer(3)],[-Integer(2),-Integer(3),Integer(0)]])
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingLaurentPolynomials(q, B=B, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> x * y
        x*y
        >>> y * x**Integer(2)
        q^2*x^2*y
        >>> z**Integer(2) * x
        q^4*x*z^2
        >>> z**Integer(2) * x**Integer(3)
        q^12*x^3*z^2
        >>> z**Integer(2) * y
        q^6*y*z^2
        >>> z**Integer(2) * y**Integer(3)
        q^18*y^3*z^2
        >>> x * y**-Integer(1)
        x*y^-1
        >>> y * x**-Integer(2)
        1/q^2*x^-2*y
        >>> z**-Integer(2) * x
        1/q^4*x*z^-2
        >>> z**-Integer(2) * x**-Integer(3)
        q^12*x^-3*z^-2
        >>> z**Integer(2) * y**-Integer(1)
        1/q^6*y^-1*z^2
        >>> z**Integer(2) * y**-Integer(3)
        1/q^18*y^-3*z^2

class sage.algebras.q_commuting_polynomials.qCommutingPolynomials(q, B, names)

  Bases: `qCommutingPolynomials_generic`

  The algebra of \(q\)-commuting polynomials.

  Let \(R\) be a commutative ring, and fix an element \(q \in R\). Let \(B = (B_{xy})_{x,y \in I}\) be a skew-symmetric bilinear form with index set \(I\). Let \(R[I]_{q,B}\) denote the polynomial ring in the variables \(I\) such that we have the \(q\)-commuting relation for \(x, y \in I\):

  \[y x = q^{B_{xy}} \cdot x y.\]

  This is a graded \(R\)-algebra with a natural basis given by monomials written in increasing order with respect to some total order on \(I\).

  When \(B_{xy} = 1\) and \(B_{yx} = -1\) for all \(x < y\), then we have a \(q\)-analog of the classical binomial coefficient theorem:

  \[(x + y)^n = \sum_{k=0}^n \binom{n}{k}_q x^k y^{n-k}.\]

  EXAMPLES:

  Sage

      sage: q = ZZ['q'].fraction_field().gen()
      sage: R.<x,y> = algebras.qCommutingPolynomials(q)

  Python

      >>> from sage.all import *
      >>> q = ZZ['q'].fraction_field().gen()
      >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y',)); (x, y,) = R._first_ngens(2)

  We verify a case of the \(q\)-binomial theorem:

  Sage

      sage: f = (x + y)^10
      sage: all(f[b] == q_binomial(10, b.list()[0]) for b in f.support())
      True

  [Python]

      >>> from sage.all import *
      >>> f = (x + y)**Integer(10)
      >>> all(f[b] == q_binomial(Integer(10), b.list()[Integer(0)]) for b in f.support())
      True

  We now do a computation with a non-standard \(B\) matrix:

  Sage

      sage: B = matrix([[0,1,2],[-1,0,3],[-2,-3,0]])
      sage: B
      [ 0  1  2]
      [-1  0  3]
      [-2 -3  0]
      sage: q = ZZ['q'].gen()
      sage: R.<x,y,z> = algebras.qCommutingPolynomials(q, B)
      sage: y * x
      q*x*y
      sage: z * x
      q^2*x*z
      sage: z * y
      q^3*y*z

      sage: f = (x + z)^10
      sage: all(f[b] == q_binomial(10, b.list()[0], q^2) for b in f.support())
      True

      sage: f = (y + z)^10
      sage: all(f[b] == q_binomial(10, b.list()[1], q^3) for b in f.support())
      True

  Python

      >>> from sage.all import *
      >>> B = matrix([[Integer(0),Integer(1),Integer(2)],[-Integer(1),Integer(0),Integer(3)],[-Integer(2),-Integer(3),Integer(0)]])
      >>> B
      [ 0  1  2]
      [-1  0  3]
      [-2 -3  0]
      >>> q = ZZ['q'].gen()
      >>> R = algebras.qCommutingPolynomials(q, B, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
      >>> y * x
      q*x*y
      >>> z * x
      q^2*x*z
      >>> z * y
      q^3*y*z

      >>> f = (x + z)**Integer(10)
      >>> all(f[b] == q_binomial(Integer(10), b.list()[Integer(0)], q**Integer(2)) for b in f.support())
      True

      >>> f = (y + z)**Integer(10)
      >>> all(f[b] == q_binomial(Integer(10), b.list()[Integer(1)], q**Integer(3)) for b in f.support())
      True

  one_basis()

    Return the basis index of the element \(1\).

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)
        sage: R.one_basis()
        1

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> R.one_basis()
        1

  product_on_basis(x, y)

    Return the product of two monomials given by `x` and `y`.

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y> = algebras.qCommutingPolynomials(q)
        sage: R.product_on_basis(x.leading_support(), y.leading_support())
        x*y
        sage: R.product_on_basis(y.leading_support(), x.leading_support())
        q*x*y

        sage: x * y
        x*y
        sage: y * x
        q*x*y
        sage: y^2 * x
        q^2*x*y^2
        sage: y * x^2
        q^2*x^2*y
        sage: x * y * x
        q*x^2*y
        sage: y^2 * x^2
        q^4*x^2*y^2
        sage: (x + y)^2
        x^2 + (q+1)*x*y + y^2
        sage: (x + y)^3
        x^3 + (q^2+q+1)*x^2*y + (q^2+q+1)*x*y^2 + y^3
        sage: (x + y)^4
        x^4 + (q^3+q^2+q+1)*x^3*y + (q^4+q^3+2*q^2+q+1)*x^2*y^2 + (q^3+q^2+q+1)*x*y^3 + y^4

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y',)); (x, y,) = R._first_ngens(2)
        >>> R.product_on_basis(x.leading_support(), y.leading_support())
        x*y
        >>> R.product_on_basis(y.leading_support(), x.leading_support())
        q*x*y

        >>> x * y
        x*y
        >>> y * x
        q*x*y
        >>> y**Integer(2) * x
        q^2*x*y^2
        >>> y * x**Integer(2)
        q^2*x^2*y
        >>> x * y * x
        q*x^2*y
        >>> y**Integer(2) * x**Integer(2)
        q^4*x^2*y^2
        >>> (x + y)**Integer(2)
        x^2 + (q+1)*x*y + y^2
        >>> (x + y)**Integer(3)
        x^3 + (q^2+q+1)*x^2*y + (q^2+q+1)*x*y^2 + y^3
        >>> (x + y)**Integer(4)
        x^4 + (q^3+q^2+q+1)*x^3*y + (q^4+q^3+2*q^2+q+1)*x^2*y^2 + (q^3+q^2+q+1)*x*y^3 + y^4

    With a non-standard \(B\) matrix:

    Sage

        sage: B = matrix([[0,1,2],[-1,0,3],[-2,-3,0]])
        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingPolynomials(q, B=B)
        sage: x * y
        x*y
        sage: y * x^2
        q^2*x^2*y
        sage: z^2 * x
        q^4*x*z^2
        sage: z^2 * x^3
        q^12*x^3*z^2
        sage: z^2 * y
        q^6*y*z^2
        sage: z^2 * y^3
        q^18*y^3*z^2

    [Python]

        >>> from sage.all import *
        >>> B = matrix([[Integer(0),Integer(1),Integer(2)],[-Integer(1),Integer(0),Integer(3)],[-Integer(2),-Integer(3),Integer(0)]])
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, B=B, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> x * y
        x*y
        >>> y * x**Integer(2)
        q^2*x^2*y
        >>> z**Integer(2) * x
        q^4*x*z^2
        >>> z**Integer(2) * x**Integer(3)
        q^12*x^3*z^2
        >>> z**Integer(2) * y
        q^6*y*z^2
        >>> z**Integer(2) * y**Integer(3)
        q^18*y^3*z^2

class sage.algebras.q_commuting_polynomials.qCommutingPolynomials_generic(q, B, indices, names)

  Bases: `CombinatorialFreeModule`

  Base class for algebra of \(q\)-commuting (Laurent, etc.) polynomials.

  Let \(R\) be a commutative ring, and fix an element \(q \in R\). Let \(B = (B_{xy})_{x,y \in I}\) be a skew-symmetric bilinear form with index set \(I\). Let \(R[I]_{q,B}\) denote the polynomial ring in the variables \(I\) such that we have the \(q\)-commuting relation for \(x, y \in I\):

  \[y x = q^{B_{xy}} \cdot x y.\]

  This is a graded \(R\)-algebra with a natural basis given by monomials written in increasing order with respect to some total order on \(I\).

  algebra_generators()

    Return the algebra generators of `self`.

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)
        sage: R.algebra_generators()
        Finite family {'x': x, 'y': y, 'z': z}

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> R.algebra_generators()
        Finite family {'x': x, 'y': y, 'z': z}

  degree_on_basis(m)

    Return the degree of the monomial index by `m`.

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)
        sage: R.degree_on_basis(R.one_basis())
        0
        sage: f = (x + y)^3 + z^3
        sage: f.degree()
        3

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> R.degree_on_basis(R.one_basis())
        0
        >>> f = (x + y)**Integer(3) + z**Integer(3)
        >>> f.degree()
        3

  dimension()

    Return the dimension of `self`, which is \(\infty\).

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)
        sage: R.dimension()
        +Infinity

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> R.dimension()
        +Infinity

  gen(i)

    Return the `i`-generator of `self`.

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)
        sage: R.gen(0)
        x
        sage: R.gen(2)
        z

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> R.gen(Integer(0))
        x
        >>> R.gen(Integer(2))
        z

  gens()

    Return the generators of `self`.

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)
        sage: R.gens()
        (x, y, z)

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> R.gens()
        (x, y, z)

  q()

    Return the parameter \(q\).

    EXAMPLES:

    Sage

        sage: q = ZZ['q'].fraction_field().gen()
        sage: R.<x,y,z> = algebras.qCommutingPolynomials(q)
        sage: R.q() == q
        True

    Python

        >>> from sage.all import *
        >>> q = ZZ['q'].fraction_field().gen()
        >>> R = algebras.qCommutingPolynomials(q, names=('x', 'y', 'z',)); (x, y, z,) = R._first_ngens(3)
        >>> R.q() == q
        True