Jason Grout wrote:
> 
> I think there are several points here:
> 
> 1. The moment Sage sees a decimal, it starts using approximate, floating 
> point arithmetic.  If you don't want that, then don't use decimals; use 
> fractions.  This is consistent with most mathematical software (though 
> other software may have better algorithms that minimize the effect of 
> the round-off errors).
> 
> 2. Sage currently does not deal very well with round-off error in linear 
> algebra.  This needs to be fixed.  Furthermore, Sage doesn't tell you 
> (like matlab *sometimes* does) when round-off error might be a big 
> issue.  For your matrix, Sage probably should have warned you that 
> round-off error might lead to an incorrect response.
> 
> I've opened up http://trac.sagemath.org/sage_trac/ticket/7392 and 
> http://trac.sagemath.org/sage_trac/ticket/7391 to address specific 
> issues that came up in this thread.  Implementing numerically stable 
> arbitrary precision linear algebra is a much bigger project, so I'm 
> holding off on opening up a ticket until someone starts making it happen.

Thanks. If there's a warning, this is a lot less dangerous.


> Don't use decimals; use fractions.  Then Sage does everything exactly, 
> with no round-off error.

But how would you go about that? You'd have to convert them all by hand, 
which sort of defeats the purpose. It would be nice if we could, say, 
map (lambda x: x.exact_rational()) the matrix, but once the decimal 
number is stored as floating point, its representation is already 
incorrect. For example,

   sage: y = 0.3
   sage: y.exact_rational()
   5404319552844595/18014398509481984

looks like nonsense unless one understands the internals (and most 
people shouldn't).

I admit to not searching very hard, but is there even any mention in the 
docs that this is going to happen as soon as you introduce a decimal point?

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

Reply via email to