Non-unital non-associative algebras - Category Framework

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

# Non-unital non-associative algebras

class sage.categories.magmatic_algebras.MagmaticAlgebras(base, name=None)

  Bases: `Category_over_base_ring`

  The category of algebras over a given base ring.

  An algebra over a ring \(R\) is a module over \(R\) endowed with a bilinear multiplication.

  Warning

  `MagmaticAlgebras` will eventually replace the current `Algebras` for consistency with e.g. Wikipedia article Algebras which assumes neither associativity nor the existence of a unit (see Issue #15043).

  EXAMPLES:

  Sage

      sage: from sage.categories.magmatic_algebras import MagmaticAlgebras
      sage: C = MagmaticAlgebras(ZZ); C
      Category of magmatic algebras over Integer Ring
      sage: C.super_categories()
      [Category of additive commutative additive associative additive
        unital distributive magmas and additive magmas,
       Category of modules over Integer Ring]

  Python

      >>> from sage.all import *
      >>> from sage.categories.magmatic_algebras import MagmaticAlgebras
      >>> C = MagmaticAlgebras(ZZ); C
      Category of magmatic algebras over Integer Ring
      >>> C.super_categories()
      [Category of additive commutative additive associative additive
        unital distributive magmas and additive magmas,
       Category of modules over Integer Ring]

  Associative

    alias of `AssociativeAlgebras`

  class ParentMethods

    Bases: `object`

    algebra_generators()

      Return a family of generators of this algebra.

      EXAMPLES:

      Sage

          sage: F = AlgebrasWithBasis(QQ).example(); F                            # needs sage.combinat sage.modules
          An example of an algebra with basis:
           the free algebra on the generators ('a', 'b', 'c') over Rational Field
          sage: F.algebra_generators()                                            # needs sage.combinat sage.modules
          Family (B[word: a], B[word: b], B[word: c])

      Python

          >>> from sage.all import *
          >>> F = AlgebrasWithBasis(QQ).example(); F                            # needs sage.combinat sage.modules
          An example of an algebra with basis:
           the free algebra on the generators ('a', 'b', 'c') over Rational Field
          >>> F.algebra_generators()                                            # needs sage.combinat sage.modules
          Family (B[word: a], B[word: b], B[word: c])

  Unital

    alias of `UnitalAlgebras`

  class WithBasis(base_category)

    Bases: `CategoryWithAxiom_over_base_ring`

    class FiniteDimensional(base_category)

      Bases: `CategoryWithAxiom_over_base_ring`

      class ParentMethods

        Bases: `object`

        derivations_basis()

          Return a basis for the Lie algebra of derivations of `self` as matrices.

          A derivation \(D\) of an algebra is an endomorphism of \(A\) such that

          \[D(ab) = D(a) b + a D(b)\]

          for all \(a, b \in A\). The set of all derivations form a Lie algebra.

          EXAMPLES:

          We construct the Heisenberg Lie algebra as a multiplicative algebra:

          Sage

              sage: # needs sage.combinat sage.modules
              sage: p_mult = matrix([[0,0,0], [0,0,-1], [0,0,0]])
              sage: q_mult = matrix([[0,0,1], [0,0,0], [0,0,0]])
              sage: A = algebras.FiniteDimensional(QQ,
              ....:          [p_mult, q_mult, matrix(QQ, 3, 3)], 'p,q,z')
              sage: A.inject_variables()
              Defining p, q, z
              sage: p * q
              z
              sage: q * p
              -z
              sage: A.derivations_basis()
              (
              [1 0 0]  [0 1 0]  [0 0 0]  [0 0 0]  [0 0 0]  [0 0 0]
              [0 0 0]  [0 0 0]  [1 0 0]  [0 1 0]  [0 0 0]  [0 0 0]
              [0 0 1], [0 0 0], [0 0 0], [0 0 1], [1 0 0], [0 1 0]
              )

          Python

              >>> from sage.all import *
              >>> # needs sage.combinat sage.modules
              >>> p_mult = matrix([[Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),-Integer(1)], [Integer(0),Integer(0),Integer(0)]])
              >>> q_mult = matrix([[Integer(0),Integer(0),Integer(1)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]])
              >>> A = algebras.FiniteDimensional(QQ,
              ...          [p_mult, q_mult, matrix(QQ, Integer(3), Integer(3))], 'p,q,z')
              >>> A.inject_variables()
              Defining p, q, z
              >>> p * q
              z
              >>> q * p
              -z
              >>> A.derivations_basis()
              (
              [1 0 0]  [0 1 0]  [0 0 0]  [0 0 0]  [0 0 0]  [0 0 0]
              [0 0 0]  [0 0 0]  [1 0 0]  [0 1 0]  [0 0 0]  [0 0 0]
              [0 0 1], [0 0 0], [0 0 0], [0 0 1], [1 0 0], [0 1 0]
              )

          We construct another example using the exterior algebra and verify we obtain a derivation:

          Sage

              sage: # needs sage.combinat sage.modules
              sage: A = algebras.Exterior(QQ, 1)
              sage: A.derivations_basis()
              (
              [0 0]
              [0 1]
              )
              sage: D = A.module_morphism(matrix=A.derivations_basis()[0],
              ....:                       codomain=A)
              sage: one, e = A.basis()
              sage: all(D(a*b) == D(a) * b + a * D(b)
              ....:     for a in A.basis() for b in A.basis())
              True

          [Python]

              >>> from sage.all import *
              >>> # needs sage.combinat sage.modules
              >>> A = algebras.Exterior(QQ, Integer(1))
              >>> A.derivations_basis()
              (
              [0 0]
              [0 1]
              )
              >>> D = A.module_morphism(matrix=A.derivations_basis()[Integer(0)],
              ...                       codomain=A)
              >>> one, e = A.basis()
              >>> all(D(a*b) == D(a) * b + a * D(b)
              ...     for a in A.basis() for b in A.basis())
              True

          REFERENCES:

          Wikipedia article Derivation_(differential_algebra)

        to_finite_dimensional_algebra(names='e', assume_associative=True, assume_unital=True)

          Return `self` as a `sage.algebras.finite_dimensional_algebra.FiniteDimensionalAlgebra`.

          This forgets the indexing of the basis, flattening the elements into vectors. The name of the vectors can be passed via the `names` parameter.

          To convert an element \(v\) of `self` into the `FiniteDimensionalAlgebra` `F` returned by this method, use `F(v.to_vector())`. For the inverse direction, use `self.from_vector(v.vector())`.

          INPUT:

          - `names` – string (default: `'e'`); names for the basis elements

          - `assume_associative` – boolean (default: `False`); if `True`, then the category is set to `category.Associative()` and methods requiring associativity assume this

          - `assume_unital` – boolean (default: `False`); if `True`, then the category is set to `category.Unital()` and methods requiring unitality assume this

          EXAMPLES:

          Sage

              sage: B = DescentAlgebra(QQ,3).B()
              sage: list(B.basis())
              [B[1, 1, 1], B[1, 2], B[2, 1], B[3]]
              sage: B_fda = B.to_finite_dimensional_algebra(); B_fda
              Finite-dimensional algebra of degree 4 over Rational Field
              sage: e = B_fda.basis(); e
              Finite family {0: e0, 1: e1, 2: e2, 3: e3}
              sage: x = e[1] * e[2]; x
              e0 + e1
              sage: y = B[1,2] * B[2,1]; y
              B[1, 1, 1] + B[1, 2]
              sage: B_fda(y.to_vector()) == x
              True
              sage: B.from_vector(x.vector()) == y
              True

          Python

              >>> from sage.all import *
              >>> B = DescentAlgebra(QQ,Integer(3)).B()
              >>> list(B.basis())
              [B[1, 1, 1], B[1, 2], B[2, 1], B[3]]
              >>> B_fda = B.to_finite_dimensional_algebra(); B_fda
              Finite-dimensional algebra of degree 4 over Rational Field
              >>> e = B_fda.basis(); e
              Finite family {0: e0, 1: e1, 2: e2, 3: e3}
              >>> x = e[Integer(1)] * e[Integer(2)]; x
              e0 + e1
              >>> y = B[Integer(1),Integer(2)] * B[Integer(2),Integer(1)]; y
              B[1, 1, 1] + B[1, 2]
              >>> B_fda(y.to_vector()) == x
              True
              >>> B.from_vector(x.vector()) == y
              True

    class ParentMethods

      Bases: `object`

      algebra_generators()

        Return generators for this algebra.

        This default implementation returns the basis of this algebra.

        OUTPUT: a family

        See also

        - `basis()`

        - `MagmaticAlgebras.ParentMethods.algebra_generators()`

        EXAMPLES:

        Sage

            sage: D4 = DescentAlgebra(QQ, 4).B()                                # needs sage.combinat sage.groups sage.modules
            sage: D4.algebra_generators()                                       # needs sage.combinat sage.groups sage.modules
            Lazy family (...)_{i in Compositions of 4}

            sage: R.<x> = ZZ[]
            sage: P = PartitionAlgebra(1, x, R)                                 # needs sage.combinat sage.modules
            sage: P.algebra_generators()                                        # needs sage.combinat sage.modules
            Lazy family (Term map
             from Partition diagrams of order 1
               to Partition Algebra of rank 1 with parameter x
                   over Univariate Polynomial Ring in x
                    over Integer Ring(i))_{i in Partition diagrams of order 1}

        Python

            >>> from sage.all import *
            >>> D4 = DescentAlgebra(QQ, Integer(4)).B()                                # needs sage.combinat sage.groups sage.modules
            >>> D4.algebra_generators()                                       # needs sage.combinat sage.groups sage.modules
            Lazy family (...)_{i in Compositions of 4}

            >>> R = ZZ['x']; (x,) = R._first_ngens(1)
            >>> P = PartitionAlgebra(Integer(1), x, R)                                 # needs sage.combinat sage.modules
            >>> P.algebra_generators()                                        # needs sage.combinat sage.modules
            Lazy family (Term map
             from Partition diagrams of order 1
               to Partition Algebra of rank 1 with parameter x
                   over Univariate Polynomial Ring in x
                    over Integer Ring(i))_{i in Partition diagrams of order 1}

      product()

        The product of the algebra, as per `Magmas.ParentMethods.product()`

        By default, this is implemented using one of the following methods, in the specified order:

        - `product_on_basis()`

        - `product_by_coercion()`

        EXAMPLES:

        Sage

            sage: A = AlgebrasWithBasis(QQ).example()                           # needs sage.combinat sage.modules
            sage: a, b, c = A.algebra_generators()                              # needs sage.combinat sage.modules
            sage: A.product(a + 2*b, 3*c)                                       # needs sage.combinat sage.modules
            3*B[word: ac] + 6*B[word: bc]

        Python

            >>> from sage.all import *
            >>> A = AlgebrasWithBasis(QQ).example()                           # needs sage.combinat sage.modules
            >>> a, b, c = A.algebra_generators()                              # needs sage.combinat sage.modules
            >>> A.product(a + Integer(2)*b, Integer(3)*c)                                       # needs sage.combinat sage.modules
            3*B[word: ac] + 6*B[word: bc]

      product_on_basis(i, j)

        The product of the algebra on the basis (optional).

        INPUT:

        - `i`, `j` – the indices of two elements of the basis of `self`

        Return the product of the two corresponding basis elements indexed by `i` and `j`.

        If implemented, `product()` is defined from it by bilinearity.

        EXAMPLES:

        Sage

            sage: A = AlgebrasWithBasis(QQ).example()                           # needs sage.combinat sage.modules
            sage: Word = A.basis().keys()                                       # needs sage.combinat sage.modules
            sage: A.product_on_basis(Word("abc"), Word("cba"))                  # needs sage.combinat sage.modules
            B[word: abccba]

        Python

            >>> from sage.all import *
            >>> A = AlgebrasWithBasis(QQ).example()                           # needs sage.combinat sage.modules
            >>> Word = A.basis().keys()                                       # needs sage.combinat sage.modules
            >>> A.product_on_basis(Word("abc"), Word("cba"))                  # needs sage.combinat sage.modules
            B[word: abccba]

  additional_structure()

    Return `None`.

    Indeed, the category of (magmatic) algebras defines no new structure: a morphism of modules and of magmas between two (magmatic) algebras is a (magmatic) algebra morphism.

    See also

    `Category.additional_structure()`

    Todo

    This category should be a `CategoryWithAxiom`, the axiom specifying the compatibility between the magma and module structure.

    EXAMPLES:

    Sage

        sage: from sage.categories.magmatic_algebras import MagmaticAlgebras
        sage: MagmaticAlgebras(ZZ).additional_structure()

    Python

        >>> from sage.all import *
        >>> from sage.categories.magmatic_algebras import MagmaticAlgebras
        >>> MagmaticAlgebras(ZZ).additional_structure()

  super_categories()

    EXAMPLES:

    Sage

        sage: from sage.categories.magmatic_algebras import MagmaticAlgebras
        sage: MA = MagmaticAlgebras(ZZ)
        sage: MA.super_categories()
        [Category of additive commutative additive associative additive
          unital distributive magmas and additive magmas,
         Category of modules over Integer Ring]

        sage: from sage.categories.additive_semigroups import AdditiveSemigroups
        sage: MA.is_subcategory((AdditiveSemigroups() & Magmas()).Distributive())
        True

    Python

        >>> from sage.all import *
        >>> from sage.categories.magmatic_algebras import MagmaticAlgebras
        >>> MA = MagmaticAlgebras(ZZ)
        >>> MA.super_categories()
        [Category of additive commutative additive associative additive
          unital distributive magmas and additive magmas,
         Category of modules over Integer Ring]

        >>> from sage.categories.additive_semigroups import AdditiveSemigroups
        >>> MA.is_subcategory((AdditiveSemigroups() & Magmas()).Distributive())
        True