Try setting ratmx to true:
(%i27) m :
matrix([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4],[1,0,2,1,2,1,3,2,2,1,3,2,3,2,4,3],
[1,2,0,1,2,3,1,2,2,3,1,2,3,4,2,3],[2,1,1,0,3,2,2,1,3,2,2,1,4,3,3,2],
[1,2,2,3,0,1,1,2,2,3,3,4,1,2,2,3],[2,1,3,2,1,0,2,1,3,2,4,3,2,1,3,2],
[2,3,1,2,1,2,0,1,3,4,2,3,2,3,1,2],[3,2,2,1,2,1,1,0,4,3,3,2,3,2,2,1],
[1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3],[2,1,3,2,3,2,4,3,1,0,2,1,2,1,3,2],
[2,3,1,2,3,4,2,3,1,2,0,1,2,3,1,2],[3,2,2,1,4,3,3,2,2,1,1,0,3,2,2,1],
[2,3,3,4,1,2,2,3,1,2,2,3,0,1,1,2],[3,2,4,3,2,1,3,2,2,1,3,2,1,0,2,1],
[3,4,2,3,2,3,1,2,2,3,1,2,1,2,0,1],[4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0])$
(%i28) ratmx : true$
(%i29) charpoly(m,'x);
Evaluation took 0.0100 seconds (0.0100 elapsed)
(%o29) x^16-640*x^14-10240*x^13-61440*x^12-131072*x^11
Question: Should charpoly automatically set ratmx to true?
Barton
-----maxima-bounces at math.utexas.edu wrote: -----
>To: maxima at math.utexas.edu
>From: Oliver Kullmann <O.Kullmann at swansea.ac.uk>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 05/23/2008 11:19AM
>Subject: charpoly very, very slow
>
>Hi,
>
>(%i6) M;
>(%o6)
>matrix([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4],[1,0,2,1,2,1,3,2,2,1,3,2,3,2,4,3]
>,
>
>[1,2,0,1,2,3,1,2,2,3,1,2,3,4,2,3],[2,1,1,0,3,2,2,1,3,2,2,1,4,3,3,2],
>
>[1,2,2,3,0,1,1,2,2,3,3,4,1,2,2,3],[2,1,3,2,1,0,2,1,3,2,4,3,2,1,3,2],
>
>[2,3,1,2,1,2,0,1,3,4,2,3,2,3,1,2],[3,2,2,1,2,1,1,0,4,3,3,2,3,2,2,1],
>
>[1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3],[2,1,3,2,3,2,4,3,1,0,2,1,2,1,3,2],
>
>[2,3,1,2,3,4,2,3,1,2,0,1,2,3,1,2],[3,2,2,1,4,3,3,2,2,1,1,0,3,2,2,1],
>
>[2,3,3,4,1,2,2,3,1,2,2,3,0,1,1,2],[3,2,4,3,2,1,3,2,2,1,3,2,1,0,2,1],
>
>[3,4,2,3,2,3,1,2,2,3,1,2,1,2,0,1],[4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0])
>(%i7) charpoly(M,x);
>
>This runs now already for a day!
>
>Computing the characteristic polynomial is somewhat more expensive than
>Gaussian
>elimination, but not too much, and so I believe something is wrong here.
>
>Oliver
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima