%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% $Id: AlgebraWithBasis_Table.tex,v 1.1.1.2 2003/09/22 18:05:07 nthiery Exp $
% File:		lib/DOMAINS/DOMAIN/DOC/AlgebraWithBasis_Table
% Authors:	Nicolas M. Thiéry
% Created:	31/05/2002
% Purpose:	Documentation of the domain 'Dom::AlgebraWithBasis_Table'
% License:	LGPL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{Mhelppage}{AlgebraWithBasis_Table}{N.~Thiéry}

\begin{MInfo}
\eng{Algebra on a basis}
\end{MInfo}

\begin{MIntro}
  \eng{\Mthis\Mex{(Ring, Basis, \Mopt{, BasisMonoidMult=mult} \Mopt{,
        BasisMult=mult}) \Mopt{BasisOne=one}}
  
    Creates a domain for the algebra over the ring \Mpar{Ring} with
    linear basis elements in the domain \Mpar{Basis} and product
    defined by the procedure \Mpar{mult}.}
  
  \eng{\Mwarn{This domain is deprecated, and will be removed in the
      near future; please use instead \Mup{Dom::FreeModule} in
      combination with \Mup{Cat::AlgebraWithBasis}, as described in
      the \Mup[index,demonstration]{demonstration}.}}
\end{MIntro}

%\begin{MDomConst}
%\end{MDomConst}

%\begin{MParameters}
%\end{MParameters}

\begin{MDetails}
  \eng{Internally, an element \Mex{e} of this domain is represented by
    a table of the form \Mex{table(b1=c1, b2=c2, ... )}, where
    \Mex{c1} is the is the coefficient of \Mex{e} on the basis element
    \Mex{b}. The advantage of this representation is that the basis
    can consist of any MuPAD object; on the other hand it is not very
    fast. }
\end{MDetails}

%\begin{MDomElConst}
%\MCall[\Mthis(n)]{l}
%\end{MDomElConst}

%\begin{MParameters}
%\param{l}
%\eng{list or array consisting of the first $n$ integers in some order.}
%\de{}
%\end{MParameters}

\begin{MCategories}
  \Mup{Cat::Module(Ring)}
  \Mup{Cat::Module(Ring)}
\end{MCategories}

\MRelatedDomains{Dom::FreeModuleTable}

%\begin{MDetails}
%\eng{}
%\de{}
%\end{MDetails}

\begin{MDomEntries}
\MDomEntry{one}
\eng{the identity of the algebra}
\end{MDomEntries}

\MMathMethods

\begin{MMethodDetails}{_mult}
  \infoEng{product}
  \infoDe{}  
  \call{\Mseq{\Mtype{dom} a1}}
  \eng{Returns the product of \Mex{a1}}
  \eng{This method overloads the function \Mup{_mult}.}
\end{MMethodDetails}

\begin{MMethodDetails}{_invert}
  \infoEng{inverse}
  \call{\Mtype{dom} a}
  \eng{Returns the inverse of a or \Mup{FAIL}.}
  \eng{This method overloads the function \Mup{_invert}.}
\end{MMethodDetails}

\MAccessMethods

\begin{MMethodDetails}{expr}
  \infoEng{conversion into expressions}
  \call{\Mtype{dom} a}
  \eng{Returns an expression representing \Mpar{a}.}
\end{MMethodDetails}


\begin{MExample}{ex1}
  \eng{We construct the algebra of the symmetric group on \Mex{4}
    elements:}
  \begin{Mexin}
S4 := Dom::SymmetricGroup(4):
A4 := Dom::AlgebraWithBasis_Table(Dom::Rational, S4)
  \end{Mexin}
  \begin{Mexout}
Dom::AlgebraWithBasis_Table(Dom::Rational,

   Dom::SymmetricGroup(4))
  \end{Mexout}
  \eng{Now, we create some elements of \Mex{A4}, and do some
    computations with them:}
  \begin{Mexin}
a := A4::one;
a + a;
A4(S4([1,2,3,4])) - A4::one;
a := A4(S4([2,3,4,1]));
a^2;
a^4;
a := 3 * a + 4/5 * A4(S4([1,3,2,4]))
  \end{Mexin}
  \begin{Mexout}
                        B([1, 2, 3, 4])

                       2 B([1, 2, 3, 4])

                               0

                        B([2, 3, 4, 1])

                        B([3, 4, 1, 2])

                        B([1, 2, 3, 4])

            3 B([2, 3, 4, 1]) + 4/5 B([1, 3, 2, 4])
  \end{Mexout}
  Now we demonstrate how to do some basic linear algebra, say to find
  the minimal polynomial of an element:
  \begin{Mexin}
A4 := Dom::AlgebraWithBasis_Table(Dom::ExpressionField(), S4):
a := A4(S4([2,3,1,4])):
x * a;
b := a^0 + x1*a^1 + x2*a^2 + x3*a^3 + x4*a^4;
solve([coeff(b)], [x1,x2,x3,x4])
  \end{Mexin}
  \begin{Mexout}
                       x B([2, 3, 1, 4])

(x3 + 1) B([1, 2, 3, 4]) + (x1 + x4) B([2, 3, 1, 4]) +

   x2 B([3, 1, 2, 4])

                 {[x1 = -x4, x2 = 0, x3 = -1]}
  \end{Mexout}
\end{MExample}

\begin{MExample}{ex2}
  \eng{Here is another direct construction for the algebra of the
    symmetric group on \Mex{4} elements:}
  \begin{Mexin}
SymmetricGroupAlgebra :=
proc(n: Type::PosInt)
begin
    Dom::AlgebraWithBasis_Table
    (Dom::ExpressionField(), 
     combinat::permutations, 
     BasisOne = [$1..n],
     BasisMonoidMult = combinat::permutations::_mult):
end_proc:
A4 := SymmetricGroupAlgebra(4):
  \end{Mexin} % $
  \begin{Mexout}
  \end{Mexout}
  We can use it as the previous one:
  \begin{Mexin}
a := A4([2,1,3,4]);
a^2 * x + (a*y)^3 + A4::one + A4([3,2,1,4]) * z
  \end{Mexin}
  \begin{Mexout}
                        B([2, 1, 3, 4])

                           3
(x + 1) B([1, 2, 3, 4]) + y  B([2, 1, 3, 4]) +

   z B([3, 2, 1, 4])
  \end{Mexout}
\end{MExample}

\begin{MExample}{ex2}
  \eng{This domain is deprecated, so here is the recommended way for
    defining the algebra of the symmetric group on \Mex{4} elements:}
  \begin{Mexin}
domain SymmetricGroupAlgebra(n: Type::NonNegInt)
    inherits Dom::FreeModule(Dom::ExpressionField(), combinat::permutations);
    category Cat::AlgebraWithBasis(Dom::ExpressionField());

    one := dom::term([$1..n]);
    mult2Basis := dom::term @ combinat::permutations::_mult;
end_domain;
A4 := SymmetricGroupAlgebra(4):
  \end{Mexin} % $
  \begin{Mexout}
  \end{Mexout}
  We can use it as the previous one:
  \begin{Mexin}
a := A4([2,1,3,4]);
a^2 * x + (a*y)^3 + A4::one + A4([3,2,1,4]) * z
  \end{Mexin}
  \begin{Mexout}
                        B([2, 1, 3, 4])

                     3
z B([3, 2, 1, 4]) + y  B([2, 1, 3, 4]) +

   (x + 1) B([1, 2, 3, 4])
  \end{Mexout}
\end{MExample}

\MSuperDomain{Dom::FreeModuleTable}

%\begin{MAxioms}
%\end{MAxioms}

%\begin{MBackground}
%\end{MBackground}

%\begin{MChanges}
%\end{MChanges}

\end{Mhelppage}
