On Aug 17, 5:45 pm, Dan Drake <dr...@kaist.edu> wrote:
> This is now #11699:http://trac.sagemath.org/sage_trac/ticket/11699
>
> I agree with Rob; this probably should be in matrix(), and not in the
> preparser.

Are you thinking of having matrix(s) [with s a string] being
equivalent to

matrix([[eval(a) for a in r.strip().split(" ")] for r in
s.split(";")])

or something like that? It probably needs some cleaning to be tolerant
of more types of whitespace (perhaps it should also accept commas?)
and perhaps it should handle a "\n" as a ";".

The bigger problem is: How do you convert the strings representing
matrix entries to sage? What is going to be the base ring of the
matrix? This determines what to use instead of the "eval" above. Such
problems do not arise in Matlab because of the more limited scope: the
only numerical type is a float (double probably). In Sage it is not so
easy. In fact, you can already see that for matrix([[...],...]), sage
already exhibits surprising behaviour (although perfectly to
specifications):

sage: matrix([[1.00000000000000000000000000000]]).base_ring()
Real Field with 100 bits of precision
sage: matrix([[1.00000000000000000000000000000,1.000]]).base_ring()
Real Field with 53 bits of precision

(the common parent of two floats is the parent of the lower precision
one).

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

Reply via email to