Когда у меня возникает вопрос, подобный этому, я пытаюсь найти справочник в справке:
>>> [w for w in dir(Matrix) if 'op' in w and not w.startswith('_')]
[col_op, copy, copyin_list, copyin_matrix, elementary_col_op, elementary_row_op,
row_op, zip_row_op]
>>> help(Matrix.row_op)
Help on method row_op in module sympy.matrices.dense:
row_op(self, i, f) unbound sympy.matrices.dense.MutableDenseMatrix method
In-place operation on row ``i`` using two-arg functor whose args are
interpreted as ``(self[i, j], j)``.
...
>>> help(Matrix.elementary_row_op)
Help on method elementary_row_op in module sympy.matrices.matrices:
elementary_row_op(self, op='n->kn', row=None, k=None, row1=None, row2=None) unbound
sympy.matrices.dense.MutableDenseMatrix method
Performs the elementary row operation `op`.
`op` may be one of
* "n->kn" (row n goes to k*n)
* "n<->m" (swap row n and row m)
* "n->n+km" (row n goes to row n + k*row m)
Parameters
==========
op : string; the elementary row operation
row : the row to apply the row operation
k : the multiple to apply in the row operation
row1 : one row of a row swap
row2 : second row of a row swap or row "m" in the row operation
"n->n+km"
Похоже, можно использовать любой из них.
>>> m = Matrix([[3,2,2],[1,2,3]])
>>> m.row_op(0, lambda x, j: x/2)
>>> m
Matrix([
[3/2, 1, 1],
[ 1, 2, 3]])
>>> m.row_op(0, lambda x, j: x/(3/2))
>>> m
Matrix([
[1, 2/3, 2/3],
[1, 2, 3]])
или
>>> m = Matrix([[3,2,2],[1,2,3]])
>>> m.elementary_row_op('n->kn',row1=0,k=1/3)
Matrix([
[1, 2/3, 2/3],
[1, 2, 3]])