On 1/26/12 5:30 AM, Marco Streng wrote:
What would Matlab users think of having to learn the habit of putting
"." behind their integers in Sage, e.g.?

sage: matrix([[1.,2],[3,4]]).base_ring()
Real Field with 53 bits of precision

sage: matrix([[1/1,2],[3,4]]).base_ring()
Rational Field

This would be a possible warning to engineers: "Make sure numbers
contain "." even if they are integers, e.g., type 2. instead of 2 when
you want the number 2. The reason: Sage is used by many kinds of
users. For example, if you type an integer, then Sage may assume that
you are interested only in integers and that you want (slow) exact
arithmetic. Sage will even reply "False" to [1,2;3,4].is_invertible().
Typing a "." behind your integers makes them into nice fast floating
point numbers, so that [1.,2;3,4].is_invertible() does return "True"
as expected."


That's part of the problem pointed out in an earlier message---our RR matrices really are pretty bad for numerical things, but RDF matrices are the way to go (the RDF matrices use standard numerical algorithms for the most part, whereas RR matrices use naive algorithms that can be really bad and slow). This should be fixed, but for right now, RR matrices don't seem to be all that useful compared to RDF matrices.




Do we have good "introduction to Sage for Matlab users", "introduction
to Sage for Maple users", etc.? Those would be a good place for
warnings of this form and "good habits".

Good point.  We should have documentation like this, but don't.

Thanks,

Jason

--
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