Ask Your Question

Revision history [back]

See

sage: A[1]
(1, 4, 6)
sage: A[1].is_immutable()
True

You get a vector that is immutable. When you do

sage: A[1][1]=6

you try to change the entry of index 1 of that vector, not the matrix A. The matrix A is mutable:

sage: A.is_mutable()
True

To change the entry of index 1,1 of the matrix A, you should do:

sage: A[1,1]=6

So that

sage: A
[ 1  2 -3]
[ 1  6  6]
[ 2 -1 -2]

See

sage: A[1]
(1, 4, 6)
sage: A[1].is_immutable()
True

You get a vector that is immutable. When you do

sage: A[1][1]=6
A[1][1] = 6

you try to change the entry of index 1 of that vector, not the matrix A. The matrix A is mutable:

sage: A.is_mutable()
True

To change the entry of index 1,1 of the matrix A, you should do:

sage: A[1,1]=6
A[1,1] = 6

So that

sage: A
[ 1  2 -3]
[ 1  6  6]
[ 2 -1 -2]