On 6/20/07, Marshall Hampton <[EMAIL PROTECTED]> wrote: > I now want to do some loops and update certain entries of the matrix. > But the entries seem immutable, e.g. one can do: > > my_matrix[0][0] += 1 > > and the entry is still zero, although no exception seems to be raised. > > So my question is, how can one manipulate individual matrix entries?
To update entries, you should use the [i,j] notation instead of [i][j]: {{{ sage: my_matrix = matrix(3,10, [0r for x in range(30)]) sage: my_matrix[0,0]=1 sage: my_matrix [1 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0] }}} I don't know why you can use one notation and not the other but I'm sure theare are more knowledgeable Matrix people here :) didier --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---