
>>> import numpy as np
>>> A = np.array([[1,2,3],[5,2,8],[1,3,5]])
>>> b = np.array([3,2,5])
>>> np.linalg.inv(A)
array([[ 1.55555556,  0.11111111, -1.11111111],
       [ 1.88888889, -0.22222222, -0.77777778],
       [-1.44444444,  0.11111111,  0.88888889]])
>>> np.linalg.inv(A)*b
array([[ 4.66666667,  0.22222222, -5.55555556],
       [ 5.66666667, -0.44444444, -3.88888889],
       [-4.33333333,  0.22222222,  4.44444444]])
>>> np.linalg.inv(A).dot(b)
array([-0.66666667,  1.33333333,  0.33333333])




>>> A = np.array(a)
>>> b = np.array(b)
>>> A
array([[1, 2, 3],
       [5, 2, 8],
       [1, 3, 5]])
>>> B
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'B' is not defined
>>> np.inv(A)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Toshihiro\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py", line 315, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'inv'
>>> A.inv()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'numpy.ndarray' object has no attribute 'inv'
>>> np.linalg.inv(A)
array([[ 1.55555556,  0.11111111, -1.11111111],
       [ 1.88888889, -0.22222222, -0.77777778],
       [-1.44444444,  0.11111111,  0.88888889]])
>>> np.linalg.inv(A)*b
array([[ 4.66666667,  0.22222222, -5.55555556],
       [ 5.66666667, -0.44444444, -3.88888889],
       [-4.33333333,  0.22222222,  4.44444444]])
>>> np.linalg.inv(A).dot(b)
array([-0.66666667,  1.33333333,  0.33333333])
>>>
