On Wed, Mar 25, 2009 at 11:39 AM, Christophe Oosterlynck <[email protected]> wrote: > > Any comments on this? > > it's really strange that when getting a vector from the matrix a > >>> b = a[:,0] >> you have to use an extra index when you want to select an element from > that vector b: > >>> b[0][0] > > instead of just b[0] (this gives a list with 1 element...)
No it's not. `b' is also a matrix. So if you just give one argument, you get a list of elements: a[0] (1,0) a[0,0] 1 b[0] (1) b[0,0] 1 Regards, > On Mar 19, 3:39 pm, Christophe Oosterlynck <[email protected]> wrote: >> Hi, >> >> let me dive straight into my problem wit a simple example: >> >> >> a = identity_matrix(ZZ,2,2) >> >> a[0,0] >> >> 1 >> >> vs. >> >> >> a[:,0] >> >> [1] >> [0]>> a[:,0][0] >> >> (1) >> >> So when selecting an element from a matrix by first selecting a row >> and selecting the wanted element in that new 'row object', I don't get >> an element from ZZ but a FreeModuleElement. >> Why is this happening? Is there a way to make my two actions behave >> like selecting an element from the original matrix? >> >> Thanks, >> -- Johan Oudinet --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] 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://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
