
Models with Matrices and Linear Equations 277
4 print "Matrix determinant and multiplication "
5 amat = np.array([[3.11, 5.12, 2.13], [1.21, 8.22, 5.23],
[6.77, 2.88, 7.55]])
6 print "Array amat: "
7 print amat
8 adet = np.linalg.det(amat)
9 print "Determinant of amat: " , adet
10 bmat = np.array([[4.5, 6.5], [8.5, 1.5], [5.25, 7.35]])
11 print bmat
12 dpmat = np.dot(amat, bmat)
13 print "Dot product of amat and bmat: "
14 print dpmat
Executing the Python interpreter and running the program in file
array2d
ops3.py, yields the following output.
$ python array2d_ops3.py
Matrix determinant and multiplication
Array amat:
[[ 3.11 5.12 2.13]
[ 1.21 8.22 5.23]
[ 6.77 ...