Thanks for your response. I now do the following: MS=MatrixSpace(ComplexField(),2,2) A=MS(0) A[1,1]=5
I was hoping I wouldn't need to make that many changes to the python code, but this would seem to indicate Sage and Python aren't 1-to-1. Unless I'm doing something very wrong, this question can be considered answered. On Mar 14, 11:02 pm, "Justin C. Walker" <jus...@mac.com> wrote: > Hi, and Welcome, > > On Mar 14, 2011, at 20:14 , Ben123 wrote: > > > 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 > > That is correct, although I am at a loss to explain why that's how it is. > > With your matrix, > sage: A[1] > (1, 2) > > so clearly, the rows are "tuples", which are immutable. > > Not all is lost, though: > > sage: A[1,1]=5 > sage: A > [2 1] > [1 5] > > Perhaps someone with a closer understanding of the implementation can explain > the details. > > HTH. > > Justin > > -- > Justin C. Walker, Curmudgeon-At-Large > Institute for the Enhancement of the Director's Income > -------- > When LuteFisk is outlawed, > Only outlaws will have LuteFisk > -------- -- 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