import numpy as np
n1 = np.random.randint(0,10,size=(3,4))
print(n1)
运行结果:
[[9 4 8 3]
[8 3 2 1]
[1 3 6 4]]
print(n1+2)
运行结果:
[[11 6 10 5]
[10 5 4 3]
[ 3 5 8 6]]
print(n1*2)
运行结果:
[[18 8 16 6]
[16 6 4 2]
[ 2 6 12 8]]
print(n1**2)
运行结果:
[[81 16 64 9]
[64 9 4 1]
[ 1 9 36 16]]
“”"
矩阵乘以矩阵
“”"
n2 = np.random.randint(10,20,size=(4,3))
print(n2)