The spectral radius is maximum of the absolute values of the eigenvalues of the matrix A. We can use the function SpectralRadius in Student package. But we noticed a sentence in the help document:
The output from this procedure will be as symbolic as computationally feasible. If the exact spectral radius of A is too time-consuming to compute, it may be computed numerically.
This means that SpectralRadius will evaluate the exact value when it can. Anyway, the internal evaluation process will take time. So for the sake of efficiency, we just want the numerical results of the spectral radius of a matrix.
I tried to write the following function, but I feel that it is not very efficient, especially for solving characteristic polynomials and their roots. I even feel that there is a way to find the spectral radius without taking the absolute value of all the eigenvalues and ordering them.
Spectralradius := proc(A::Matrix)
Spectrum := sort(abs~([fsolve(LinearAlgebra:-
One example: In general, the matrices I encounter come from adjacency matrices of graphs, which are always real symmetric. So their eigenvalues are always real. But the Eigenvalues command very slow because it's always trying to get the exact value. So If we use Eigenvalues to find all the eigenvalues and then sort them, it will be very slow. Thus I'm thinking about finding the numerical results.
Maybe I need a way to find all the numerical eigenvalues of a real symmetric matrix not using CharacteristicPolynomial or Eigenvalues.