halaman 107

import numpy as np
A = np.matrix([[3, 0, -5], [-1, -3, 4]])
B = np.matrix([[-5, 5, 2], [1, -2, 0]])
A + B
## matrix([[-2,  5, -3],
##         [ 0, -5,  4]])
A = np.matrix([[3, 0, -5], [-1, -3, 4]])
-3 * A
## matrix([[ -9,   0,  15],
##         [  3,   9, -12]])
A = np.matrix([[1, -2,3], [-3, 2, -1]])
B = np.matrix([[0, 2], [1, 1], [2, 0]])
A * B
## matrix([[ 4,  0],
##         [ 0, -4]])
np.transpose(A)
## matrix([[ 1, -3],
##         [-2,  2],
##         [ 3, -1]])
np.transpose(B)
## matrix([[0, 1, 2],
##         [2, 1, 0]])