I'm using the following code to determine the eigenvalues for array A:
A = array([
[1, 2],
[4, 5]
])
eigenvals, eigenvecs = eig(A)
array([-0.46410162, 6.46410162])
When I do the calculation by hand, I have the following:
from matrix A, I have 1 - lambda, 2, and 4, 5 - lambda, which equals (1 - lambda)(4 - lambda) - 2*4 = 0, which results in x^2-3x-4=0
a = 1
b = -3
c = -4
-(-3) +- square root of -3^2 - 4(1)(-4) / 2 = 3 +- square root of 9 + 16 / 2 = 3 +- 5 / 2
equaling = 4 and -1
The python code gave me array([-0.46410162, 6.46410162]) for the eigenvalues, not 4, -1. What did I do wrong?
Your calculations are wrong.
from matrix A, I have 1 - lambda, 2, and 4, 5 - lambda, which equals (1 - lambda)(5 - lambda) - 2*4 = 0, which results in x^2-6x-3=0