Jason Grout wrote: > Based on some conversations with linear algebra people and classroom > demonstrations in a linear algebra class, people are confused that when > they create a matrix with matrix(3, range(9)), for example, that the > echelon_form is not the rref output that they get from most any other > program they have ever used, and certainly not what is taught in an > undergrad linear algebra class. There is additional confusion if the > entries specified have a fraction in them; then the matrix defaults to > being over QQ, and the echelon_form functino gives the expected naive > rref! The problem, of course, lies in the matrix defaulting to having > base_ring == ZZ (i.e., non-field). > > > What do people think about making the default ring for matrices QQ? > Additionally, if the ring R is determined from the elements provided, > then the matrix would be over R.fraction_field(). Of course, the > documentation for matrix() would clearly indicate what is happening if > the ring is not specified. >
More concisely, this proposal could be worded: What do people think of making matrix() return a matrix over a field by default, unless a ring is explicitly specified. The default field would either be the fraction field of the ring containing the specified elements, or would be QQ if no elements are specified. This logic would *only* be applied if a ring is not specified. The documentation of matrix() would also be changed accordingly. > > With this change: > > matrix(3, range(9)) would yield a matrix over QQ because the elements > live in ZZ, and then we call ZZ.fraction_field() to get the base ring of > the matrix. > > matrix(3,3) would yield a matrix over QQ because QQ would be the default > ring if no entries are specified. > > matrix(R,...) would yield a ring over R, since R was explicitly specified. > > Thanks, > > Jason > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---