In [2]:
X = np.array([[11, 12], [21, 22], [31, 32]])
X
Out[2]:
In [4]:
X = np.array([[1,1,1,1], [1,2,4,8], [1,3,5,7], [1,4,16,32], [1,5,9,13]])
X
Out[4]:
In [11]:
X[1::2, 1:]
Out[11]:
In [12]:
X = np.array([[1,1,1,1], [1,2,4,8], [1,3,5,7],[1,4,16,32],[1,5,9,13]])
X
Out[12]:
In [13]:
X[X%4==0]
Out[13]:
In [16]:
X = np.ones((5,4))
Y = np.zeros((5,4))
np.hstack([X, Y])
Out[16]:
In [17]:
np.arange(1,6)
Out[17]:
In [22]:
np.arange(1,6).reshape(5,1)
Out[22]:
In [23]:
x = np.arange(5)
x
Out[23]:
In [24]:
x[:, np.newaxis] + 1
Out[24]:
In [26]:
10 * (x[:, np.newaxis] + 1)
Out[26]:
In [27]:
10 * (x[:, np.newaxis] + 1) + x
Out[27]:
In [28]:
np.random.seed(0)
X = np.random.random_integers(0, 100, (5,3))
X
Out[28]:
In [30]:
X.max(axis=1)
Out[30]:
In [31]:
plt.scatter(*np.meshgrid(range(5), range(6)));
2.det(cA) = c*det(A)
6.det(A+B) = det(A) + det(B)
9.tr(A)-1(역함수) = tr(A-1(역))
In [32]:
A = np.array([[1,2], [3,4]])
B = np.array([[5,6,], [7,8]])
print(np.linalg.det(3*A), 3*np.linalg.det(A)) #no.2
print(np.linalg.det(A+B), np.linalg.det(A) + np.linalg.det(B)) #no.6
print(np.trace(A), np.trace(np.linalg.inv(A))) #no.9