On Sun, Oct 4, 2009 at 10:56 PM, rjf <fate...@gmail.com> wrote: > > > > On Oct 4, 12:35 pm, Fredrik Johansson <fredrik.johans...@gmail.com> > wrote: > ...big snip.. which I may respond to later (or not..) > > >> Indeed, without manually setting the precision, >> >> sage: maxima('bfloat(exp(1/%pi^1000)-1)') >> 0.0b0 >> >> which is wrong, and with no indication that it is wrong. > > Actually, it is doing the right thing, which is to compute in the > default precision > (initially 56 bits for about 16 decimal digits), the values of pi, > pi^1000, exp(..) and > the subtraction. It is doing the arithmetic correctly rounded. The > result of doing > the arithmetic correctly rounded in 56-bit arithmetic is 0. If you > want to do the arithmetic in a different precision, try, for example, > fpprec:1000 .
Yes, it does the right thing if that's what it claims to do. (For floating point evaluation in SymPy with every arithmetic operation done using a fixed precision and correct rounding to nearest, you can evaluate it in mpmath.) > bfloat does not claim to do what N[] does in mathematica. SymPy's evalf claims to do (roughly) what N[] does in Mathematica. > It is > plausible that one could obtain similar results by using bfloat in a > loop --- if one computed with a few different fpprec and got the same > value, but such a simple scheme can be defeated. But there are no > guarantees on the accuracy of the RESULT, just best effort to achieve > the accuracy of each operation to (typically) one unit in the last > place or better. > > There ARE problems with maxima 5.18 in that > if you ask is (exp(1/%pi^1000)-1 >0) it returns false ... it > thinks that expression is equal to 0. > > The commercial Macsyma has a decision procedure associated with its > version of "is" computes that the expression is positive. > > in fact it computes > is ((exp > (1/%pi^1000000000000000000000000000000000000000000000000000000000000000)-1) >>0); > in 0.0 milliseconds. That's very nice. Of course, it won't find the answer for any input. > >>So it seems >> that Maxima does not implement any automatic error checking >> whatsoever. Or is there another function that accomplishes this? > > I don't know of one, but someone could make one up with bfloat, if you > want something like what you seem to have programmed. > > Although there are several rigorous interval arithmetic systems > available in Lisp, > none of them have been incorporated in any "automatic" scheme in > Maxima, so far as I know. > > I'm not sure whether this is because of > (a) lack of interest by users > (b) lack of interest in programmers > (c) both? > > ... more snip... > > RJF > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---