# -*- coding: utf-8 -*-
"""
Created on Tue May 21 23:23:16 2019
@author: User
"""
import numpy as np
m1=np.mat([[1,2,3],[4,5,6]])
print('\nm1:')
print(m1)
print(m1 * 8)
m2=np.mat([[1,2,3],[4,5,6],[7,8,9]])
print('\nm2:')
print(m2)
print('\nm1 * m2:')
print(m1 * m2)
print(m2.I)
运行:
m1: [[1 2 3] [4 5 6]] [[ 8 16 24] [32 40 48]]
m2: [[1 2 3] [4 5 6] [7 8 9]]
m1 * m2: [[30 36 42] [66 81 96]] [[-4.50359963e+15 9.00719925e+15 -4.50359963e+15] [ 9.00719925e+15 -1.80143985e+16 9.00719925e+15] [-4.50359963e+15 9.00719925e+15 -4.50359963e+15]]