Search code examples
reigenvalue

Find the biggest eigenvalue in R


I am a newby in R and I have a square matrix 100x100. I want to find the biggest eigenvalue of this matrix. I tried

is.indefinite(x)

but it writes

is.indefinite(x) : argument x is not a symmetric matrix

Does anyone know a function to find eigenvalues, or better the biggest eigenvalue in R?


Solution

  • To choose the largest eigenvalue that's not complex, you can do:

    eigenvalues = eigen(x)$values
    
    max(Re(eigenvalues[abs(Im(eigenvalues)) < 1e-6])) # you have to choose the precision you like here