In [9]:
    
import numpy as np
import scipy as sp
import scipy.linalg as linalg
    
In [16]:
    
A = sp.matrix([[1,2,3],[3,1,2],[4,5,7]])
a = np.array([[1,2,3],[3,1,2],[4,5,7]])
A, a
    
    Out[16]:
In [13]:
    
A.T, a.T
    
    Out[13]:
In [14]:
    
A.I, linalg.inv(a)
    
    Out[14]:
In [24]:
    
B = np.matrix([2,2,3])
b = np.array([2,2,3])
A*B.T, a.dot(b)
    
    Out[24]:
In [40]:
    
B.T, b[:,np.newaxis]
    
    Out[40]:
In [27]:
    
np.multiply(A,B), a*b
    
    Out[27]:
In [33]:
    
np.multiply(A,B.T), a*b[:,np.newaxis]
    
    Out[33]:
In [54]:
    
a = np.random.randint(low=-10,high=10,size=(100,100))
b = np.random.randint(low=-10,high=10,size=(100))
%timeit linalg.inv(a).dot(b)
    
    
In [55]:
    
%timeit linalg.solve(a,b)
    
    
In [77]:
    
a = np.random.randint(low=0, high=10, size=(2,2))
b = np.random.randint(low=0, high=10, size=2)
a,b
    
    Out[77]:
In [78]:
    
linalg.solve(a,b)
    
    Out[78]:
If there exists a nonzero vector $x$ such that
$Ax = \lambda x$
then $\lambda$ is called $A$'s egenvalues and $x$ is $A$'s eigenvector.
how to find $\lambda$ and $x$:
$Ax = \lambda Ix$ add identidy matrix
$Ax - \lambda Ix = 0$ subtract one side
$(A - \lambda I)x = 0$ factorize
This have a solution when det$(A - \lambda I) = 0$. In case of a 2x2 matrix this gives the equation
$\begin{vmatrix}
\end{vmatrix}
In [79]:
    
help(linalg.eigh)
    
    
In [80]:
    
values, vector = linalg.eigh(a)
values.shape, vector.shape
    
    Out[80]:
In [81]:
    
print(values)
    
    
In [82]:
    
print(vector)