python_numpy中矩阵的表示方法

  1. np.array[1,2,3,4,]
  2. X=np.mat(‘1,2,3,4;4,5,6,7;7,8,9,10’)
  3. X=np.mat([[1,2,3,4],[4,5,6,7],[7,8,9,10]])
import numpy as np
W=np.array([1,2,3,4])
#X=np.mat('1,2,3,4;4,5,6,7;7,8,9,10')
X=np.mat([[1,2,3,4],[4,5,6,7],[7,8,9,10]])

print(X)
输出结果---
[[ 1  2  3  4]
 [ 4  5  6  7]
 [ 7  8  9 10]]

你可能感兴趣的:(python)