%mathpiper,def="EigenValues"

// diagonal matrices will be caught by IsUpperTriangular
10 # EigenValues(matrix_IsUpperTriangular) <-- Diagonal(matrix);
10 # EigenValues(matrix_IsLowerTriangular) <-- Diagonal(matrix);

20 # EigenValues(matrix_IsMatrix) <-- Roots(CharacteristicEquation(matrix,xx));

%/mathpiper



%mathpiper_docs,name="EigenValues",categories="User Functions;Linear Algebra"
*CMD EigenValues --- get eigenvalues of a matrix
*STD
*CALL
	EigenValues(matrix)

*PARMS

{matrix} -- a square matrix

*DESC

EigenValues returns the eigenvalues of a matrix.
The eigenvalues x of a matrix M are the numbers such that
$M*v=x*v$ for some vector.

It first determines the characteristic equation, and then factorizes this
equation, returning the roots of the characteristic equation
Det(matrix-x*identity).

*E.G.

In> M:={{1,2},{2,1}}
Result: {{1,2},{2,1}};
In> EigenValues(M)
Result: {3,-1};

*SEE EigenVectors, CharacteristicEquation
%/mathpiper_docs