fixed ex42
This commit is contained in:
parent
8c2e6145a8
commit
c5a686cbed
11
ex_42.py
11
ex_42.py
|
@ -10,10 +10,13 @@ A = np.array(
|
|||
, [0, 0, 0, 0, 1, 0]
|
||||
])
|
||||
|
||||
eigvalues, eigvectors = np.linalg.eig(A)
|
||||
eigvalues, eigvectors = np.linalg.eigh(A)
|
||||
print(eigvalues)
|
||||
print(eigvectors)
|
||||
|
||||
l_max_i = eigvalues.argmax()
|
||||
l_max = eigvalues[l_max_i]
|
||||
print(l_max_i, l_max)
|
||||
v_max = eigvectors[l_max_i]
|
||||
|
||||
def some_norm(M):
|
||||
|
@ -22,8 +25,8 @@ def some_norm(M):
|
|||
B = A
|
||||
for k in range(1, 21):
|
||||
B = B.dot(A)
|
||||
print(B)
|
||||
print(l_max**k * np.outer(v_max, v_max))
|
||||
print("some kind of error for k =", k, ":", some_norm(B - l_max**k * np.outer(v_max, v_max)))
|
||||
print("some kind of error for k =", k, ":", some_norm(B - l_max**k * np.outer(v_max, v_max)) / l_max**k)
|
||||
|
||||
|
||||
|
||||
print(v_max.argmax())
|
||||
|
|
Loading…
Reference in New Issue
Block a user