  
  [1X62 [33X[0;0YAlgebras[133X[101X
  
  [33X[0;0YAn  algebra is a vector space equipped with a bilinear map (multiplication).
  This  chapter describes the functions in [5XGAP[105X that deal with general algebras
  and associative algebras.[133X
  
  [33X[0;0YAlgebras in [5XGAP[105X are vector spaces in a natural way. So all the functionality
  for vector spaces (see Chapter [14X61[114X) is also applicable to algebras.[133X
  
  
  [1X62.1 [33X[0;0YInfoAlgebra (Info Class)[133X[101X
  
  [1X62.1-1 InfoAlgebra[101X
  
  [29X[2XInfoAlgebra[102X[32X info class
  
  [33X[0;0Yis the info class for the functions dealing with algebras (see [14X7.4[114X).[133X
  
  
  [1X62.2 [33X[0;0YConstructing Algebras by Generators[133X[101X
  
  [1X62.2-1 Algebra[101X
  
  [29X[2XAlgebra[102X( [3XF[103X, [3Xgens[103X[, [3Xzero[103X][, [3X"basis"[103X] ) [32X function
  
  [33X[0;0Y[10XAlgebra( [3XF[103X[10X, [3Xgens[103X[10X )[110X is the algebra over the division ring [3XF[103X, generated by the
  vectors in the list [3Xgens[103X.[133X
  
  [33X[0;0YIf  there  are  three  arguments,  a  division ring [3XF[103X and a list [3Xgens[103X and an
  element  [3Xzero[103X,  then  [10XAlgebra( [3XF[103X[10X, [3Xgens[103X[10X, [3Xzero[103X[10X )[110X is the [3XF[103X-algebra generated by
  [3Xgens[103X, with zero element [3Xzero[103X.[133X
  
  [33X[0;0YIf  the  last  argument  is  the string [10X"basis"[110X then the vectors in [3Xgens[103X are
  known to form a basis of the algebra (as an [3XF[103X-vector space).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= Algebra( Rationals, [ m ] );[127X[104X
    [4X[28X<algebra over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XDimension( A );[127X[104X
    [4X[28X2[128X[104X
  [4X[32X[104X
  
  [1X62.2-2 AlgebraWithOne[101X
  
  [29X[2XAlgebraWithOne[102X( [3XF[103X, [3Xgens[103X[, [3Xzero[103X][, [3X"basis"[103X] ) [32X function
  
  [33X[0;0Y[10XAlgebraWithOne(  [3XF[103X[10X, [3Xgens[103X[10X )[110X is the algebra-with-one over the division ring [3XF[103X,
  generated by the vectors in the list [3Xgens[103X.[133X
  
  [33X[0;0YIf  there  are  three  arguments,  a  division ring [3XF[103X and a list [3Xgens[103X and an
  element [3Xzero[103X, then [10XAlgebraWithOne( [3XF[103X[10X, [3Xgens[103X[10X, [3Xzero[103X[10X )[110X is the [3XF[103X-algebra-with-one
  generated by [3Xgens[103X, with zero element [3Xzero[103X.[133X
  
  [33X[0;0YIf  the  last  argument  is  the string [10X"basis"[110X then the vectors in [3Xgens[103X are
  known to form a basis of the algebra (as an [3XF[103X-vector space).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraWithOne( Rationals, [ m ] );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XDimension( A );[127X[104X
    [4X[28X3[128X[104X
    [4X[25Xgap>[125X [27XOne(A);[127X[104X
    [4X[28X[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ][128X[104X
  [4X[32X[104X
  
  
  [1X62.3 [33X[0;0YConstructing Algebras as Free Algebras[133X[101X
  
  [1X62.3-1 FreeAlgebra[101X
  
  [29X[2XFreeAlgebra[102X( [3XR[103X, [3Xrank[103X[, [3Xname[103X] ) [32X function
  [29X[2XFreeAlgebra[102X( [3XR[103X, [3Xname1[103X, [3Xname2[103X, [3X...[103X ) [32X function
  
  [33X[0;0Yis  a  free  (nonassociative) algebra of rank [3Xrank[103X over the division ring [3XR[103X.
  Here  [3Xname[103X,  and  [3Xname1[103X, [3Xname2[103X, ... are optional strings that can be used to
  provide names for the generators.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FreeAlgebra( Rationals, "a", "b" );[127X[104X
    [4X[28X<algebra over Rationals, with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xg:= GeneratorsOfAlgebra( A );[127X[104X
    [4X[28X[ (1)*a, (1)*b ][128X[104X
    [4X[25Xgap>[125X [27X(g[1]*g[2])*((g[2]*g[1])*g[1]);[127X[104X
    [4X[28X(1)*((a*b)*((b*a)*a))[128X[104X
  [4X[32X[104X
  
  [1X62.3-2 FreeAlgebraWithOne[101X
  
  [29X[2XFreeAlgebraWithOne[102X( [3XR[103X, [3Xrank[103X[, [3Xname[103X] ) [32X function
  [29X[2XFreeAlgebraWithOne[102X( [3XR[103X, [3Xname1[103X, [3Xname2[103X, [3X...[103X ) [32X function
  
  [33X[0;0Yis  a  free (nonassociative) algebra-with-one of rank [3Xrank[103X over the division
  ring  [3XR[103X.  Here  [3Xname[103X, and [3Xname1[103X, [3Xname2[103X, ... are optional strings that can be
  used to provide names for the generators.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FreeAlgebraWithOne( Rationals, 4, "q" );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 4 generators>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfAlgebra( A );[127X[104X
    [4X[28X[ (1)*<identity ...>, (1)*q.1, (1)*q.2, (1)*q.3, (1)*q.4 ][128X[104X
    [4X[25Xgap>[125X [27XOne( A );[127X[104X
    [4X[28X(1)*<identity ...>[128X[104X
  [4X[32X[104X
  
  [1X62.3-3 FreeAssociativeAlgebra[101X
  
  [29X[2XFreeAssociativeAlgebra[102X( [3XR[103X, [3Xrank[103X[, [3Xname[103X] ) [32X function
  [29X[2XFreeAssociativeAlgebra[102X( [3XR[103X, [3Xname1[103X, [3Xname2[103X, [3X...[103X ) [32X function
  
  [33X[0;0Yis  a  free  associative algebra of rank [3Xrank[103X over the division ring [3XR[103X. Here
  [3Xname[103X, and [3Xname1[103X, [3Xname2[103X, ... are optional strings that can be used to provide
  names for the generators.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FreeAssociativeAlgebra( GF( 5 ), 4, "a" );[127X[104X
    [4X[28X<algebra over GF(5), with 4 generators>[128X[104X
  [4X[32X[104X
  
  [1X62.3-4 FreeAssociativeAlgebraWithOne[101X
  
  [29X[2XFreeAssociativeAlgebraWithOne[102X( [3XR[103X, [3Xrank[103X[, [3Xname[103X] ) [32X function
  [29X[2XFreeAssociativeAlgebraWithOne[102X( [3XR[103X, [3Xname1[103X, [3Xname2[103X, [3X...[103X ) [32X function
  
  [33X[0;0Yis  a  free associative algebra-with-one of rank [3Xrank[103X over the division ring
  [3XR[103X. Here [3Xname[103X, and [3Xname1[103X, [3Xname2[103X, ... are optional strings that can be used to
  provide names for the generators.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FreeAssociativeAlgebraWithOne( Rationals, "a", "b", "c" );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfAlgebra( A );[127X[104X
    [4X[28X[ (1)*<identity ...>, (1)*a, (1)*b, (1)*c ][128X[104X
    [4X[25Xgap>[125X [27XOne( A );[127X[104X
    [4X[28X(1)*<identity ...>[128X[104X
  [4X[32X[104X
  
  
  [1X62.4 [33X[0;0YConstructing Algebras by Structure Constants[133X[101X
  
  [33X[0;0YFor  an  introduction  into  structure constants and how they are handled by
  [5XGAP[105X, we refer to Section [14X'Tutorial: Algebras'[114X of the user's tutorial.[133X
  
  [1X62.4-1 AlgebraByStructureConstants[101X
  
  [29X[2XAlgebraByStructureConstants[102X( [3XR[103X, [3Xsctable[103X[, [3Xnameinfo[103X] ) [32X function
  
  [33X[0;0Yreturns  a  free left module [22XA[122X over the division ring [3XR[103X, with multiplication
  defined  by  the  structure  constants  table [3Xsctable[103X. The optional argument
  [3Xnameinfo[103X  can  be  used to prescribe names for the elements of the canonical
  basis  of  [22XA[122X;  it  can  be  either a string [3Xname[103X (then [3Xname[103X[10X1[110X, [3Xname[103X[10X2[110X etc. are
  chosen)  or  a  list  of  strings  which are then chosen. The vectors of the
  canonical  basis  of  [22XA[122X  correspond  to  the  vectors  of the basis given by
  [3Xsctable[103X.[133X
  
  [33X[0;0YIt is [13Xnot[113X checked whether the coefficients in [3Xsctable[103X are really elements in
  [3XR[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 1, [ 1/2, 1, 2/3, 2 ] );[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraByStructureConstants( Rationals, T );[127X[104X
    [4X[28X<algebra of dimension 2 over Rationals>[128X[104X
    [4X[25Xgap>[125X [27Xb:= BasisVectors( Basis( A ) );;[127X[104X
    [4X[25Xgap>[125X [27Xb[1]^2;[127X[104X
    [4X[28X(1/2)*v.1+(2/3)*v.2[128X[104X
    [4X[25Xgap>[125X [27Xb[1]*b[2];[127X[104X
    [4X[28X0*v.1[128X[104X
  [4X[32X[104X
  
  [1X62.4-2 StructureConstantsTable[101X
  
  [29X[2XStructureConstantsTable[102X( [3XB[103X ) [32X attribute
  
  [33X[0;0YLet  [3XB[103X be a basis of a free left module [22XR[122X, say, that is also a ring. In this
  case [2XStructureConstantsTable[102X returns a structure constants table [22XT[122X in sparse
  representation,    as   used   for   structure   constants   algebras   (see
  Section [14X'Tutorial: Algebras'[114X of the [5XGAP[105X User's Tutorial).[133X
  
  [33X[0;0YIf  [3XB[103X  has length [22Xn[122X then [22XT[122X is a list of length [22Xn+2[122X. The first [22Xn[122X entries of [22XT[122X
  are  lists of length [22Xn[122X. [22XT[ n+1 ][122X is one of [22X1[122X, [22X-1[122X, or [22X0[122X; in the case of [22X1[122X the
  table  is  known  to  be  symmetric,  in  the  case  of [22X-1[122X it is known to be
  antisymmetric, and [22X0[122X occurs in all other cases. [22XT[ n+2 ][122X is the zero element
  of the coefficient domain.[133X
  
  [33X[0;0YThe  coefficients  w.r.t. [3XB[103X of the product of the [22Xi[122X-th and [22Xj[122X-th basis vector
  of  [3XB[103X  are  stored  in [22XT[i][j][122X as a list of length [22X2[122X; its first entry is the
  list  of  positions of nonzero coefficients, the second entry is the list of
  these coefficients themselves.[133X
  
  [33X[0;0YThe  multiplication  in  an  algebra  [22XA[122X with vector space basis [3XB[103X with basis
  vectors  [22X[ v_1, ..., v_n ][122X is determined by the so-called structure matrices
  [22XM_k  =  [  m_ijk ]_ij[122X, [22X1 ≤ k ≤ n[122X. The [22XM_k[122X are defined by [22Xv_i v_j = ∑_k m_ijk
  v_k[122X. Let [22Xa = [ a_1, ..., a_n ][122X and [22Xb = [ b_1, ..., b_n ][122X. Then[133X
  
  
        [33X[1;6Y[24X[33X[0;0Y( ∑_i a_i v_i ) ( ∑_j b_j v_j ) = ∑_{i,j} a_i b_j ( v_i v_j ) = ∑_k (
        ∑_j ( ∑_i a_i m_ijk ) b_j ) v_k = ∑_k ( a M_k b^tr ) v_k.[133X[124X[133X
  
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27XStructureConstantsTable( Basis( A ) );[127X[104X
    [4X[28X[ [ [ [ 1 ], [ 1 ] ], [ [ 2 ], [ 1 ] ], [ [ 3 ], [ 1 ] ], [128X[104X
    [4X[28X      [ [ 4 ], [ 1 ] ] ], [128X[104X
    [4X[28X  [ [ [ 2 ], [ 1 ] ], [ [ 1 ], [ -1 ] ], [ [ 4 ], [ 1 ] ], [128X[104X
    [4X[28X      [ [ 3 ], [ -1 ] ] ], [128X[104X
    [4X[28X  [ [ [ 3 ], [ 1 ] ], [ [ 4 ], [ -1 ] ], [ [ 1 ], [ -1 ] ], [128X[104X
    [4X[28X      [ [ 2 ], [ 1 ] ] ], [128X[104X
    [4X[28X  [ [ [ 4 ], [ 1 ] ], [ [ 3 ], [ 1 ] ], [ [ 2 ], [ -1 ] ], [128X[104X
    [4X[28X      [ [ 1 ], [ -1 ] ] ], 0, 0 ][128X[104X
  [4X[32X[104X
  
  [1X62.4-3 EmptySCTable[101X
  
  [29X[2XEmptySCTable[102X( [3Xdim[103X, [3Xzero[103X[, [3Xflag[103X] ) [32X function
  
  [33X[0;0Y[2XEmptySCTable[102X returns a structure constants table for an algebra of dimension
  [3Xdim[103X,  describing  trivial  multiplication.  [3Xzero[103X  must  be  the  zero of the
  coefficients  domain. If the multiplication is known to be (anti)commutative
  then  this  can be indicated by the optional third argument [3Xflag[103X, which must
  be one of the strings [10X"symmetric"[110X, [10X"antisymmetric"[110X.[133X
  
  [33X[0;0YFor filling up the structure constants table, see [2XSetEntrySCTable[102X ([14X62.4-4[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XEmptySCTable( 2, Zero( GF(5) ), "antisymmetric" );[127X[104X
    [4X[28X[ [ [ [  ], [  ] ], [ [  ], [  ] ] ], [128X[104X
    [4X[28X  [ [ [  ], [  ] ], [ [  ], [  ] ] ], -1, 0*Z(5) ][128X[104X
  [4X[32X[104X
  
  [1X62.4-4 SetEntrySCTable[101X
  
  [29X[2XSetEntrySCTable[102X( [3XT[103X, [3Xi[103X, [3Xj[103X, [3Xlist[103X ) [32X function
  
  [33X[0;0Ysets the entry of the structure constants table [3XT[103X that describes the product
  of  the [3Xi[103X-th basis element with the [3Xj[103X-th basis element to the value given by
  the list [3Xlist[103X.[133X
  
  [33X[0;0YIf  [3XT[103X  is known to be antisymmetric or symmetric then also the value [10X[3XT[103X[10X[[3Xj[103X[10X][[3Xi[103X[10X][110X
  is set.[133X
  
  [33X[0;0Y[3Xlist[103X must be of the form [22X[ c_ij^{k_1}, k_1, c_ij^{k_2}, k_2, ... ][122X.[133X
  
  [33X[0;0YThe  entries  at  the odd positions of [3Xlist[103X must be compatible with the zero
  element  stored  in  [3XT[103X.  For convenience, these entries may also be rational
  numbers that are automatically replaced by the corresponding elements in the
  appropriate prime field in finite characteristic if necessary.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 1, [ 1/2, 1, 2/3, 2 ] );[127X[104X
    [4X[25Xgap>[125X [27XT;[127X[104X
    [4X[28X[ [ [ [ 1, 2 ], [ 1/2, 2/3 ] ], [ [  ], [  ] ] ], [128X[104X
    [4X[28X  [ [ [  ], [  ] ], [ [  ], [  ] ] ], 0, 0 ][128X[104X
  [4X[32X[104X
  
  [1X62.4-5 GapInputSCTable[101X
  
  [29X[2XGapInputSCTable[102X( [3XT[103X, [3Xvarname[103X ) [32X function
  
  [33X[0;0Yis  a  string  that  describes  the  structure constants table [3XT[103X in terms of
  [2XEmptySCTable[102X ([14X62.4-3[114X) and [2XSetEntrySCTable[102X ([14X62.4-4[114X). The assignments are made
  to the variable [3Xvarname[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 2, [ 1, 2 ] );[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 2, 1, [ 1, 2 ] );[127X[104X
    [4X[25Xgap>[125X [27XGapInputSCTable( T, "T" );[127X[104X
    [4X[28X"T:= EmptySCTable( 2, 0 );\nSetEntrySCTable( T, 1, 2, [1,2] );\nSetEnt\[128X[104X
    [4X[28XrySCTable( T, 2, 1, [1,2] );\n"[128X[104X
  [4X[32X[104X
  
  [1X62.4-6 TestJacobi[101X
  
  [29X[2XTestJacobi[102X( [3XT[103X ) [32X function
  
  [33X[0;0Ytests  whether the structure constants table [3XT[103X satisfies the Jacobi identity
  [22Xv_i  * (v_j * v_k) + v_j * (v_k * v_i) + v_k * (v_i * v_j) = 0[122X for all basis
  vectors  [22Xv_i[122X  of the underlying algebra, where [22Xi ≤ j ≤ k[122X. (Thus antisymmetry
  is assumed.)[133X
  
  [33X[0;0YThe function returns [9Xtrue[109X if the Jacobi identity is satisfied, and a failing
  triple [22X[ i, j, k ][122X otherwise.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0, "antisymmetric" );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 2, [ 1, 2 ] );;[127X[104X
    [4X[25Xgap>[125X [27XTestJacobi( T );[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X62.4-7 IdentityFromSCTable[101X
  
  [29X[2XIdentityFromSCTable[102X( [3XT[103X ) [32X function
  
  [33X[0;0YLet  [3XT[103X  be  a  structure  constants  table  of  an algebra [22XA[122X of dimension [22Xn[122X.
  [10XIdentityFromSCTable(  [3XT[103X[10X  )[110X  is  either  [9Xfail[109X  or the vector of length [22Xn[122X that
  contains  the  coefficients of the multiplicative identity of [22XA[122X with respect
  to the basis that belongs to [3XT[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 1, [ 1, 1 ] );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 2, [ 1, 2 ] );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 2, 1, [ 1, 2 ] );;[127X[104X
    [4X[25Xgap>[125X [27XIdentityFromSCTable( T );[127X[104X
    [4X[28X[ 1, 0 ][128X[104X
  [4X[32X[104X
  
  [1X62.4-8 QuotientFromSCTable[101X
  
  [29X[2XQuotientFromSCTable[102X( [3XT[103X, [3Xnum[103X, [3Xden[103X ) [32X function
  
  [33X[0;0YLet  [3XT[103X  be  a  structure  constants  table  of  an algebra [22XA[122X of dimension [22Xn[122X.
  [10XQuotientFromSCTable(  [3XT[103X[10X  )[110X  is  either  [9Xfail[109X  or the vector of length [22Xn[122X that
  contains the coefficients of the quotient of [3Xnum[103X and [3Xden[103X with respect to the
  basis that belongs to [3XT[103X.[133X
  
  [33X[0;0YWe  solve  the  equation system [3Xnum[103X[22X= x *[122X [3Xden[103X. If no solution exists, [9Xfail[109X is
  returned.[133X
  
  [33X[0;0YIn terms of the basis [22XB[122X with vectors [22Xb_1, ..., b_n[122X this means for [22X[3Xnum[103X = ∑_{i
  =  1}^n a_i b_i[122X, [22X[3Xden[103X = ∑_{i = 1}^n c_i b_i[122X, [22Xx = ∑_{i = 1}^n x_i b_i[122X that [22Xa_k
  =  ∑_{i,j}  c_i  x_j  c_ijk[122X  for  all  [22Xk[122X.  Here  [22Xc_ijk[122X denotes the structure
  constants with respect to [22XB[122X. This means that (as a vector) [22Xa = x M[122X with [22XM_jk
  = ∑_{i = 1}^n c_ijk c_i[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 1, [ 1, 1 ] );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 2, 1, [ 1, 2 ] );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 2, [ 1, 2 ] );;[127X[104X
    [4X[25Xgap>[125X [27XQuotientFromSCTable( T, [0,1], [1,0] );[127X[104X
    [4X[28X[ 0, 1 ][128X[104X
  [4X[32X[104X
  
  
  [1X62.5 [33X[0;0YSome Special Algebras[133X[101X
  
  [1X62.5-1 QuaternionAlgebra[101X
  
  [29X[2XQuaternionAlgebra[102X( [3XF[103X[, [3Xa[103X, [3Xb[103X] ) [32X function
  [6XReturns:[106X  [33X[0;10Ya quaternion algebra over [3XF[103X, with parameters [3Xa[103X and [3Xb[103X.[133X
  
  [33X[0;0YLet  [3XF[103X  be a field or a list of field elements, let [22XF[122X be the field generated
  by  [3XF[103X,  and  let  [3Xa[103X  and  [3Xb[103X  two  elements in [22XF[122X. [2XQuaternionAlgebra[102X returns a
  quaternion algebra over [22XF[122X, with parameters [3Xa[103X and [3Xb[103X, i.e., a four-dimensional
  associative [22XF[122X-algebra with basis [22X(e,i,j,k)[122X and multiplication defined by [22Xe e
  =  e[122X,  [22Xe i = i e = i[122X, [22Xe j = j e = j[122X, [22Xe k = k e = k[122X, [22Xi i = [3Xa[103X e[122X, [22Xi j = - j i =
  k[122X,  [22Xi  k  =  -  k  i = [3Xa[103X j[122X, [22Xj j = [3Xb[103X e[122X, [22Xj k = - k j = [3Xb[103X i[122X, [22Xk k = - [3Xa[103X [3Xb[103X e[122X. The
  default value for both [3Xa[103X and [3Xb[103X is [22X-1 ∈ F[122X.[133X
  
  [33X[0;0YThe  [2XGeneratorsOfAlgebra[102X  ([14X62.9-1[114X)  and  [2XCanonicalBasis[102X ([14X61.5-3[114X) value of an
  algebra constructed with [2XQuaternionAlgebra[102X is the list [22X[ e, i, j, k ][122X.[133X
  
  [33X[0;0YTwo  quaternion  algebras  with  the  same  parameters  [3Xa[103X, [3Xb[103X lie in the same
  family,  so  it makes sense to consider their intersection or to ask whether
  they  are contained in each other. (This is due to the fact that the results
  of    [2XQuaternionAlgebra[102X    are    cached,    in    the    global    variable
  [10XQuaternionAlgebraData[110X.)[133X
  
  [33X[0;0YThe  embedding  of  the  field  [2XGaussianRationals[102X ([14X60.1-3[114X) into a quaternion
  algebra  [22XA[122X  over  [2XRationals[102X  ([14X17.1-1[114X)  is  not  uniquely determined. One can
  specify  one  embedding  as  a  vector space homomorphism that maps [10X1[110X to the
  first algebra generator of [22XA[122X, and [10XE(4)[110X to one of the others.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XQuaternionAlgebra( Rationals );[127X[104X
    [4X[28X<algebra-with-one of dimension 4 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.5-2 ComplexificationQuat[101X
  
  [29X[2XComplexificationQuat[102X( [3Xvector[103X ) [32X function
  [29X[2XComplexificationQuat[102X( [3Xmatrix[103X ) [32X function
  
  [33X[0;0YLet  [22XA  =  e F ⊕ i F ⊕ j F ⊕ k F[122X be a quaternion algebra over the field [22XF[122X of
  cyclotomics, with basis [22X(e,i,j,k)[122X.[133X
  
  [33X[0;0YIf [22Xv = v_1 + v_2 j[122X is a row vector over [22XA[122X with [22Xv_1 = e w_1 + i w_2[122X and [22Xv_2 =
  e  w_3  + i w_4[122X then [2XComplexificationQuat[102X called with argument [22Xv[122X returns the
  concatenation of [22Xw_1 +[122X[10XE(4)[110X[22Xw_2[122X and [22Xw_3 +[122X[10XE(4)[110X[22Xw_4[122X.[133X
  
  [33X[0;0YIf  [22XM  = M_1 + M_2 j[122X is a matrix over [22XA[122X with [22XM_1 = e N_1 + i N_2[122X and [22XM_2 = e
  N_3  +  i  N_4[122X  then [2XComplexificationQuat[102X called with argument [22XM[122X returns the
  block  matrix [22XA[122X over [22Xe F ⊕ i F[122X such that [22XA(1,1) = N_1 +[122X[10XE(4)[110X[22XN_2[122X, [22XA(2,2) = N_1
  -[122X[10XE(4)[110X[22XN_2[122X, [22XA(1,2) = N_3 +[122X[10XE(4)[110X[22XN_4[122X, and [22XA(2,1) = - N_3 +[122X[10XE(4)[110X[22XN_4[122X.[133X
  
  [33X[0;0YThen        [10XComplexificationQuat([3Xv[103X[10X)        *        ComplexificationQuat([3XM[103X[10X)=
  ComplexificationQuat([3Xv[103X[10X * [3XM[103X[10X)[110X, since[133X
  
  
        [33X[1;6Y[24X[33X[0;0Yv M = v_1 M_1 + v_2 j M_1 + v_1 M_2 j + v_2 j M_2 j = ( v_1 M_1 - v_2
        overline{M_2} ) + ( v_1 M_2 + v_2 overline{M_1} ) j.[133X[124X[133X
  
  
  [1X62.5-3 OctaveAlgebra[101X
  
  [29X[2XOctaveAlgebra[102X( [3XF[103X ) [32X function
  
  [33X[0;0YThe algebra of octonions over [3XF[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XOctaveAlgebra( Rationals );[127X[104X
    [4X[28X<algebra of dimension 8 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.5-4 FullMatrixAlgebra[101X
  
  [29X[2XFullMatrixAlgebra[102X( [3XR[103X, [3Xn[103X ) [32X function
  [29X[2XMatrixAlgebra[102X( [3XR[103X, [3Xn[103X ) [32X function
  [29X[2XMatAlgebra[102X( [3XR[103X, [3Xn[103X ) [32X function
  
  [33X[0;0Yis  the  full  matrix  algebra  of  [22X[3Xn[103X  ×  [3Xn[103X[122X  matrices over the ring [3XR[103X, for a
  nonnegative integer [3Xn[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:=FullMatrixAlgebra( Rationals, 20 );[127X[104X
    [4X[28X( Rationals^[ 20, 20 ] )[128X[104X
    [4X[25Xgap>[125X [27XDimension( A );[127X[104X
    [4X[28X400[128X[104X
  [4X[32X[104X
  
  [1X62.5-5 NullAlgebra[101X
  
  [29X[2XNullAlgebra[102X( [3XR[103X ) [32X attribute
  
  [33X[0;0YThe zero-dimensional algebra over [3XR[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= NullAlgebra( Rationals );[127X[104X
    [4X[28X<algebra over Rationals>[128X[104X
    [4X[25Xgap>[125X [27XDimension( A );[127X[104X
    [4X[28X0[128X[104X
  [4X[32X[104X
  
  
  [1X62.6 [33X[0;0YSubalgebras[133X[101X
  
  [1X62.6-1 Subalgebra[101X
  
  [29X[2XSubalgebra[102X( [3XA[103X, [3Xgens[103X[, [3X"basis"[103X] ) [32X function
  
  [33X[0;0Yis  the  [22XF[122X-algebra  generated by [3Xgens[103X, with parent algebra [3XA[103X, where [22XF[122X is the
  left acting domain of [3XA[103X.[133X
  
  [33X[0;0Y[13XNote[113X that being a subalgebra of [3XA[103X means to be an algebra, to be contained in
  [3XA[103X, [13Xand[113X to have the same left acting domain as [3XA[103X.[133X
  
  [33X[0;0YAn optional argument [10X"basis"[110X may be added if it is known that the generators
  already  form  a  basis  of the algebra. Then it is [13Xnot[113X checked whether [3Xgens[103X
  really are linearly independent and whether all elements in [3Xgens[103X lie in [3XA[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= Algebra( Rationals, [ m ] );[127X[104X
    [4X[28X<algebra over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XB:= Subalgebra( A, [ m^2 ] );[127X[104X
    [4X[28X<algebra over Rationals, with 1 generators>[128X[104X
  [4X[32X[104X
  
  [1X62.6-2 SubalgebraNC[101X
  
  [29X[2XSubalgebraNC[102X( [3XA[103X, [3Xgens[103X[, [3X"basis"[103X] ) [32X function
  
  [33X[0;0Y[2XSubalgebraNC[102X  does  the same as [2XSubalgebra[102X ([14X62.6-1[114X), except that it does not
  check whether all elements in [3Xgens[103X lie in [3XA[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= RandomMat( 3, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XA:= Algebra( Rationals, [ m ] );[127X[104X
    [4X[28X<algebra over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XSubalgebraNC( A, [ IdentityMat( 3, 3 ) ], "basis" );[127X[104X
    [4X[28X<algebra of dimension 1 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.6-3 SubalgebraWithOne[101X
  
  [29X[2XSubalgebraWithOne[102X( [3XA[103X, [3Xgens[103X[, [3X"basis"[103X] ) [32X function
  
  [33X[0;0Yis the algebra-with-one generated by [3Xgens[103X, with parent algebra [3XA[103X.[133X
  
  [33X[0;0YThe optional third argument, the string [10X"basis"[110X, may be added if it is known
  that the elements from [3Xgens[103X are linearly independent. Then it is [13Xnot[113X checked
  whether  [3Xgens[103X  really  are  linearly independent and whether all elements in
  [3Xgens[103X lie in [3XA[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraWithOne( Rationals, [ m ] );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XB1:= SubalgebraWithOne( A, [ m ] );;[127X[104X
    [4X[25Xgap>[125X [27XB2:= Subalgebra( A, [ m ] );;[127X[104X
    [4X[25Xgap>[125X [27XDimension( B1 );[127X[104X
    [4X[28X3[128X[104X
    [4X[25Xgap>[125X [27XDimension( B2 );[127X[104X
    [4X[28X2[128X[104X
  [4X[32X[104X
  
  [1X62.6-4 SubalgebraWithOneNC[101X
  
  [29X[2XSubalgebraWithOneNC[102X( [3XA[103X, [3Xgens[103X[, [3X"basis"[103X] ) [32X function
  
  [33X[0;0Y[2XSubalgebraWithOneNC[102X does the same as [2XSubalgebraWithOne[102X ([14X62.6-3[114X), except that
  it does not check whether all elements in [3Xgens[103X lie in [3XA[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= RandomMat( 3, 3 );; A:= Algebra( Rationals, [ m ] );;[127X[104X
    [4X[25Xgap>[125X [27XSubalgebraWithOneNC( A, [ m ] );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 1 generators>[128X[104X
  [4X[32X[104X
  
  [1X62.6-5 TrivialSubalgebra[101X
  
  [29X[2XTrivialSubalgebra[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0YThe zero dimensional subalgebra of the algebra [3XA[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27XB:= TrivialSubalgebra( A );[127X[104X
    [4X[28X<algebra over Rationals>[128X[104X
    [4X[25Xgap>[125X [27XDimension( B );[127X[104X
    [4X[28X0[128X[104X
  [4X[32X[104X
  
  
  [1X62.7 [33X[0;0YIdeals of Algebras[133X[101X
  
  [33X[0;0YFor  constructing and working with ideals in algebras the same functions are
  available  as  for  ideals in rings. So for the precise description of these
  functions  we  refer  to Chapter [14X56[114X. Here we give examples demonstrating the
  use  of  ideals  in  algebras.  For an introduction into the construction of
  quotient  algebras  we  refer  to Chapter [14X'Tutorial: Algebras'[114X of the user's
  tutorial.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= [ [ 0, 2, 3 ], [ 0, 0, 4 ], [ 0, 0, 0] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraWithOne( Rationals, [ m ] );;[127X[104X
    [4X[25Xgap>[125X [27XI:= Ideal( A, [ m ] );  # the two-sided ideal of `A' generated by `m'[127X[104X
    [4X[28X<two-sided ideal in <algebra-with-one of dimension 3 over Rationals>, [128X[104X
    [4X[28X  (1 generators)>[128X[104X
    [4X[25Xgap>[125X [27XDimension( I );[127X[104X
    [4X[28X2[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfIdeal( I );[127X[104X
    [4X[28X[ [ [ 0, 2, 3 ], [ 0, 0, 4 ], [ 0, 0, 0 ] ] ][128X[104X
    [4X[25Xgap>[125X [27XBasisVectors( Basis( I ) );[127X[104X
    [4X[28X[ [ [ 0, 1, 3/2 ], [ 0, 0, 2 ], [ 0, 0, 0 ] ], [128X[104X
    [4X[28X  [ [ 0, 0, 1 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ] ][128X[104X
    [4X[25Xgap>[125X [27XA:= FullMatrixAlgebra( Rationals, 4 );;[127X[104X
    [4X[25Xgap>[125X [27Xm:= NullMat( 4, 4 );; m[1][4]:=1;;[127X[104X
    [4X[25Xgap>[125X [27XI:= LeftIdeal( A, [ m ] );[127X[104X
    [4X[28X<left ideal in ( Rationals^[ 4, 4 ] ), (1 generators)>[128X[104X
    [4X[25Xgap>[125X [27XDimension( I );[127X[104X
    [4X[28X4[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfLeftIdeal( I );[127X[104X
    [4X[28X[ [ [ 0, 0, 0, 1 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ] ] ][128X[104X
    [4X[25Xgap>[125X [27Xmats:= [ [[1,0],[0,0]], [[0,1],[0,0]], [[0,0],[0,1]] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= Algebra( Rationals, mats );;[127X[104X
    [4X[25Xgap>[125X [27X# Form the two-sided ideal for which `mats[2]' is known to be[127X[104X
    [4X[25Xgap>[125X [27X# the unique basis element.[127X[104X
    [4X[25Xgap>[125X [27XI:= Ideal( A, [ mats[2] ], "basis" );[127X[104X
    [4X[28X<two-sided ideal in <algebra of dimension 3 over Rationals>, [128X[104X
    [4X[28X  (dimension 1)>[128X[104X
  [4X[32X[104X
  
  
  [1X62.8 [33X[0;0YCategories and Properties of Algebras[133X[101X
  
  [1X62.8-1 IsFLMLOR[101X
  
  [29X[2XIsFLMLOR[102X( [3Xobj[103X ) [32X Category
  
  [33X[0;0YA FLMLOR ([21Xfree left module left operator ring[121X) in [5XGAP[105X is a ring that is also
  a free left module.[133X
  
  [33X[0;0YNote  that  this means that being a FLMLOR is not a property a ring can get,
  since a ring is usually not represented as an external left set.[133X
  
  [33X[0;0YExamples are magma rings (e.g. over the integers) or algebras.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FullMatrixAlgebra( Rationals, 2 );;[127X[104X
    [4X[25Xgap>[125X [27XIsFLMLOR ( A );[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X62.8-2 IsFLMLORWithOne[101X
  
  [29X[2XIsFLMLORWithOne[102X( [3Xobj[103X ) [32X Category
  
  [33X[0;0YA FLMLOR-with-one in [5XGAP[105X is a ring-with-one that is also a free left module.[133X
  
  [33X[0;0YNote  that  this  means  that  being  a  FLMLOR-with-one is not a property a
  ring-with-one  can  get, since a ring-with-one is usually not represented as
  an external left set.[133X
  
  [33X[0;0YExamples  are  magma  rings-with-one or algebras-with-one (but also over the
  integers).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FullMatrixAlgebra( Rationals, 2 );;[127X[104X
    [4X[25Xgap>[125X [27XIsFLMLORWithOne ( A );[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X62.8-3 IsAlgebra[101X
  
  [29X[2XIsAlgebra[102X( [3Xobj[103X ) [32X Category
  
  [33X[0;0YAn algebra in [5XGAP[105X is a ring that is also a left vector space. Note that this
  means  that  being an algebra is not a property a ring can get, since a ring
  is usually not represented as an external left set.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= MatAlgebra( Rationals, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XIsAlgebra( A );[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X62.8-4 IsAlgebraWithOne[101X
  
  [29X[2XIsAlgebraWithOne[102X( [3Xobj[103X ) [32X Category
  
  [33X[0;0YAn  algebra-with-one  in  [5XGAP[105X  is a ring-with-one that is also a left vector
  space. Note that this means that being an algebra-with-one is not a property
  a ring-with-one can get, since a ring-with-one is usually not represented as
  an external left set.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= MatAlgebra( Rationals, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XIsAlgebraWithOne( A );[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X62.8-5 IsLieAlgebra[101X
  
  [29X[2XIsLieAlgebra[102X( [3XA[103X ) [32X property
  
  [33X[0;0YAn algebra [3XA[103X is called Lie algebra if [22Xa * a = 0[122X for all [22Xa[122X in [3XA[103X and [22X( a * ( b
  *  c  )  )  +  (  b * ( c * a ) ) + ( c * ( a * b ) ) = 0[122X for all [22Xa, b, c ∈[122X[3XA[103X
  (Jacobi identity).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FullMatrixLieAlgebra( Rationals, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XIsLieAlgebra( A );[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X62.8-6 IsSimpleAlgebra[101X
  
  [29X[2XIsSimpleAlgebra[102X( [3XA[103X ) [32X property
  
  [33X[0;0Yis  [9Xtrue[109X  if  the algebra [3XA[103X is simple, and [9Xfalse[109X otherwise. This function is
  only  implemented  for the cases where [3XA[103X is an associative or a Lie algebra.
  And  for  Lie  algebras it is only implemented for the case where the ground
  field is of characteristic zero.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FullMatrixLieAlgebra( Rationals, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XIsSimpleAlgebra( A );[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XA:= MatAlgebra( Rationals, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XIsSimpleAlgebra( A );[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X62.8-7 IsFiniteDimensional[101X
  
  [29X[2XIsFiniteDimensional[102X( [3Xmatalg[103X ) [32X method
  
  [33X[0;0Yreturns [9Xtrue[109X (always) for a matrix algebra [3Xmatalg[103X, since matrix algebras are
  always finite dimensional.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= MatAlgebra( Rationals, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XIsFiniteDimensional( A );[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X62.8-8 IsQuaternion[101X
  
  [29X[2XIsQuaternion[102X( [3Xobj[103X ) [32X Category
  [29X[2XIsQuaternionCollection[102X( [3Xobj[103X ) [32X Category
  [29X[2XIsQuaternionCollColl[102X( [3Xobj[103X ) [32X Category
  
  [33X[0;0Y[2XIsQuaternion[102X  is  the  category  of  elements  in  an algebra constructed by
  [2XQuaternionAlgebra[102X ([14X62.5-1[114X). A collection of quaternions lies in the category
  [2XIsQuaternionCollection[102X.  Finally,  a  collection  of  quaternion collections
  (e.g., a matrix of quaternions) lies in the category [2XIsQuaternionCollColl[102X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27Xb:= BasisVectors( Basis( A ) );[127X[104X
    [4X[28X[ e, i, j, k ][128X[104X
    [4X[25Xgap>[125X [27XIsQuaternion( b[1] );[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsQuaternionCollColl( [ [ b[1], b[2] ], [ b[3], b[4] ] ] );[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  
  [1X62.9 [33X[0;0YAttributes and Operations for Algebras[133X[101X
  
  [1X62.9-1 GeneratorsOfAlgebra[101X
  
  [29X[2XGeneratorsOfAlgebra[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0Yreturns a list of elements that generate [3XA[103X as an algebra.[133X
  
  [33X[0;0YFor a free algebra, each generator can also be accessed using the [10X.[110X operator
  (see [2XGeneratorsOfDomain[102X ([14X31.9-2[114X)).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraWithOne( Rationals, [ m ] );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfAlgebra( A );[127X[104X
    [4X[28X[ [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ], [128X[104X
    [4X[28X  [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ] ][128X[104X
  [4X[32X[104X
  
  [1X62.9-2 GeneratorsOfAlgebraWithOne[101X
  
  [29X[2XGeneratorsOfAlgebraWithOne[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0Yreturns a list of elements of [3XA[103X that generate [3XA[103X as an algebra with one.[133X
  
  [33X[0;0YFor a free algebra with one, each generator can also be accessed using the [10X.[110X
  operator (see [2XGeneratorsOfDomain[102X ([14X31.9-2[114X)).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraWithOne( Rationals, [ m ] );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfAlgebraWithOne( A );[127X[104X
    [4X[28X[ [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ] ][128X[104X
  [4X[32X[104X
  
  [1X62.9-3 ProductSpace[101X
  
  [29X[2XProductSpace[102X( [3XU[103X, [3XV[103X ) [32X operation
  
  [33X[0;0Yis the vector space [22X⟨ u * v ; u ∈ U, v ∈ V ⟩[122X, where [22XU[122X and [22XV[122X are subspaces of
  the same algebra.[133X
  
  [33X[0;0YIf  [22X[3XU[103X  =  [3XV[103X[122X  is  known  to  be  an algebra then the product space is also an
  algebra,  moreover it is an ideal in [3XU[103X. If [3XU[103X and [3XV[103X are known to be ideals in
  an  algebra  [22XA[122X then the product space is known to be an algebra and an ideal
  in [22XA[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27Xb:= BasisVectors( Basis( A ) );;[127X[104X
    [4X[25Xgap>[125X [27XB:= Subalgebra( A, [ b[4] ] );[127X[104X
    [4X[28X<algebra over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XProductSpace( A, B );[127X[104X
    [4X[28X<vector space of dimension 4 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.9-4 PowerSubalgebraSeries[101X
  
  [29X[2XPowerSubalgebraSeries[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0Yreturns  a list of subalgebras of [3XA[103X, the first term of which is [3XA[103X; and every
  next term is the product space of the previous term with itself.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );[127X[104X
    [4X[28X<algebra-with-one of dimension 4 over Rationals>[128X[104X
    [4X[25Xgap>[125X [27XPowerSubalgebraSeries( A );[127X[104X
    [4X[28X[ <algebra-with-one of dimension 4 over Rationals> ][128X[104X
  [4X[32X[104X
  
  [1X62.9-5 AdjointBasis[101X
  
  [29X[2XAdjointBasis[102X( [3XB[103X ) [32X attribute
  
  [33X[0;0YThe  [13Xadjoint  map[113X  [22Xad(x)[122X of an element [22Xx[122X in an [22XF[122X-algebra [22XA[122X, say, is the left
  multiplication  by  [22Xx[122X. This map is [22XF[122X-linear and thus, w.r.t. the given basis
  [3XB[103X[22X=  (x_1,  x_2, ..., x_n)[122X of [22XA[122X, [22Xad(x)[122X can be represented by a matrix over [22XF[122X.
  Let  [22XV[122X denote the [22XF[122X-vector space of the matrices corresponding to [22Xad(x)[122X, for
  [22Xx  ∈  A[122X.  Then  [2XAdjointBasis[102X  returns  the  basis  of [22XV[122X that consists of the
  matrices for [22Xad(x_1), ..., ad(x_n)[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27XAdjointBasis( Basis( A ) );[127X[104X
    [4X[28XBasis( <vector space over Rationals, with 4 generators>, [128X[104X
    [4X[28X[ [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ], [128X[104X
    [4X[28X  [ [ 0, -1, 0, 0 ], [ 1, 0, 0, 0 ], [ 0, 0, 0, -1 ], [ 0, 0, 1, 0 ] ][128X[104X
    [4X[28X    , [128X[104X
    [4X[28X  [ [ 0, 0, -1, 0 ], [ 0, 0, 0, 1 ], [ 1, 0, 0, 0 ], [ 0, -1, 0, 0 ] ][128X[104X
    [4X[28X    , [128X[104X
    [4X[28X  [ [ 0, 0, 0, -1 ], [ 0, 0, -1, 0 ], [ 0, 1, 0, 0 ], [ 1, 0, 0, 0 ] [128X[104X
    [4X[28X     ] ] )[128X[104X
  [4X[32X[104X
  
  [1X62.9-6 IndicesOfAdjointBasis[101X
  
  [29X[2XIndicesOfAdjointBasis[102X( [3XB[103X ) [32X attribute
  
  [33X[0;0YLet  [3XA[103X  be an algebra and let [3XB[103X be the basis that is output by [10XAdjointBasis(
  Basis(  [3XA[103X[10X  )  )[110X.  This  function returns a list of indices. If [22Xi[122X is an index
  belonging  to  this  list, then [22Xad x_i[122X is a basis vector of the matrix space
  spanned by [22Xad A[122X, where [22Xx_i[122X is the [22Xi[122X-th basis vector of the basis [3XB[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XL:= FullMatrixLieAlgebra( Rationals, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XB:= AdjointBasis( Basis( L ) );;[127X[104X
    [4X[25Xgap>[125X [27XIndicesOfAdjointBasis( B );[127X[104X
    [4X[28X[ 1, 2, 3, 4, 5, 6, 7, 8 ][128X[104X
  [4X[32X[104X
  
  [1X62.9-7 AsAlgebra[101X
  
  [29X[2XAsAlgebra[102X( [3XF[103X, [3XA[103X ) [32X operation
  
  [33X[0;0YReturns the algebra over [3XF[103X generated by [3XA[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XV:= VectorSpace( Rationals, [ IdentityMat( 2 ) ] );;[127X[104X
    [4X[25Xgap>[125X [27XAsAlgebra( Rationals, V );[127X[104X
    [4X[28X<algebra of dimension 1 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.9-8 AsAlgebraWithOne[101X
  
  [29X[2XAsAlgebraWithOne[102X( [3XF[103X, [3XA[103X ) [32X operation
  
  [33X[0;0YIf  the  algebra [3XA[103X has an identity, then it can be viewed as an algebra with
  one over [3XF[103X. This function returns this algebra with one.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XV:= VectorSpace( Rationals, [ IdentityMat( 2 ) ] );;[127X[104X
    [4X[25Xgap>[125X [27XA:= AsAlgebra( Rationals, V );;[127X[104X
    [4X[25Xgap>[125X [27XAsAlgebraWithOne( Rationals, A );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 1 generators>[128X[104X
  [4X[32X[104X
  
  [1X62.9-9 AsSubalgebra[101X
  
  [29X[2XAsSubalgebra[102X( [3XA[103X, [3XB[103X ) [32X operation
  
  [33X[0;0YIf  all  elements  of the algebra [3XB[103X happen to be contained in the algebra [3XA[103X,
  then  [3XB[103X  can  be  viewed  as  a  subalgebra of [3XA[103X. This function returns this
  subalgebra.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FullMatrixAlgebra( Rationals, 2 );;[127X[104X
    [4X[25Xgap>[125X [27XV:= VectorSpace( Rationals, [ IdentityMat( 2 ) ] );;[127X[104X
    [4X[25Xgap>[125X [27XB:= AsAlgebra( Rationals, V );;[127X[104X
    [4X[25Xgap>[125X [27XBA:= AsSubalgebra( A, B );[127X[104X
    [4X[28X<algebra of dimension 1 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.9-10 AsSubalgebraWithOne[101X
  
  [29X[2XAsSubalgebraWithOne[102X( [3XA[103X, [3XB[103X ) [32X operation
  
  [33X[0;0YIf [3XB[103X is an algebra with one, all elements of which happen to be contained in
  the  algebra with one [3XA[103X, then [3XB[103X can be viewed as a subalgebra with one of [3XA[103X.
  This function returns this subalgebra with one.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FullMatrixAlgebra( Rationals, 2 );;[127X[104X
    [4X[25Xgap>[125X [27XV:= VectorSpace( Rationals, [ IdentityMat( 2 ) ] );;[127X[104X
    [4X[25Xgap>[125X [27XB:= AsAlgebra( Rationals, V );;[127X[104X
    [4X[25Xgap>[125X [27XC:= AsAlgebraWithOne( Rationals, B );;[127X[104X
    [4X[25Xgap>[125X [27XAC:= AsSubalgebraWithOne( A, C );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 1 generators>[128X[104X
  [4X[32X[104X
  
  [1X62.9-11 MutableBasisOfClosureUnderAction[101X
  
  [29X[2XMutableBasisOfClosureUnderAction[102X( [3XF[103X, [3XAgens[103X, [3Xfrom[103X, [3Xinit[103X, [3Xopr[103X, [3Xzero[103X, [3Xmaxdim[103X ) [32X function
  
  [33X[0;0YLet [3XF[103X be a ring, [3XAgens[103X a list of generators for an [3XF[103X-algebra [22XA[122X, and [3Xfrom[103X one
  of  [10X"left"[110X,  [10X"right"[110X,  [10X"both"[110X;  this  means  that  elements  of  [22XA[122X  act  via
  multiplication  from  the respective side(s). [3Xinit[103X must be a list of initial
  generating vectors, and [3Xopr[103X the operation (a function of two arguments).[133X
  
  [33X[0;0Y[2XMutableBasisOfClosureUnderAction[102X  returns a mutable basis of the [3XF[103X-free left
  module generated by the vectors in [3Xinit[103X and their images under the action of
  [3XAgens[103X from the respective side(s).[133X
  
  [33X[0;0Y[3Xzero[103X is the zero element of the desired module. [3Xmaxdim[103X is an upper bound for
  the dimension of the closure; if no such upper bound is known then the value
  of [3Xmaxdim[103X must be [2Xinfinity[102X ([14X18.2-1[114X).[133X
  
  [33X[0;0Y[2XMutableBasisOfClosureUnderAction[102X  can  be  used  to  compute  a  basis of an
  [13Xassociative[113X  algebra  generated  by the elements in [3XAgens[103X. In this case [3Xfrom[103X
  may  be  [10X"left"[110X  or [10X"right"[110X, [3Xopr[103X is the multiplication [10X*[110X, and [3Xinit[103X is a list
  containing  either  the  identity  of  the  algebra  or  a  list  of algebra
  generators.  (Note that if the algebra has an identity then it is in general
  not  sufficient  to  take  algebra-with-one  generators  as [3Xinit[103X, whereas of
  course [3XAgens[103X need not contain the identity.)[133X
  
  [33X[0;0Y(Note  that  bases  of  [13Xnot[113X necessarily associative algebras can be computed
  using [2XMutableBasisOfNonassociativeAlgebra[102X ([14X62.9-12[114X).)[133X
  
  [33X[0;0YOther  applications of [2XMutableBasisOfClosureUnderAction[102X are the computations
  of  bases  for (left/ right/ two-sided) ideals [22XI[122X in an [13Xassociative[113X algebra [22XA[122X
  from  ideal  generators  of  [22XI[122X;  in  these  cases [3XAgens[103X is a list of algebra
  generators  of  [22XA[122X,  [3Xfrom[103X  denotes the appropriate side(s), [3Xinit[103X is a list of
  ideal generators of [22XI[122X, and [3Xopr[103X is again [10X*[110X.[133X
  
  [33X[0;0Y(Note  that  bases  of ideals in [13Xnot[113X necessarily associative algebras can be
  computed using [2XMutableBasisOfIdealInNonassociativeAlgebra[102X ([14X62.9-13[114X).)[133X
  
  [33X[0;0YFinally,   bases   of   right   [22XA[122X-modules   also   can   be  computed  using
  [2XMutableBasisOfClosureUnderAction[102X.  The  only difference to the ideal case is
  that [3Xinit[103X is now a list of right module generators, and [3Xopr[103X is the operation
  of the module.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27Xg:= GeneratorsOfAlgebra( A );;[127X[104X
    [4X[25Xgap>[125X [27XB:= MutableBasisOfClosureUnderAction( Rationals, [127X[104X
    [4X[25X>[125X [27X                               g, "left", [ g[1] ], \*, Zero(A), 4 );[127X[104X
    [4X[28X<mutable basis over Rationals, 4 vectors>[128X[104X
    [4X[25Xgap>[125X [27XBasisVectors( B );[127X[104X
    [4X[28X[ e, i, j, k ][128X[104X
  [4X[32X[104X
  
  [1X62.9-12 MutableBasisOfNonassociativeAlgebra[101X
  
  [29X[2XMutableBasisOfNonassociativeAlgebra[102X( [3XF[103X, [3XAgens[103X, [3Xzero[103X, [3Xmaxdim[103X ) [32X function
  
  [33X[0;0Yis  a  mutable  basis of the (not necessarily associative) [3XF[103X-algebra that is
  generated by [3XAgens[103X, has zero element [3Xzero[103X, and has dimension at most [3Xmaxdim[103X.
  If no finite bound for the dimension is known then [2Xinfinity[102X ([14X18.2-1[114X) must be
  the value of [3Xmaxdim[103X.[133X
  
  [33X[0;0YThe  difference  to  [2XMutableBasisOfClosureUnderAction[102X  ([14X62.9-11[114X)  is that in
  general  it is not sufficient to multiply just with algebra generators. (For
  special  cases  of  nonassociative  algebras,  especially  for Lie algebras,
  multiplying with algebra generators suffices.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XL:= FullMatrixLieAlgebra( Rationals, 4 );;[127X[104X
    [4X[25Xgap>[125X [27Xm1:= Random( L );;[127X[104X
    [4X[25Xgap>[125X [27Xm2:= Random( L );;[127X[104X
    [4X[25Xgap>[125X [27XMutableBasisOfNonassociativeAlgebra( Rationals, [ m1, m2 ], [127X[104X
    [4X[25X>[125X [27XZero( L ), 16 );[127X[104X
    [4X[28X<mutable basis over Rationals, 16 vectors>[128X[104X
  [4X[32X[104X
  
  [1X62.9-13 MutableBasisOfIdealInNonassociativeAlgebra[101X
  
  [29X[2XMutableBasisOfIdealInNonassociativeAlgebra[102X( [3XF[103X, [3XVgens[103X, [3XIgens[103X, [3Xzero[103X, [3Xfrom[103X, [3Xmaxdim[103X ) [32X function
  
  [33X[0;0Yis  a  mutable basis of the ideal generated by [3XIgens[103X under the action of the
  (not  necessarily associative) [3XF[103X-algebra with vector space generators [3XVgens[103X.
  The  zero  element  of  the  ideal  is [3Xzero[103X, [3Xfrom[103X is one of [10X"left"[110X, [10X"right"[110X,
  [10X"both"[110X   (with  the  same  meaning  as  in  [2XMutableBasisOfClosureUnderAction[102X
  ([14X62.9-11[114X)), and [3Xmaxdim[103X is a known upper bound on the dimension of the ideal;
  if no finite bound for the dimension is known then [2Xinfinity[102X ([14X18.2-1[114X) must be
  the value of [3Xmaxdim[103X.[133X
  
  [33X[0;0YThe  difference  to  [2XMutableBasisOfClosureUnderAction[102X  ([14X62.9-11[114X)  is that in
  general  it is not sufficient to multiply just with algebra generators. (For
  special  cases  of  nonassociative  algebras,  especially  for Lie algebras,
  multiplying with algebra generators suffices.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xmats:= [  [[ 1, 0 ], [ 0, -1 ]], [[0,1],[0,0]] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= Algebra( Rationals, mats );;[127X[104X
    [4X[25Xgap>[125X [27XbasA:= BasisVectors( Basis( A ) );;[127X[104X
    [4X[25Xgap>[125X [27XB:= MutableBasisOfIdealInNonassociativeAlgebra( Rationals, basA,[127X[104X
    [4X[25X>[125X [27X[ mats[2] ], 0*mats[1], "both", infinity );[127X[104X
    [4X[28X<mutable basis over Rationals, 1 vectors>[128X[104X
    [4X[25Xgap>[125X [27XBasisVectors( B );[127X[104X
    [4X[28X[ [ [ 0, 1 ], [ 0, 0 ] ] ][128X[104X
  [4X[32X[104X
  
  [1X62.9-14 DirectSumOfAlgebras[101X
  
  [29X[2XDirectSumOfAlgebras[102X( [3XA1[103X, [3XA2[103X ) [32X operation
  [29X[2XDirectSumOfAlgebras[102X( [3Xlist[103X ) [32X operation
  
  [33X[0;0Yis the direct sum of the two algebras [3XA1[103X and [3XA2[103X respectively of the algebras
  in the list [3Xlist[103X.[133X
  
  [33X[0;0YIf  all  involved  algebras are associative algebras then the result is also
  known  to be associative. If all involved algebras are Lie algebras then the
  result is also known to be a Lie algebra.[133X
  
  [33X[0;0YAll involved algebras must have the same left acting domain.[133X
  
  [33X[0;0YThe default case is that the result is a structure constants algebra. If all
  involved  algebras  are matrix algebras, and either both are Lie algebras or
  both  are  associative  then  the  result  is  again a matrix algebra of the
  appropriate type.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27XDirectSumOfAlgebras( [A, A, A] );[127X[104X
    [4X[28X<algebra of dimension 12 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.9-15 FullMatrixAlgebraCentralizer[101X
  
  [29X[2XFullMatrixAlgebraCentralizer[102X( [3XF[103X, [3Xlst[103X ) [32X function
  
  [33X[0;0YLet  [3Xlst[103X be a nonempty list of square matrices of the same dimension [22Xn[122X, say,
  with  entries  in  the  field  [3XF[103X.  [2XFullMatrixAlgebraCentralizer[102X  returns the
  (pointwise)  centralizer  of  all  matrices  in  [3Xlst[103X, inside the full matrix
  algebra of [22Xn × n[122X matrices over [3XF[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27Xb:= Basis( A );;[127X[104X
    [4X[25Xgap>[125X [27Xmats:= List( BasisVectors( b ), x -> AdjointMatrix( b, x ) );;[127X[104X
    [4X[25Xgap>[125X [27XFullMatrixAlgebraCentralizer( Rationals, mats );[127X[104X
    [4X[28X<algebra-with-one of dimension 4 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.9-16 RadicalOfAlgebra[101X
  
  [29X[2XRadicalOfAlgebra[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0Yis the maximal nilpotent ideal of [3XA[103X, where [3XA[103X is an associative algebra.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraWithOneByGenerators( Rationals, [ m ] );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XRadicalOfAlgebra( A );[127X[104X
    [4X[28X<algebra of dimension 2 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.9-17 CentralIdempotentsOfAlgebra[101X
  
  [29X[2XCentralIdempotentsOfAlgebra[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0YFor  an  associative  algebra  [3XA[103X,  this  function  returns a list of central
  primitive  idempotents  such  that  their  sum is the identity element of [3XA[103X.
  Therefore [3XA[103X is required to have an identity.[133X
  
  [33X[0;0Y(This is a synonym of [10XCentralIdempotentsOfSemiring[110X.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27XB:= DirectSumOfAlgebras( [A, A, A] );[127X[104X
    [4X[28X<algebra of dimension 12 over Rationals>[128X[104X
    [4X[25Xgap>[125X [27XCentralIdempotentsOfAlgebra( B );[127X[104X
    [4X[28X[ v.9, v.5, v.1 ][128X[104X
  [4X[32X[104X
  
  [1X62.9-18 DirectSumDecomposition[101X
  
  [29X[2XDirectSumDecomposition[102X( [3XL[103X ) [32X attribute
  
  [33X[0;0YThis  function  calculates  a list of ideals of the algebra [3XL[103X such that [3XL[103X is
  equal to their direct sum. Currently this is only implemented for semisimple
  associative algebras, and for Lie algebras (semisimple or not).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG:= SymmetricGroup( 4 );;[127X[104X
    [4X[25Xgap>[125X [27XA:= GroupRing( Rationals, G );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xdd:= DirectSumDecomposition( A );[127X[104X
    [4X[28X[ <two-sided ideal in [128X[104X
    [4X[28X      <algebra-with-one of dimension 24 over Rationals>, [128X[104X
    [4X[28X      (1 generators)>, [128X[104X
    [4X[28X  <two-sided ideal in [128X[104X
    [4X[28X      <algebra-with-one of dimension 24 over Rationals>, [128X[104X
    [4X[28X      (1 generators)>, [128X[104X
    [4X[28X  <two-sided ideal in [128X[104X
    [4X[28X      <algebra-with-one of dimension 24 over Rationals>, [128X[104X
    [4X[28X      (1 generators)>, [128X[104X
    [4X[28X  <two-sided ideal in [128X[104X
    [4X[28X      <algebra-with-one of dimension 24 over Rationals>, [128X[104X
    [4X[28X      (1 generators)>, [128X[104X
    [4X[28X  <two-sided ideal in [128X[104X
    [4X[28X      <algebra-with-one of dimension 24 over Rationals>, [128X[104X
    [4X[28X      (1 generators)> ][128X[104X
    [4X[25Xgap>[125X [27XList( dd, Dimension );[127X[104X
    [4X[28X[ 1, 1, 4, 9, 9 ][128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XL:= FullMatrixLieAlgebra( Rationals, 5 );;[127X[104X
    [4X[25Xgap>[125X [27XDirectSumDecomposition( L );[127X[104X
    [4X[28X[ <two-sided ideal in [128X[104X
    [4X[28X      <two-sided ideal in <Lie algebra of dimension 25 over Rationals>[128X[104X
    [4X[28X            , (dimension 1)>, (dimension 1)>, [128X[104X
    [4X[28X  <two-sided ideal in [128X[104X
    [4X[28X      <two-sided ideal in <Lie algebra of dimension 25 over Rationals>[128X[104X
    [4X[28X            , (dimension 24)>, (dimension 24)> ][128X[104X
  [4X[32X[104X
  
  [1X62.9-19 LeviMalcevDecomposition[101X
  
  [29X[2XLeviMalcevDecomposition[102X( [3XL[103X ) [32X attribute
  
  [33X[0;0YA  Levi-Malcev  subalgebra  of  the  algebra  [3XL[103X  is  a semisimple subalgebra
  complementary  to  the  radical  of [3XL[103X. This function returns a list with two
  components.  The first component is a Levi-Malcev subalgebra, the second the
  radical. This function is implemented for associative and Lie algebras.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm:= [ [ 1, 2, 0 ], [ 0, 1, 3 ], [ 0, 0, 1] ];;[127X[104X
    [4X[25Xgap>[125X [27XA:= Algebra( Rationals, [ m ] );;[127X[104X
    [4X[25Xgap>[125X [27XLeviMalcevDecomposition( A );[127X[104X
    [4X[28X[ <algebra of dimension 1 over Rationals>, [128X[104X
    [4X[28X  <algebra of dimension 2 over Rationals> ][128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XL:= FullMatrixLieAlgebra( Rationals, 5 );;[127X[104X
    [4X[25Xgap>[125X [27XLeviMalcevDecomposition( L );[127X[104X
    [4X[28X[ <Lie algebra of dimension 24 over Rationals>, [128X[104X
    [4X[28X  <two-sided ideal in <Lie algebra of dimension 25 over Rationals>, [128X[104X
    [4X[28X      (dimension 1)> ][128X[104X
  [4X[32X[104X
  
  [1X62.9-20 Grading[101X
  
  [29X[2XGrading[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0YLet [22XG[122X be an Abelian group and [22XA[122X an algebra. Then [22XA[122X is said to be graded over
  [22XG[122X  if  for  every  [22Xg  ∈ G[122X there is a subspace [22XA_g[122X of [22XA[122X such that [22XA_g ⋅ A_h ⊂
  A_{g+h}[122X  for  [22Xg,  h  ∈  G[122X.  In  [5XGAP[105X 4  a  [13Xgrading[113X  of an algebra is a record
  containing the following components.[133X
  
  [8X[10Xsource[110X[108X
        [33X[0;6Ythe Abelian group over which the algebra is graded.[133X
  
  [8X[10Xhom_components[110X[108X
        [33X[0;6Ya function assigning to each element from the source a subspace of the
        algebra.[133X
  
  [8X[10Xmin_degree[110X[108X
        [33X[0;6Yin  the case where the algebra is graded over the integers this is the
        minimum number for which [10Xhom_components[110X returns a nonzero subspace.[133X
  
  [8X[10Xmax_degree[110X[108X
        [33X[0;6Yis analogous to [10Xmin_degree[110X.[133X
  
  [33X[0;0YWe  note  that  there  are  no  methods to compute a grading of an arbitrary
  algebra;  however  some  algebras  get  a  natural  grading  when  they  are
  constructed            (see           [2XJenningsLieAlgebra[102X           ([14X64.8-4[114X),
  [2XNilpotentQuotientOfFpLieAlgebra[102X ([14X64.11-2[114X)).[133X
  
  [33X[0;0YWe  note  also that these components may be not enough to handle the grading
  efficiently,  and  another record component may be needed. For instance in a
  Lie  algebra [22XL[122X constructed by [2XJenningsLieAlgebra[102X ([14X64.8-4[114X), the length of the
  of  the  range  [10X[  Grading(L)!.min_degree .. Grading(L)!.max_degree ][110X may be
  non-polynomial  in the dimension of [22XL[122X. To handle efficiently this situation,
  an optional component can be used:[133X
  
  [8X[10Xnon_zero_hom_components[110X[108X
        [33X[0;6Ythe  subset  of  [10Xsource[110X  for  which  [10Xhom_components[110X  returns a nonzero
        subspace.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG:= SmallGroup(3^6, 100 );[127X[104X
    [4X[28X<pc group of size 729 with 6 generators>[128X[104X
    [4X[25Xgap>[125X [27XL:= JenningsLieAlgebra( G );[127X[104X
    [4X[28X<Lie algebra of dimension 6 over GF(3)>[128X[104X
    [4X[25Xgap>[125X [27Xg:= Grading( L );[127X[104X
    [4X[28Xrec( hom_components := function( d ) ... end, max_degree := 9, [128X[104X
    [4X[28X  min_degree := 1, source := Integers )[128X[104X
    [4X[25Xgap>[125X [27Xg.hom_components( 3 );[127X[104X
    [4X[28X<vector space over GF(3), with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27Xg.hom_components( 14 );[127X[104X
    [4X[28X<vector space over GF(3), with 0 generators>[128X[104X
  [4X[32X[104X
  
  
  [1X62.10 [33X[0;0YHomomorphisms of Algebras[133X[101X
  
  [33X[0;0YAlgebra  homomorphisms  are  vector  space  homomorphisms  that preserve the
  multiplication.  So the default methods for vector space homomorphisms work,
  and  in  fact  there  is  not much use of the fact that source and range are
  algebras,  except that preimages and images are algebras (or even ideals) in
  certain cases.[133X
  
  [1X62.10-1 AlgebraGeneralMappingByImages[101X
  
  [29X[2XAlgebraGeneralMappingByImages[102X( [3XA[103X, [3XB[103X, [3Xgens[103X, [3Ximgs[103X ) [32X operation
  
  [33X[0;0Yis  a  general mapping from the [22XF[122X-algebra [3XA[103X to the [22XF[122X-algebra [3XB[103X. This general
  mapping  is  defined by mapping the entries in the list [3Xgens[103X (elements of [3XA[103X)
  to the entries in the list [3Ximgs[103X (elements of [3XB[103X), and taking the [22XF[122X-linear and
  multiplicative closure.[133X
  
  [33X[0;0Y[3Xgens[103X  need not generate [3XA[103X as an [22XF[122X-algebra, and if the specification does not
  define  a  linear  and  multiplicative  mapping  then  the  result  will  be
  multivalued.  Hence,  in  general  it  is  not a mapping. For constructing a
  linear   map   that   is   not   necessarily  multiplicative,  we  refer  to
  [2XLeftModuleHomomorphismByImages[102X ([14X61.10-2[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27XB:= FullMatrixAlgebra( Rationals, 2 );;[127X[104X
    [4X[25Xgap>[125X [27XbA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;[127X[104X
    [4X[25Xgap>[125X [27Xf:= AlgebraGeneralMappingByImages( A, B, bA, bB );[127X[104X
    [4X[28X[ e, i, j, k ] -> [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 1 ], [ 0, 0 ] ], [128X[104X
    [4X[28X  [ [ 0, 0 ], [ 1, 0 ] ], [ [ 0, 0 ], [ 0, 1 ] ] ][128X[104X
    [4X[25Xgap>[125X [27XImages( f, bA[1] );[127X[104X
    [4X[28X<add. coset of <algebra over Rationals, with 16 generators>>[128X[104X
  [4X[32X[104X
  
  [1X62.10-2 AlgebraHomomorphismByImages[101X
  
  [29X[2XAlgebraHomomorphismByImages[102X( [3XA[103X, [3XB[103X, [3Xgens[103X, [3Ximgs[103X ) [32X function
  
  [33X[0;0Y[2XAlgebraHomomorphismByImages[102X  returns  the algebra homomorphism with source [3XA[103X
  and  range  [3XB[103X that is defined by mapping the list [3Xgens[103X of generators of [3XA[103X to
  the list [3Ximgs[103X of images in [3XB[103X.[133X
  
  [33X[0;0YIf  [3Xgens[103X does not generate [3XA[103X or if the homomorphism does not exist (i.e., if
  mapping  the  generators describes only a multi-valued mapping) then [9Xfail[109X is
  returned.[133X
  
  [33X[0;0YOne can avoid the checks by calling [2XAlgebraHomomorphismByImagesNC[102X ([14X62.10-3[114X),
  and      one      can      construct      multi-valued     mappings     with
  [2XAlgebraGeneralMappingByImages[102X ([14X62.10-1[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 1, [1,1] ); SetEntrySCTable( T, 2, 2, [1,2] );[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraByStructureConstants( Rationals, T );;[127X[104X
    [4X[25Xgap>[125X [27Xm1:= NullMat( 2, 2 );; m1[1][1]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27Xm2:= NullMat( 2, 2 );; m2[2][2]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27XB:= AlgebraByGenerators( Rationals, [ m1, m2 ] );;[127X[104X
    [4X[25Xgap>[125X [27XbA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;[127X[104X
    [4X[25Xgap>[125X [27Xf:= AlgebraHomomorphismByImages( A, B, bA, bB );[127X[104X
    [4X[28X[ v.1, v.2 ] -> [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 0, 1 ] ] ][128X[104X
    [4X[25Xgap>[125X [27XImage( f, bA[1]+bA[2] );[127X[104X
    [4X[28X[ [ 1, 0 ], [ 0, 1 ] ][128X[104X
  [4X[32X[104X
  
  [1X62.10-3 AlgebraHomomorphismByImagesNC[101X
  
  [29X[2XAlgebraHomomorphismByImagesNC[102X( [3XA[103X, [3XB[103X, [3Xgens[103X, [3Ximgs[103X ) [32X operation
  
  [33X[0;0Y[2XAlgebraHomomorphismByImagesNC[102X  is  the  operation  that  is  called  by  the
  function  [2XAlgebraHomomorphismByImages[102X ([14X62.10-2[114X). Its methods may assume that
  [3Xgens[103X  generates  [3XA[103X  and  that the mapping of [3Xgens[103X to [3Ximgs[103X defines an algebra
  homomorphism. Results are unpredictable if these conditions do not hold.[133X
  
  [33X[0;0YFor  creating  a  possibly  multi-valued  mapping  from [3XA[103X to [3XB[103X that respects
  addition,       multiplication,       and       scalar       multiplication,
  [2XAlgebraGeneralMappingByImages[102X ([14X62.10-1[114X) can be used.[133X
  
  [33X[0;0YFor  the definitions of the algebras [10XA[110X and [10XB[110X in the next example we refer to
  the previous example.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xf:= AlgebraHomomorphismByImagesNC( A, B, bA, bB );[127X[104X
    [4X[28X[ v.1, v.2 ] -> [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 0, 1 ] ] ][128X[104X
  [4X[32X[104X
  
  [1X62.10-4 AlgebraWithOneGeneralMappingByImages[101X
  
  [29X[2XAlgebraWithOneGeneralMappingByImages[102X( [3XA[103X, [3XB[103X, [3Xgens[103X, [3Ximgs[103X ) [32X operation
  
  [33X[0;0YThis  function  is analogous to [2XAlgebraGeneralMappingByImages[102X ([14X62.10-1[114X); the
  only  difference being that the identity of [3XA[103X is automatically mapped to the
  identity of [3XB[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );;[127X[104X
    [4X[25Xgap>[125X [27XB:= FullMatrixAlgebra( Rationals, 2 );;[127X[104X
    [4X[25Xgap>[125X [27XbA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;[127X[104X
    [4X[25Xgap>[125X [27Xf:=AlgebraWithOneGeneralMappingByImages(A,B,bA{[2,3,4]},bB{[1,2,3]});[127X[104X
    [4X[28X[ i, j, k, e ] -> [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 1 ], [ 0, 0 ] ], [128X[104X
    [4X[28X  [ [ 0, 0 ], [ 1, 0 ] ], [ [ 1, 0 ], [ 0, 1 ] ] ][128X[104X
  [4X[32X[104X
  
  [1X62.10-5 AlgebraWithOneHomomorphismByImages[101X
  
  [29X[2XAlgebraWithOneHomomorphismByImages[102X( [3XA[103X, [3XB[103X, [3Xgens[103X, [3Ximgs[103X ) [32X function
  
  [33X[0;0Y[2XAlgebraWithOneHomomorphismByImages[102X returns the algebra-with-one homomorphism
  with  source  [3XA[103X  and  range  [3XB[103X  that  is defined by mapping the list [3Xgens[103X of
  generators of [3XA[103X to the list [3Ximgs[103X of images in [3XB[103X.[133X
  
  [33X[0;0YThe  difference  between  an  algebra  homomorphism  and an algebra-with-one
  homomorphism  is that in the latter case, it is assumed that the identity of
  [3XA[103X  is  mapped  to  the identity of [3XB[103X, and therefore [3Xgens[103X needs to generate [3XA[103X
  only as an algebra-with-one.[133X
  
  [33X[0;0YIf  [3Xgens[103X does not generate [3XA[103X or if the homomorphism does not exist (i.e., if
  mapping  the  generators describes only a multi-valued mapping) then [9Xfail[109X is
  returned.[133X
  
  [33X[0;0YOne  can  avoid  the  checks by calling [2XAlgebraWithOneHomomorphismByImagesNC[102X
  ([14X62.10-6[114X),    and    one    can   construct   multi-valued   mappings   with
  [2XAlgebraWithOneGeneralMappingByImages[102X ([14X62.10-4[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm1:= NullMat( 2, 2 );; m1[1][1]:=1;;[127X[104X
    [4X[25Xgap>[125X [27Xm2:= NullMat( 2, 2 );; m2[2][2]:=1;;[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraByGenerators( Rationals, [m1,m2] );;[127X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 1, [1,1] );[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 2, 2, [1,2] );[127X[104X
    [4X[25Xgap>[125X [27XB:= AlgebraByStructureConstants(Rationals, T);;[127X[104X
    [4X[25Xgap>[125X [27XbA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;[127X[104X
    [4X[25Xgap>[125X [27Xf:= AlgebraWithOneHomomorphismByImages( A, B, bA{[1]}, bB{[1]} );[127X[104X
    [4X[28X[ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 1, 0 ], [ 0, 1 ] ] ] -> [ v.1, v.1+v.2 ][128X[104X
  [4X[32X[104X
  
  [1X62.10-6 AlgebraWithOneHomomorphismByImagesNC[101X
  
  [29X[2XAlgebraWithOneHomomorphismByImagesNC[102X( [3XA[103X, [3XB[103X, [3Xgens[103X, [3Ximgs[103X ) [32X operation
  
  [33X[0;0Y[2XAlgebraWithOneHomomorphismByImagesNC[102X  is the operation that is called by the
  function   [2XAlgebraWithOneHomomorphismByImages[102X  ([14X62.10-5[114X).  Its  methods  may
  assume that [3Xgens[103X generates [3XA[103X and that the mapping of [3Xgens[103X to [3Ximgs[103X defines an
  algebra-with-one homomorphism. Results are unpredictable if these conditions
  do not hold.[133X
  
  [33X[0;0YFor  creating  a  possibly  multi-valued  mapping  from [3XA[103X to [3XB[103X that respects
  addition,    multiplication,    identity,    and    scalar   multiplication,
  [2XAlgebraWithOneGeneralMappingByImages[102X ([14X62.10-4[114X) can be used.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm1:= NullMat( 2, 2 );; m1[1][1]:=1;;[127X[104X
    [4X[25Xgap>[125X [27Xm2:= NullMat( 2, 2 );; m2[2][2]:=1;;[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraByGenerators( Rationals, [m1,m2] );;[127X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 1, [1,1] );[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 2, 2, [1,2] );[127X[104X
    [4X[25Xgap>[125X [27XB:= AlgebraByStructureConstants( Rationals, T);;[127X[104X
    [4X[25Xgap>[125X [27XbA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;[127X[104X
    [4X[25Xgap>[125X [27Xf:= AlgebraWithOneHomomorphismByImagesNC( A, B, bA{[1]}, bB{[1]} );[127X[104X
    [4X[28X[ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 1, 0 ], [ 0, 1 ] ] ] -> [ v.1, v.1+v.2 ][128X[104X
  [4X[32X[104X
  
  [1X62.10-7 NaturalHomomorphismByIdeal[101X
  
  [29X[2XNaturalHomomorphismByIdeal[102X( [3XA[103X, [3XI[103X ) [32X method
  
  [33X[0;0YFor   an   algebra   [3XA[103X   and   an   ideal  [3XI[103X  in  [3XA[103X,  the  return  value  of
  [2XNaturalHomomorphismByIdeal[102X  ([14X56.8-4[114X)  is  a  homomorphism  of  algebras,  in
  particular the range of this mapping is also an algebra.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XL:= FullMatrixLieAlgebra( Rationals, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XC:= LieCentre( L );[127X[104X
    [4X[28X<two-sided ideal in <Lie algebra of dimension 9 over Rationals>, [128X[104X
    [4X[28X  (dimension 1)>[128X[104X
    [4X[25Xgap>[125X [27Xhom:= NaturalHomomorphismByIdeal( L, C );[127X[104X
    [4X[28X<linear mapping by matrix, <Lie algebra of dimension [128X[104X
    [4X[28X9 over Rationals> -> <Lie algebra of dimension 8 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27XImagesSource( hom );[127X[104X
    [4X[28X<Lie algebra of dimension 8 over Rationals>[128X[104X
  [4X[32X[104X
  
  [1X62.10-8 OperationAlgebraHomomorphism[101X
  
  [29X[2XOperationAlgebraHomomorphism[102X( [3XA[103X, [3XB[103X[, [3Xopr[103X] ) [32X operation
  [29X[2XOperationAlgebraHomomorphism[102X( [3XA[103X, [3XV[103X[, [3Xopr[103X] ) [32X operation
  
  [33X[0;0Y[2XOperationAlgebraHomomorphism[102X   returns  an  algebra  homomorphism  from  the
  [22XF[122X-algebra  [3XA[103X into a matrix algebra over [22XF[122X that describes the [22XF[122X-linear action
  of  [3XA[103X  on  the  basis  [3XB[103X of a free left module respectively on the free left
  module [3XV[103X (in which case some basis of [3XV[103X is chosen), via the operation [3Xopr[103X.[133X
  
  [33X[0;0YThe  homomorphism  need  not  be  surjective.  The  default value for [3Xopr[103X is
  [2XOnRight[102X ([14X41.2-2[114X).[133X
  
  [33X[0;0YIf   [3XA[103X  is  an  algebra-with-one  then  the  operation  homomorphism  is  an
  algebra-with-one  homomorphism  because  the  identity  of [3XA[103X must act as the
  identity.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm1:= NullMat( 2, 2 );; m1[1][1]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27Xm2:= NullMat( 2, 2 );; m2[2][2]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27XB:= AlgebraByGenerators( Rationals, [ m1, m2 ] );;[127X[104X
    [4X[25Xgap>[125X [27XV:= FullRowSpace( Rationals, 2 );[127X[104X
    [4X[28X( Rationals^2 )[128X[104X
    [4X[25Xgap>[125X [27Xf:=OperationAlgebraHomomorphism( B, Basis( V ), OnRight );[127X[104X
    [4X[28X<op. hom. Algebra( Rationals, [128X[104X
    [4X[28X[ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 0, 1 ] ] [128X[104X
    [4X[28X ] ) -> matrices of dim. 2>[128X[104X
    [4X[25Xgap>[125X [27XImage( f, m1 );[127X[104X
    [4X[28X[ [ 1, 0 ], [ 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X62.10-9 NiceAlgebraMonomorphism[101X
  
  [29X[2XNiceAlgebraMonomorphism[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0YIf  [3XA[103X is an associative algebra with one, returns an isomorphism from [3XA[103X onto
  a  matrix  algebra (see [2XIsomorphismMatrixAlgebra[102X ([14X62.10-11[114X) for an example).
  If [3XA[103X is a finitely presented Lie algebra, returns an isomorphism from [3XA[103X onto
  a  Lie  algebra  defined  by  a  structure constants table (see [14X64.11[114X for an
  example).[133X
  
  [1X62.10-10 IsomorphismFpAlgebra[101X
  
  [29X[2XIsomorphismFpAlgebra[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0Yisomorphism  from the algebra [3XA[103X onto a finitely presented algebra. Currently
  this is only implemented for associative algebras with one.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= QuaternionAlgebra( Rationals );[127X[104X
    [4X[28X<algebra-with-one of dimension 4 over Rationals>[128X[104X
    [4X[25Xgap>[125X [27Xf:= IsomorphismFpAlgebra( A );[127X[104X
    [4X[28X[ e, i, j, k, e ] -> [ [(1)*x.1], [(1)*x.2], [(1)*x.3], [(1)*x.4], [128X[104X
    [4X[28X  [(1)*<identity ...>] ][128X[104X
  [4X[32X[104X
  
  [1X62.10-11 IsomorphismMatrixAlgebra[101X
  
  [29X[2XIsomorphismMatrixAlgebra[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0Yisomorphism from the algebra [3XA[103X onto a matrix algebra. Currently this is only
  implemented for associative algebras with one.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 1, [1,1] ); SetEntrySCTable( T, 2, 2, [1,2] );[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraByStructureConstants( Rationals, T );;[127X[104X
    [4X[25Xgap>[125X [27XA:= AsAlgebraWithOne( Rationals, A );;[127X[104X
    [4X[25Xgap>[125X [27Xf:=IsomorphismMatrixAlgebra( A );[127X[104X
    [4X[28X<op. hom. AlgebraWithOne( Rationals, ... ) -> matrices of dim. 2>[128X[104X
    [4X[25Xgap>[125X [27XImage( f, BasisVectors( Basis( A ) )[1] );[127X[104X
    [4X[28X[ [ 1, 0 ], [ 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X62.10-12 IsomorphismSCAlgebra[101X
  
  [29X[2XIsomorphismSCAlgebra[102X( [3XB[103X ) [32X attribute
  [29X[2XIsomorphismSCAlgebra[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0YFor  a basis [3XB[103X of an algebra [22XA[122X, say, [2XIsomorphismSCAlgebra[102X returns an algebra
  isomorphism  from [22XA[122X to an algebra [22XS[122X given by structure constants (see [14X62.4[114X),
  such that the canonical basis of [22XS[122X is the image of [3XB[103X.[133X
  
  [33X[0;0YFor  an algebra [3XA[103X, [2XIsomorphismSCAlgebra[102X chooses a basis of [3XA[103X and returns the
  [2XIsomorphismSCAlgebra[102X value for that basis.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XIsomorphismSCAlgebra( GF(8) );[127X[104X
    [4X[28XCanonicalBasis( GF(2^3) ) -> CanonicalBasis( <algebra of dimension [128X[104X
    [4X[28X3 over GF(2)> )[128X[104X
    [4X[25Xgap>[125X [27XIsomorphismSCAlgebra( GF(2)^[2,2] );[127X[104X
    [4X[28XCanonicalBasis( ( GF(2)^[128X[104X
    [4X[28X[ 2, 2 ] ) ) -> CanonicalBasis( <algebra of dimension 4 over GF(2)> )[128X[104X
  [4X[32X[104X
  
  [1X62.10-13 RepresentativeLinearOperation[101X
  
  [29X[2XRepresentativeLinearOperation[102X( [3XA[103X, [3Xv[103X, [3Xw[103X, [3Xopr[103X ) [32X operation
  
  [33X[0;0Yis  an element of the algebra [3XA[103X that maps the vector [3Xv[103X to the vector [3Xw[103X under
  the  linear  operation  described  by  the  function [3Xopr[103X. If no such element
  exists then [9Xfail[109X is returned.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm1:= NullMat( 2, 2 );; m1[1][1]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27Xm2:= NullMat( 2, 2 );; m2[2][2]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27XB:= AlgebraByGenerators( Rationals, [ m1, m2 ] );;[127X[104X
    [4X[25Xgap>[125X [27XRepresentativeLinearOperation( B, [1,0], [1,0], OnRight );[127X[104X
    [4X[28X[ [ 1, 0 ], [ 0, 0 ] ][128X[104X
    [4X[25Xgap>[125X [27XRepresentativeLinearOperation( B, [1,0], [0,1], OnRight );[127X[104X
    [4X[28Xfail[128X[104X
  [4X[32X[104X
  
  
  [1X62.11 [33X[0;0YRepresentations of Algebras[133X[101X
  
  [33X[0;0YAn  algebra  module is a vector space together with an action of an algebra.
  So  a module over an algebra is constructed by giving generators of a vector
  space,  and  a  function  for  calculating the action of algebra elements on
  elements  of  the  vector  space.  When  creating  an  algebra  module,  the
  generators  of  the  vector  space  are  wrapped  up  and given the category
  [10XIsLeftAlgebraModuleElement[110X  or [10XIsRightModuleElement[110X if the algebra acts from
  the left, or right respectively. (So in the case of a bi-module the elements
  get  both categories.) Most linear algebra computations are delegated to the
  original vector space.[133X
  
  [33X[0;0YThe  transition  between  the  original  vector  space and the corresponding
  algebra  module  is handled by [10XExtRepOfObj[110X and [10XObjByExtRep[110X. For an element [10Xv[110X
  of  the  algebra  module, [10XExtRepOfObj( v )[110X returns the underlying element of
  the original vector space. Furthermore, if [10Xvec[110X is an element of the original
  vector  space,  and  [10Xfam[110X  the  elements  family of the corresponding algebra
  module,  then  [10XObjByExtRep(  fam, vec )[110X returns the corresponding element of
  the algebra module. Below is an example of this.[133X
  
  [33X[0;0YThe  action  of the algebra on elements of the algebra module is constructed
  by  using  the  operator  [10X^[110X.  If  [10Xx[110X  is an element of an algebra [10XA[110X, and [10Xv[110X an
  element  of a left [10XA[110X-module, then [10Xx^v[110X calculates the result of the action of
  [10Xx[110X  on  [10Xv[110X.  Similarly,  if  [10Xv[110X  is  an  element  of a right [10XA[110X-module, then [10Xv^x[110X
  calculates the action of [10Xx[110X on [10Xv[110X.[133X
  
  [1X62.11-1 LeftAlgebraModuleByGenerators[101X
  
  [29X[2XLeftAlgebraModuleByGenerators[102X( [3XA[103X, [3Xop[103X, [3Xgens[103X ) [32X operation
  
  [33X[0;0YConstructs  the  left algebra module over [3XA[103X generated by the list of vectors
  [3Xgens[103X.  The  action  of  [3XA[103X  is  described  by the function [3Xop[103X. This must be a
  function  of  two  arguments; the first argument is the algebra element, and
  the  second  argument  is  a  vector;  it outputs the result of applying the
  algebra element to the vector.[133X
  
  [1X62.11-2 RightAlgebraModuleByGenerators[101X
  
  [29X[2XRightAlgebraModuleByGenerators[102X( [3XA[103X, [3Xop[103X, [3Xgens[103X ) [32X operation
  
  [33X[0;0YConstructs  the right algebra module over [3XA[103X generated by the list of vectors
  [3Xgens[103X.  The  action  of  [3XA[103X  is  described  by the function [3Xop[103X. This must be a
  function  of  two  arguments; the first argument is a vector, and the second
  argument  is  the  algebra  element;  it  outputs the result of applying the
  algebra element to the vector.[133X
  
  [1X62.11-3 BiAlgebraModuleByGenerators[101X
  
  [29X[2XBiAlgebraModuleByGenerators[102X( [3XA[103X, [3XB[103X, [3Xopl[103X, [3Xopr[103X, [3Xgens[103X ) [32X operation
  
  [33X[0;0YConstructs  the  algebra  bi-module  over  [3XA[103X  and [3XB[103X generated by the list of
  vectors [3Xgens[103X. The left action of [3XA[103X is described by the function [3Xopl[103X, and the
  right  action  of  [3XB[103X  by  the  function  [3Xopr[103X.  [3Xopl[103X must be a function of two
  arguments;  the  first  argument  is  the  algebra  element,  and the second
  argument  is a vector; it outputs the result of applying the algebra element
  on  the  left  to  the  vector. [3Xopr[103X must be a function of two arguments; the
  first  argument is a vector, and the second argument is the algebra element;
  it  outputs  the  result of applying the algebra element on the right to the
  vector.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= Rationals^[3,3];[127X[104X
    [4X[28X( Rationals^[ 3, 3 ] )[128X[104X
    [4X[25Xgap>[125X [27XV:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );[127X[104X
    [4X[28X<left-module over ( Rationals^[ 3, 3 ] )>[128X[104X
    [4X[25Xgap>[125X [27XW:= RightAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );[127X[104X
    [4X[28X<right-module over ( Rationals^[ 3, 3 ] )>[128X[104X
    [4X[25Xgap>[125X [27XM:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [ 1, 0, 0 ] ] );[127X[104X
    [4X[28X<bi-module over ( Rationals^[ 3, 3 ] ) (left) and ( Rationals^[128X[104X
    [4X[28X[ 3, 3 ] ) (right)>[128X[104X
  [4X[32X[104X
  
  [33X[0;0YIn  the  above  examples,  the  modules [10XV[110X, [10XW[110X, and [10XM[110X are [22X3[122X-dimensional vector
  spaces  over  the rationals. The algebra [10XA[110X acts from the left on [10XV[110X, from the
  right on [10XW[110X, and from the left and from the right on [10XM[110X.[133X
  
  [1X62.11-4 LeftAlgebraModule[101X
  
  [29X[2XLeftAlgebraModule[102X( [3XA[103X, [3Xop[103X, [3XV[103X ) [32X operation
  
  [33X[0;0YConstructs  the  left  algebra  module  over  [3XA[103X with underlying space [3XV[103X. The
  action  of [3XA[103X is described by the function [3Xop[103X. This must be a function of two
  arguments;  the  first  argument  is  the  algebra  element,  and the second
  argument  is  a vector from [3XV[103X; it outputs the result of applying the algebra
  element to the vector.[133X
  
  [1X62.11-5 RightAlgebraModule[101X
  
  [29X[2XRightAlgebraModule[102X( [3XA[103X, [3Xop[103X, [3XV[103X ) [32X operation
  
  [33X[0;0YConstructs  the  right  algebra  module  over [3XA[103X with underlying space [3XV[103X. The
  action  of [3XA[103X is described by the function [3Xop[103X. This must be a function of two
  arguments; the first argument is a vector, from [3XV[103X and the second argument is
  the  algebra  element; it outputs the result of applying the algebra element
  to the vector.[133X
  
  [1X62.11-6 BiAlgebraModule[101X
  
  [29X[2XBiAlgebraModule[102X( [3XA[103X, [3XB[103X, [3Xopl[103X, [3Xopr[103X, [3XV[103X ) [32X operation
  
  [33X[0;0YConstructs  the  algebra bi-module over [3XA[103X and [3XB[103X with underlying space [3XV[103X. The
  left action of [3XA[103X is described by the function [3Xopl[103X, and the right action of [3XB[103X
  by  the  function  [3Xopr[103X.  [3Xopl[103X  must be a function of two arguments; the first
  argument is the algebra element, and the second argument is a vector from [3XV[103X;
  it  outputs  the  result  of applying the algebra element on the left to the
  vector.  [3Xopr[103X  must  be  a function of two arguments; the first argument is a
  vector  from  [3XV[103X,  and the second argument is the algebra element; it outputs
  the result of applying the algebra element on the right to the vector.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= Rationals^[3,3];;[127X[104X
    [4X[25Xgap>[125X [27XV:= Rationals^3;[127X[104X
    [4X[28X( Rationals^3 )[128X[104X
    [4X[25Xgap>[125X [27XV:= Rationals^3;;[127X[104X
    [4X[25Xgap>[125X [27XM:= BiAlgebraModule( A, A, \*, \*, V );[127X[104X
    [4X[28X<bi-module over ( Rationals^[ 3, 3 ] ) (left) and ( Rationals^[128X[104X
    [4X[28X[ 3, 3 ] ) (right)>[128X[104X
    [4X[25Xgap>[125X [27XDimension( M );[127X[104X
    [4X[28X3[128X[104X
  [4X[32X[104X
  
  [1X62.11-7 GeneratorsOfAlgebraModule[101X
  
  [29X[2XGeneratorsOfAlgebraModule[102X( [3XM[103X ) [32X attribute
  
  [33X[0;0YA list of elements of [3XM[103X that generate [3XM[103X as an algebra module.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= Rationals^[3,3];;[127X[104X
    [4X[25Xgap>[125X [27XV:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );;[127X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfAlgebraModule( V );[127X[104X
    [4X[28X[ [ 1, 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X62.11-8 IsAlgebraModuleElement[101X
  
  [29X[2XIsAlgebraModuleElement[102X( [3Xobj[103X ) [32X Category
  [29X[2XIsAlgebraModuleElementCollection[102X( [3Xobj[103X ) [32X Category
  [29X[2XIsAlgebraModuleElementFamily[102X( [3Xfam[103X ) [32X Category
  
  [33X[0;0YCategory    of    algebra    module    elements.    If    an    object   has
  [10XIsAlgebraModuleElementCollection[110X,  then it is an algebra module. If a family
  has  [10XIsAlgebraModuleElementFamily[110X,  then  it  is  a family of algebra module
  elements (every algebra module has its own elements family).[133X
  
  [1X62.11-9 IsLeftAlgebraModuleElement[101X
  
  [29X[2XIsLeftAlgebraModuleElement[102X( [3Xobj[103X ) [32X Category
  [29X[2XIsLeftAlgebraModuleElementCollection[102X( [3Xobj[103X ) [32X Category
  
  [33X[0;0YCategory   of   left   algebra   module   elements.   If   an   object   has
  [10XIsLeftAlgebraModuleElementCollection[110X, then it is a left-algebra module.[133X
  
  [1X62.11-10 IsRightAlgebraModuleElement[101X
  
  [29X[2XIsRightAlgebraModuleElement[102X( [3Xobj[103X ) [32X Category
  [29X[2XIsRightAlgebraModuleElementCollection[102X( [3Xobj[103X ) [32X Category
  
  [33X[0;0YCategory   of   right   algebra   module   elements.   If   an   object  has
  [10XIsRightAlgebraModuleElementCollection[110X, then it is a right-algebra module.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= Rationals^[3,3];[127X[104X
    [4X[28X( Rationals^[ 3, 3 ] )[128X[104X
    [4X[25Xgap>[125X [27XM:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [ 1, 0, 0 ] ] );[127X[104X
    [4X[28X<bi-module over ( Rationals^[ 3, 3 ] ) (left) and ( Rationals^[128X[104X
    [4X[28X[ 3, 3 ] ) (right)>[128X[104X
    [4X[25Xgap>[125X [27Xvv:= BasisVectors( Basis( M ) );[127X[104X
    [4X[28X[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27XIsLeftAlgebraModuleElement( vv[1] );[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsRightAlgebraModuleElement( vv[1] );[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xvv[1] = [ 1, 0, 0 ];[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XExtRepOfObj( vv[1] ) = [ 1, 0, 0 ];[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XObjByExtRep( ElementsFamily( FamilyObj( M ) ), [ 1, 0, 0 ] ) in M;[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xxx:= BasisVectors( Basis( A ) );;[127X[104X
    [4X[25Xgap>[125X [27Xxx[4]^vv[1];  # left action[127X[104X
    [4X[28X[ 0, 1, 0 ][128X[104X
    [4X[25Xgap>[125X [27Xvv[1]^xx[2];  # right action[127X[104X
    [4X[28X[ 0, 1, 0 ][128X[104X
  [4X[32X[104X
  
  [1X62.11-11 LeftActingAlgebra[101X
  
  [29X[2XLeftActingAlgebra[102X( [3XV[103X ) [32X attribute
  
  [33X[0;0YHere [3XV[103X is a left-algebra module; this function returns the algebra that acts
  from the left on [3XV[103X.[133X
  
  [1X62.11-12 RightActingAlgebra[101X
  
  [29X[2XRightActingAlgebra[102X( [3XV[103X ) [32X attribute
  
  [33X[0;0YHere  [3XV[103X  is  a  right-algebra module; this function returns the algebra that
  acts from the right on [3XV[103X.[133X
  
  [1X62.11-13 ActingAlgebra[101X
  
  [29X[2XActingAlgebra[102X( [3XV[103X ) [32X operation
  
  [33X[0;0YHere  [3XV[103X is an algebra module; this function returns the algebra that acts on
  [3XV[103X  (this  is  the  same as [10XLeftActingAlgebra( [3XV[103X[10X )[110X if [3XV[103X is a left module, and
  [10XRightActingAlgebra( [3XV[103X[10X )[110X if [3XV[103X is a right module; it will signal an error if [3XV[103X
  is a bi-module).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= Rationals^[3,3];;[127X[104X
    [4X[25Xgap>[125X [27XM:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [ 1, 0, 0 ] ] );;[127X[104X
    [4X[25Xgap>[125X [27XLeftActingAlgebra( M );[127X[104X
    [4X[28X( Rationals^[ 3, 3 ] )[128X[104X
    [4X[25Xgap>[125X [27XRightActingAlgebra( M );[127X[104X
    [4X[28X( Rationals^[ 3, 3 ] )[128X[104X
    [4X[25Xgap>[125X [27XV:= RightAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );;[127X[104X
    [4X[25Xgap>[125X [27XActingAlgebra( V );[127X[104X
    [4X[28X( Rationals^[ 3, 3 ] )[128X[104X
  [4X[32X[104X
  
  [1X62.11-14 IsBasisOfAlgebraModuleElementSpace[101X
  
  [29X[2XIsBasisOfAlgebraModuleElementSpace[102X( [3XB[103X ) [32X Category
  
  [33X[0;0YIf a basis [3XB[103X lies in the category [10XIsBasisOfAlgebraModuleElementSpace[110X, then [3XB[103X
  is  a  basis  of  a subspace of an algebra module. This means that [3XB[103X has the
  record  field  [10X[3XB[103X[10X!.delegateBasis[110X  set.  This  last  object  is a basis of the
  corresponding  subspace  of  the  vector space underlying the algebra module
  (i.e., the vector space spanned by all [10XExtRepOfObj( v )[110X for [10Xv[110X in the algebra
  module).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= Rationals^[3,3];;[127X[104X
    [4X[25Xgap>[125X [27XM:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [ 1, 0, 0 ] ] );;[127X[104X
    [4X[25Xgap>[125X [27XB:= Basis( M );[127X[104X
    [4X[28XBasis( <3-dimensional bi-module over ( Rationals^[128X[104X
    [4X[28X[ 3, 3 ] ) (left) and ( Rationals^[ 3, 3 ] ) (right)>, [128X[104X
    [4X[28X[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] )[128X[104X
    [4X[25Xgap>[125X [27XIsBasisOfAlgebraModuleElementSpace( B );[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XB!.delegateBasis;[127X[104X
    [4X[28XSemiEchelonBasis( <vector space of dimension 3 over Rationals>, [128X[104X
    [4X[28X[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] )[128X[104X
  [4X[32X[104X
  
  [1X62.11-15 MatrixOfAction[101X
  
  [29X[2XMatrixOfAction[102X( [3XB[103X, [3Xx[103X[, [3Xside[103X] ) [32X operation
  
  [33X[0;0YHere  [3XB[103X  is  a basis of an algebra module and [3Xx[103X is an element of the algebra
  that  acts on this module. This function returns the matrix of the action of
  [3Xx[103X  with  respect to [3XB[103X. If [3Xx[103X acts from the left, then the coefficients of the
  images of the basis elements of [3XB[103X (under the action of [3Xx[103X) are the columns of
  the output. If [3Xx[103X acts from the right, then they are the rows of the output.[133X
  
  [33X[0;0YIf  the  module  is  a  bi-module,  then  the  third  parameter [3Xside[103X must be
  specified.  This  is  the string [10X"left"[110X, or [10X"right"[110X depending whether [3Xx[103X acts
  from the left or the right.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XM:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );;[127X[104X
    [4X[25Xgap>[125X [27Xx:= Basis(A)[3];[127X[104X
    [4X[28X[ [ 0, 0, 1 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ][128X[104X
    [4X[25Xgap>[125X [27XMatrixOfAction( Basis( M ), x );[127X[104X
    [4X[28X[ [ 0, 0, 1 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X62.11-16 SubAlgebraModule[101X
  
  [29X[2XSubAlgebraModule[102X( [3XM[103X, [3Xgens[103X[, [3X"basis"[103X] ) [32X operation
  
  [33X[0;0Yis the sub-module of the algebra module [3XM[103X, generated by the vectors in [3Xgens[103X.
  If  as  an  optional  argument the string [10Xbasis[110X is added, then it is assumed
  that the vectors in [3Xgens[103X form a basis of the submodule.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm1:= NullMat( 2, 2 );; m1[1][1]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27Xm2:= NullMat( 2, 2 );; m2[2][2]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27XA:= Algebra( Rationals, [ m1, m2 ] );;[127X[104X
    [4X[25Xgap>[125X [27XM:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0 ], [ 0, 1 ] ] );[127X[104X
    [4X[28X<left-module over <algebra over Rationals, with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27Xbb:= BasisVectors( Basis( M ) );[127X[104X
    [4X[28X[ [ 1, 0 ], [ 0, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27XV:= SubAlgebraModule( M, [ bb[1] ] );[127X[104X
    [4X[28X<left-module over <algebra over Rationals, with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XDimension( V );[127X[104X
    [4X[28X1[128X[104X
  [4X[32X[104X
  
  [1X62.11-17 LeftModuleByHomomorphismToMatAlg[101X
  
  [29X[2XLeftModuleByHomomorphismToMatAlg[102X( [3XA[103X, [3Xhom[103X ) [32X operation
  
  [33X[0;0YHere  [3XA[103X  is  an algebra and [3Xhom[103X a homomorphism from [3XA[103X into a matrix algebra.
  This function returns the left [3XA[103X-module defined by the homomorphism [3Xhom[103X.[133X
  
  [1X62.11-18 RightModuleByHomomorphismToMatAlg[101X
  
  [29X[2XRightModuleByHomomorphismToMatAlg[102X( [3XA[103X, [3Xhom[103X ) [32X operation
  
  [33X[0;0YHere  [3XA[103X  is  an algebra and [3Xhom[103X a homomorphism from [3XA[103X into a matrix algebra.
  This function returns the right [3XA[103X-module defined by the homomorphism [3Xhom[103X.[133X
  
  [33X[0;0YFirst  we  produce a structure constants algebra with basis elements [22Xx[122X, [22Xy[122X, [22Xz[122X
  such that [22Xx^2 = x[122X, [22Xy^2 = y[122X, [22Xxz = z[122X, [22Xzy = z[122X and all other products are zero.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 3, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 1, [ 1, 1 ]);[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 2, 2, [ 1, 2 ]);[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 3, [ 1, 3 ]);[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 3, 2, [ 1, 3 ]);[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraByStructureConstants( Rationals, T );[127X[104X
    [4X[28X<algebra of dimension 3 over Rationals>[128X[104X
  [4X[32X[104X
  
  [33X[0;0YNow we construct an isomorphic matrix algebra.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm1:= NullMat( 2, 2 );; m1[1][1]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27Xm2:= NullMat( 2, 2 );; m2[2][2]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27Xm3:= NullMat( 2, 2 );; m3[1][2]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27XB:= Algebra( Rationals, [ m1, m2, m3 ] );[127X[104X
    [4X[28X<algebra over Rationals, with 3 generators>[128X[104X
  [4X[32X[104X
  
  [33X[0;0YFinally we construct the homomorphism and the corresponding right module.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xf:= AlgebraHomomorphismByImages( A, B, Basis(A), [ m1, m2, m3 ] );;[127X[104X
    [4X[25Xgap>[125X [27XRightModuleByHomomorphismToMatAlg( A, f );[127X[104X
    [4X[28X<right-module over <algebra of dimension 3 over Rationals>>[128X[104X
  [4X[32X[104X
  
  [1X62.11-19 AdjointModule[101X
  
  [29X[2XAdjointModule[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0Yreturns the [3XA[103X-module defined by the left action of [3XA[103X on itself.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm1:= NullMat( 2, 2 );; m1[1][1]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27Xm2:= NullMat( 2, 2 );; m2[2][2]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27Xm3:= NullMat( 2, 2 );; m3[1][2]:= 1;;[127X[104X
    [4X[25Xgap>[125X [27XA:= Algebra( Rationals, [ m1, m2, m3 ] );[127X[104X
    [4X[28X<algebra over Rationals, with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XV:= AdjointModule( A );[127X[104X
    [4X[28X<3-dimensional left-module over <algebra of dimension [128X[104X
    [4X[28X3 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27Xv:= Basis( V )[3];[127X[104X
    [4X[28X[ [ 0, 1 ], [ 0, 0 ] ][128X[104X
    [4X[25Xgap>[125X [27XW:= SubAlgebraModule( V, [ v ] );[127X[104X
    [4X[28X<left-module over <algebra of dimension 3 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27XDimension( W );[127X[104X
    [4X[28X1[128X[104X
  [4X[32X[104X
  
  [1X62.11-20 FaithfulModule[101X
  
  [29X[2XFaithfulModule[102X( [3XA[103X ) [32X attribute
  
  [33X[0;0Yreturns  a  faithful finite-dimensional left-module over the algebra [3XA[103X. This
  is  only  implemented  for  associative  algebras,  and  for Lie algebras of
  characteristic   [22X0[122X.   (It   may  also  work  for  certain  Lie  algebras  of
  characteristic [22Xp > 0[122X.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 2, 0 );;[127X[104X
    [4X[25Xgap>[125X [27XA:= AlgebraByStructureConstants( Rationals, T );[127X[104X
    [4X[28X<algebra of dimension 2 over Rationals>[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XT:= EmptySCTable( 3, 0, "antisymmetric" );;[127X[104X
    [4X[25Xgap>[125X [27XSetEntrySCTable( T, 1, 2, [ 1, 3 ]);[127X[104X
    [4X[25Xgap>[125X [27XL:= LieAlgebraByStructureConstants( Rationals, T );[127X[104X
    [4X[28X<Lie algebra of dimension 3 over Rationals>[128X[104X
    [4X[25Xgap>[125X [27XV:= FaithfulModule( L );[127X[104X
    [4X[28X<left-module over <Lie algebra of dimension 3 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27Xvv:= BasisVectors( Basis( V ) );[127X[104X
    [4X[28X[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27Xx:= Basis( L )[3];[127X[104X
    [4X[28Xv.3[128X[104X
    [4X[25Xgap>[125X [27XList( vv, v -> x^v );[127X[104X
    [4X[28X[ [ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [33X[0;0Y[10XA[110X is a [22X2[122X-dimensional algebra where all products are zero.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XV:= FaithfulModule( A );[127X[104X
    [4X[28X<left-module over <algebra of dimension 2 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27Xvv:= BasisVectors( Basis( V ) );[127X[104X
    [4X[28X[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27Xxx:= BasisVectors( Basis( A ) );[127X[104X
    [4X[28X[ v.1, v.2 ][128X[104X
    [4X[25Xgap>[125X [27Xxx[1]^vv[3];[127X[104X
    [4X[28X[ 1, 0, 0 ][128X[104X
  [4X[32X[104X
  
  [1X62.11-21 ModuleByRestriction[101X
  
  [29X[2XModuleByRestriction[102X( [3XV[103X, [3Xsub1[103X[, [3Xsub2[103X] ) [32X operation
  
  [33X[0;0YHere  [3XV[103X  is an algebra module and [3Xsub1[103X is a subalgebra of the acting algebra
  of [3XV[103X. This function returns the module that is the restriction of [3XV[103X to [3Xsub1[103X.
  So  it  has the same underlying vector space as [3XV[103X, but the acting algebra is
  [3Xsub[103X.  If  two  subalgebras  [3Xsub1[103X,  [3Xsub2[103X  are given then [3XV[103X is assumed to be a
  bi-module, and [3Xsub1[103X a subalgebra of the algebra acting on the left, and [3Xsub2[103X
  a subalgebra of the algebra acting on the right.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= Rationals^[3,3];;[127X[104X
    [4X[25Xgap>[125X [27XV:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );;[127X[104X
    [4X[25Xgap>[125X [27XB:= Subalgebra( A, [ Basis(A)[1] ] );[127X[104X
    [4X[28X<algebra over Rationals, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XW:= ModuleByRestriction( V, B );[127X[104X
    [4X[28X<left-module over <algebra over Rationals, with 1 generators>>[128X[104X
  [4X[32X[104X
  
  [1X62.11-22 NaturalHomomorphismBySubAlgebraModule[101X
  
  [29X[2XNaturalHomomorphismBySubAlgebraModule[102X( [3XV[103X, [3XW[103X ) [32X operation
  
  [33X[0;0YHere  [3XV[103X  must  be  a  sub-algebra  module  of  [3XV[103X.  This function returns the
  projection  from  [3XV[103X  onto  [10X[3XV[103X[10X/[3XW[103X[10X[110X.  It  is  a linear map, that is also a module
  homomorphism.  As  usual  images  can  be  formed  with  [10XImage(  f,  v )[110X and
  pre-images with [10XPreImagesRepresentative( f, u )[110X.[133X
  
  [33X[0;0YThe quotient module can also be formed by entering [10X[3XV[103X[10X/[3XW[103X[10X[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= Rationals^[3,3];;[127X[104X
    [4X[25Xgap>[125X [27XB:= DirectSumOfAlgebras( A, A );[127X[104X
    [4X[28X<algebra over Rationals, with 6 generators>[128X[104X
    [4X[25Xgap>[125X [27XT:= StructureConstantsTable( Basis( B ) );;[127X[104X
    [4X[25Xgap>[125X [27XC:= AlgebraByStructureConstants( Rationals, T );[127X[104X
    [4X[28X<algebra of dimension 18 over Rationals>[128X[104X
    [4X[25Xgap>[125X [27XV:= AdjointModule( C );[127X[104X
    [4X[28X<left-module over <algebra of dimension 18 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27XW:= SubAlgebraModule( V, [ Basis(V)[1] ] );[127X[104X
    [4X[28X<left-module over <algebra of dimension 18 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27Xf:= NaturalHomomorphismBySubAlgebraModule( V, W );[127X[104X
    [4X[28X<linear mapping by matrix, <[128X[104X
    [4X[28X18-dimensional left-module over <algebra of dimension [128X[104X
    [4X[28X18 over Rationals>> -> <[128X[104X
    [4X[28X9-dimensional left-module over <algebra of dimension [128X[104X
    [4X[28X18 over Rationals>>>[128X[104X
    [4X[25Xgap>[125X [27Xquo:= ImagesSource( f );  # i.e., the quotient module[127X[104X
    [4X[28X<9-dimensional left-module over <algebra of dimension [128X[104X
    [4X[28X18 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27Xv:= Basis( quo )[1];[127X[104X
    [4X[28X[ 1, 0, 0, 0, 0, 0, 0, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XPreImagesRepresentative( f, v );[127X[104X
    [4X[28Xv.4[128X[104X
    [4X[25Xgap>[125X [27XBasis( C )[4]^v;[127X[104X
    [4X[28X[ 1, 0, 0, 0, 0, 0, 0, 0, 0 ][128X[104X
  [4X[32X[104X
  
  [1X62.11-23 DirectSumOfAlgebraModules[101X
  
  [29X[2XDirectSumOfAlgebraModules[102X( [3Xlist[103X ) [32X operation
  [29X[2XDirectSumOfAlgebraModules[102X( [3XV[103X, [3XW[103X ) [32X operation
  
  [33X[0;0YHere  [3Xlist[103X  must  be  a  list  of algebra modules. This function returns the
  direct  sum  of the elements in the list (as an algebra module). The modules
  must be defined over the same algebras.[133X
  
  [33X[0;0YIn the second form is short for [10XDirectSumOfAlgebraModules( [ [3XV[103X[10X, [3XW[103X[10X ] )[110X[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FullMatrixAlgebra( Rationals, 3 );;[127X[104X
    [4X[25Xgap>[125X [27XV:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [1,0,0] ] );;[127X[104X
    [4X[25Xgap>[125X [27XW:= DirectSumOfAlgebraModules( V, V );[127X[104X
    [4X[28X<6-dimensional left-module over ( Rationals^[ 3, 3 ] )>[128X[104X
    [4X[25Xgap>[125X [27XBasisVectors( Basis( W ) );[127X[104X
    [4X[28X[ ( [ 1, 0, 0 ] )(+)( [ 0, 0, 0 ] ), ( [ 0, 1, 0 ] )(+)( [ 0, 0, 0 ] )[128X[104X
    [4X[28X    , ( [ 0, 0, 1 ] )(+)( [ 0, 0, 0 ] ), [128X[104X
    [4X[28X  ( [ 0, 0, 0 ] )(+)( [ 1, 0, 0 ] ), ( [ 0, 0, 0 ] )(+)( [ 0, 1, 0 ] )[128X[104X
    [4X[28X    , ( [ 0, 0, 0 ] )(+)( [ 0, 0, 1 ] ) ][128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XL:= SimpleLieAlgebra( "C", 3, Rationals );;[127X[104X
    [4X[25Xgap>[125X [27XV:= HighestWeightModule( L, [ 1, 1, 0 ] );[127X[104X
    [4X[28X<64-dimensional left-module over <Lie algebra of dimension [128X[104X
    [4X[28X21 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27XW:= HighestWeightModule( L, [ 0, 0, 2 ] );[127X[104X
    [4X[28X<84-dimensional left-module over <Lie algebra of dimension [128X[104X
    [4X[28X21 over Rationals>>[128X[104X
    [4X[25Xgap>[125X [27XU:= DirectSumOfAlgebraModules( V, W );[127X[104X
    [4X[28X<148-dimensional left-module over <Lie algebra of dimension [128X[104X
    [4X[28X21 over Rationals>>[128X[104X
  [4X[32X[104X
  
  [1X62.11-24 TranslatorSubalgebra[101X
  
  [29X[2XTranslatorSubalgebra[102X( [3XM[103X, [3XU[103X, [3XW[103X ) [32X operation
  
  [33X[0;0YHere  [3XM[103X  is  an algebra module, and [3XU[103X and [3XW[103X are two subspaces of [3XM[103X. Let [3XA[103X be
  the algebra acting on [3XM[103X. This function returns the subspace of elements of [3XA[103X
  that  map  [3XU[103X  into  [3XW[103X.  If [3XW[103X is a sub-algebra-module (i.e., closed under the
  action of [3XA[103X), then this space is a subalgebra of [3XA[103X.[133X
  
  [33X[0;0YThis  function  works  for  left, or right modules over a finite-dimensional
  algebra.  We  stress  that  it  is  not  checked  whether [3XU[103X and [3XW[103X are indeed
  subspaces  of  [3XM[103X.  If  this  is not the case nothing is guaranteed about the
  behaviour of the function.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA:= FullMatrixAlgebra( Rationals, 3 );[127X[104X
    [4X[28X( Rationals^[ 3, 3 ] )[128X[104X
    [4X[25Xgap>[125X [27XV:= Rationals^[3,2];[127X[104X
    [4X[28X( Rationals^[ 3, 2 ] )[128X[104X
    [4X[25Xgap>[125X [27XM:= LeftAlgebraModule( A, \*, V );[127X[104X
    [4X[28X<left-module over ( Rationals^[ 3, 3 ] )>[128X[104X
    [4X[25Xgap>[125X [27Xbm:= Basis(M);;[127X[104X
    [4X[25Xgap>[125X [27XU:= SubAlgebraModule( M, [ bm[1] ] );   [127X[104X
    [4X[28X<left-module over ( Rationals^[ 3, 3 ] )>[128X[104X
    [4X[25Xgap>[125X [27XTranslatorSubalgebra( M, U, M );[127X[104X
    [4X[28X<algebra of dimension 9 over Rationals>[128X[104X
    [4X[25Xgap>[125X [27XW:= SubAlgebraModule( M, [ bm[4] ] );[127X[104X
    [4X[28X<left-module over ( Rationals^[ 3, 3 ] )>[128X[104X
    [4X[25Xgap>[125X [27XT:=TranslatorSubalgebra( M, U, W );[127X[104X
    [4X[28X<algebra of dimension 0 over Rationals>[128X[104X
  [4X[32X[104X
  
