Ask Your Question

Revision history [back]

The same syntax is almost valid in Sage

sage: A=matrix(4)
sage: A[0,:] = vector([0,1,2,3])
sage: A[1,-2:] = vector([0,1])
sage: A[1,-2:] = vector([13,-3])
sage: A
[ 0  1  2  3]
[ 0  0 13 -3]
[ 0  0  0  0]
[ 0  0  0  0]

A big difference is that in Sage, row/column indices start at 0. I find that using the vector is a bit painful, but I do not know if we can get around.

Vincent

The same syntax is almost valid in Sage

sage: A=matrix(4)
sage: A[0,:] = vector([0,1,2,3])
sage: A[1,-2:] = vector([0,1])
sage: A[1,-2:] = vector([13,-3])
sage: A
[ 0  1  2  3]
[ 0  0 13 -3]
[ 0  0  0  0]
[ 0  0  0  0]

A big difference is that in Sage, row/column indices start at 0. I find that using the vector is a bit painful, but I do not know if we can get around.

Vincent