Python 官方文档:入门教程 => 点击学习
x = random.rand(3, 3) print(x) print(type(x)) y = mat(x) print(type(y)) print(y)看结果后总结 [[ 0.26258837 0.35011202 0.0
x = random.rand(3, 3)
print(x)
print(type(x))
y = mat(x)
print(type(y))
print(y)
看结果后总结
[[ 0.26258837 0.35011202 0.07962761]
[ 0.41938297 0.12948785 0.89394983]
[ 0.47048468 0.98914349 0.48394062]]
<class 'numpy.ndarray'>
<class 'numpy.matrixlib.defmatrix.matrix'>
[[ 0.26258837 0.35011202 0.07962761]
[ 0.41938297 0.12948785 0.89394983]
[ 0.47048468 0.98914349 0.48394062]]
我们看到一开始随机生成的数组与使用mat函数之后的类型是发生了变化的,尽管他们显示的东西没有什么区别,但是实质上,他们的类型是不同的。用mat函数转换为矩阵之后可以才进行一些线性代数的操作。
--结束END--
本文标题: python中mat()函数
本文链接: https://www.lsjlt.com/news/189576.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0