A linear equation XA = B
, we know the 'X = B * inv(A)'. where A, B, X
are all matrix.
in the matlab it can be solve:
X = B / A
it avoid doing inverse a matrix which is fast. is there any equal form in python using numpy?
A linear equation XA = B
, we know the 'X = B * inv(A)'. where A, B, X
are all matrix.
in the matlab it can be solve:
X = B / A
it avoid doing inverse a matrix which is fast. is there any equal form in python using numpy?
Use numpy linalg.inv function:
import numpy as np
x = np.matmul(b, np.linalg.inv(a))
import numpy as np
a = np.array([[1,7],[2,9]])
b = np.array([[2,6],[7,5]])
# XA = B
# X = BA^-1
x = np.matmul(b,np.linalg.inv(a))