【发布时间】:2021-03-12 09:15:01
【问题描述】:
我在笔记本中有一个矩阵(在 Sage 中) - 通过 Jupyter。
如何在 Sage 中找到这个矩阵的大小? 我知道在 Python 中我可以找到列表的长度
len(list)
在 Sage 中是否有一个函数可以做到这一点,但使用矩阵? 有点像
len(matrix)
我尝试的例子:
len([1, 2, 3])
3
len(matrix([[1, 2, 3], [4, 5, 6]]))
TypeError: object of type sage.matrix.matrix_integer_dense.Matrix_integer_dense' has no len()
同理:
aMatrix = matrix([[1, 2, 3], [4, 5, 6]])
aMatrix
len(aMatrix)
谢谢!感谢任何帮助。
【问题讨论】:
-
感谢您的帮助;再次 - 真的很欣赏它。 //祝您和未来的读者周末愉快!
标签: arrays python-3.x matrix jupyter-notebook sage