Function: algcharpoly
Section: algebras
C-Name: algcharpoly
Prototype: GGDnD0,L,
Help: algcharpoly(al,b,{v='x},{abs=0}): (reduced) characteristic polynomial of b in
 al, with respect to the variable v.
Doc: Given an element $b$ in \var{al}, returns its characteristic polynomial
 as a polynomial in the variable $v$. If \var{al} is a table algebra output
 by \tet{algtableinit} or if $abs=1$, returns the absolute characteristic
 polynomial of \var{b}, which is an element of $\F_p[v]$ or~$\Q[v]$; if \var{al}
 is a central simple algebra output by \tet{alginit} and $abs=0$, returns the
 reduced characteristic polynomial of \var{b}, which is an element of~$K[v]$
 where~$K$ is the center of \var{al}.
 \bprog
 ? al = alginit(nfinit(y), [-1,-1]); \\ (-1,-1)_Q
 ? algcharpoly(al, [0,1]~)
 %2 = x^2 + 1
 ? algcharpoly(al, [0,1]~,,1)
 %3 = x^4 + 2*x^2 + 1
 ? nf = nfinit(y^2-5);
 ? al = alginit(nf,[-1,y]);
 ? a = [y,1+x]~*Mod(1,y^2-5)*Mod(1,x^2+1);
 ? P = lift(algcharpoly(al,a))
 %7 = x^2 - 2*y*x + (-2*y + 5)
 ? algcharpoly(al,a,,1)
 %8 = x^8 - 20*x^6 - 80*x^5 + 110*x^4 + 800*x^3 + 1500*x^2 - 400*x + 25
 ? lift(P*subst(P,y,-y)*Mod(1,y^2-5))^2
 %9 = x^8 - 20*x^6 - 80*x^5 + 110*x^4 + 800*x^3 + 1500*x^2 - 400*x + 25
 @eprog

 Also accepts a square matrix with coefficients in \var{al}.
