Calculate the eigenvalues of a square matrix whose eigenvalues are guaranteed to be real.
Av=λvHere, A is the input matrix, v is a nonzero eigenvector, and λ is its eigenvalue. Return all eigenvalues in ascending order as a NumPy array of floats.
Input: matrix = [[4, 1], [2, 3]]
Output: [2.0, 5.0]
Explanation: Both values satisfy the characteristic equation of the matrix.
Input: matrix = [[5]]
Output: [5.0]
Use np.linalg.eigvals(matrix) to compute the eigenvalues.
Use .real followed by np.sort() for the guaranteed-real output.
Sign in to take notes on this problem
Accepts: array
Calculate the eigenvalues of a square matrix whose eigenvalues are guaranteed to be real.
Av=λvHere, A is the input matrix, v is a nonzero eigenvector, and λ is its eigenvalue. Return all eigenvalues in ascending order as a NumPy array of floats.
Input: matrix = [[4, 1], [2, 3]]
Output: [2.0, 5.0]
Explanation: Both values satisfy the characteristic equation of the matrix.
Input: matrix = [[5]]
Output: [5.0]
Use np.linalg.eigvals(matrix) to compute the eigenvalues.
Use .real followed by np.sort() for the guaranteed-real output.
Sign in to take notes on this problem
Accepts: array