2
我想用SymPy中的矩阵切片的值替换。明确地说,这将是像在SymPy中分配矩阵切片
import sympy as sym
A = sym.Matrix(4, 4, range(16))
A[0, :] = [-1, -2, -3, -4]
但这返回一个错误
ShapeError:
The Matrix `value` doesn't have the same dimensions as the in sub-
Matrix given by `key`.
在一个更有趣的例子,我想这样做
A[0, 0::2] = [-1, -2]
A[0, 1::2] = [1, 2]
交替的奇数和偶数列。
问题:在SymPy中有这样做的方法吗?