from sympy import *
matrix = []
print("Enter the entries of the 3x3 matrix:")
for i in range(0,3):
a =[]
for j in range(0,3):
a.append(int(input()))
matrix.append(a)
for i in range(0,3):
for j in range(0,3):
print(matrix[i][j], end = " ")
print()
for i in range(0,3):
for j in range(0,3):
M[i][j]=list(matrix[i][j])
M_rref = M.rref()
print("The Row echelon form of matrix M and the pivot columns : {}".format(M_rref))当我将数组相互传输时,出现了一个错误。我只想把3x3矩阵转换成梯队。TypeError:'int‘对象不可迭代,有时AttributeError:'list’对象没有属性'rref‘
发布于 2022-05-18 19:48:59
只需将matrix转换为SymPy Matrix,如下所示:
from sympy import *
matrix = []
print("Enter the entries of the 3x3 matrix:")
for i in range(0,3):
a =[]
for j in range(0,3):
a.append(int(input()))
matrix.append(a)
for i in range(0,3):
print(matrix[i])
M = Matrix(matrix)
M_rref = M.rref()
print("The Row echelon form of matrix M and the pivot columns : {}".format(M_rref))https://stackoverflow.com/questions/72294977
复制相似问题