Python NumPy6 Linear Algebra Flashcards

(4 cards)

1
Q

Suppose you have two two-dimensional arrays that you want to be treated as matrices. You want to do matrix multiplication with them. How do you do it?

A

A = np.array([[1, 2], [3, 4]])
B = np.array([[5, 6], [7, 8]])
product = np.dot(A,B)
or,
product = A@B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A is a matrix, for example, A = np.array([[1, 2], [3, 4]]). How do you compute its inverse?

A

np.linalg.inv(A)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A is a matrix. How do you compute its determinant?

A

np.linalg.det(A)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you compute the eigenvalues and eigenvectors of a matrix?

A

eigenvalues, eigenvectors = np.linalg.eig(A)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly