Hello. I'm a new user to Sage. I am trying to create a matrix without
knowing the values when it is initialized. All the examples I see have
static matrices like
A = matrix(QQ,2,2,[2,1,1,2])
My goal is to create a 2x2 matrix which I can then give values for
later
A[1][1]=5
However, I am told the vector is immutable. I am unable to find
examples for what I want in the online notebooks such as
http://www.sagenb.org/home/pub/2023/

I don't understand whether I need to specify a matrix space, as in
sage: MS= MatrixSpace(QQ, 3, 3)
sage: A=MS([[1,1,0],[1,2,0],[0,0, 3]])
sage: A
[1 1 0]
[1 2 0]
[0 0 3]
sage: A[1][1]
2
sage: A[1][1]=5
ValueError: vector is immutable; please change a copy instead (use
copy())
sage: B=copy(A)
sage: B[1][1]=4
ValueError: vector is immutable; please change a copy instead (use
copy())
sage: version()
'Sage Version 4.6.1, Release Date: 2011-01-11'

What I want to do is the equivalent to the Python commands
from numpy import *
zm=zeros((5,5),'complex')
zm[1][1]=4

Long term, I have the program written in Python, I'm translating it to
Sage in order to gain arbitrary precision. However, first I need to
figure this first step out.

I'm running Ubuntu 9.10, x64

Thanks in advance

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to