>>> randMat=mat(random.rand(4,4))
>>> randMat
matrix([[0.69167291, 0.88622401, 0.6849104 , 0.02836564],
[0.43819917, 0.54033237, 0.48791504, 0.17920281],
[0.84127894, 0.9706528 , 0.62311298, 0.37055221],
[0.89404056, 0.89156142, 0.27524496, 0.4803425 ]])
>>> randMat.I %矩阵求逆
matrix([[ 6.70918115, 43.48913972, -51.7050587 , 23.26618485],
[ -4.37086101, -45.70448189, 49.97634792, -21.24420011],
[ 0.53405057, 15.42478358, -12.90025249, 4.16557722],
[ -4.68079285, -4.95125012, 10.86758981, -4.17818078]])
>>> randMat*randMat.I
matrix([[ 1.00000000e+00, -2.05391260e-15, -3.99680289e-15,
1.66533454e-16],
[ 5.55111512e-16, 1.00000000e+00, 2.22044605e-15,
-1.22124533e-15],
[ 2.22044605e-16, -3.10862447e-15, 1.00000000e+00,
-2.22044605e-16],
[ 8.88178420e-16, -2.22044605e-15, 1.77635684e-15,
1.00000000e+00]])
>>>
%单位矩阵
>>> mat(eye(4))
matrix([[1., 0., 0., 0.],
[0., 1., 0., 0.],
[0., 0., 1., 0.],
[0., 0., 0., 1.]])