import numpy as np
import sympy as sp
Vec = np.matrix([[1,1,1,5],[1,2,0,3],[2,1,3,12]])
Vec_rref = sp.Matrix(Vec).rref()
print(Vec_rref) ##<-- this code prints the RREF, but i am looking for the code for REF (See below)我已经找到了很多解决RREF的代码,但没有为参考的代码,如果**这是合理的。我开发的代码提供了以下内容:
(Matrix([
[1, 0, 2, 7],
[0, 1, -1, -2],
[0, 0, 0, 0]]), (0, 1))我正在寻找一个应该解决以下问题的代码:
1XXX
REF = 01XX
001X而不是
100X
RREF = 010X
001X新来的和我在一起的家伙们。预先多谢:-)
发布于 2022-01-24 18:59:03
您使用的是渐近函数: rref wich与“缩减行-梯队形式”相关联。您可能需要使用.echelon_form()来代替
import numpy as np
import sympy as sp
from scipy import linalg
Vec = np.matrix([[1,1,1,5],
[1,2,0,3],
[2,1,3,12]])
Vec_rref =sp.Matrix(Vec).echelon_form()
print(Vec_rref)产出:
Matrix([[1, 1, 1, 5], [0, 1, -1, -2], [0, 0, 0, 0]])
https://stackoverflow.com/questions/70838696
复制相似问题