1.random.rand(n,n)
產生一個n×n的隨機數組
2.mat(random.rand(n,n))
mat方法可以將數組轉化成爲矩陣
3.Mat.I
求矩陣Mat的逆矩陣
4.eye(4,4)
生成n×n單位矩陣
#first.py from numpy import * #build 4x4 rand matrix print random.rand(4,4) print '============' randMat = mat(random.rand(4,4)) #randMat.I randMat print 'randMat:' print randMat print 'randMat.I:' print randMat.I #randMat.I solve the inverse of a matrix myEye = randMat*randMat.I print myEye #eye function create an identity matrix of n print eye(4,4)