Question: Whats wrong with the code? I keep getting assertion error 4 . 3 [ 2 p t What 2 2 matrix, with integer entries, has

Whats wrong with the code? I keep getting assertion error
4.3[2pt What 22 matrix, with integer entries, has 10 and 25 as eigenvalues with eigenvectors 1,4 and 1,-1, respectively? Store it in the variable matrix_answer.
Hint: Put variables for entries in a 22 array ([a11,a12],[a21,a22]), write out the equations that must be satisfied, and solve for the entires.
In [31]: import numpy as np
A=np.array([141-1])
vals, vecs=np.linalg*eig(A)
if np.iscomplex(vals). any():
vals =vals.real
if np.iscomplex(vecs), any():
vecs = vecs . real
a11=vals[]
a12=vecs[][1]
a21=vecs[1][]
a22=vals[1]
matrix_answer= np.array ([a11a12a21a22])
print (matrix_answer)
 Whats wrong with the code? I keep getting assertion error 4.3[2pt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!