Subject: How robust/accurate is 'floor()' in Maxima?
From: Barton Willis
Date: Wed, 14 Aug 2013 19:51:04 +0000
The source code for floor is in src/nummod.lisp. For constant expressions, the function pretty-good-floor-or-ceiling uses
bfloat using three values for the number of bits (current value, current value + 20, and current value + 40, I think). If these
values do not agree, floor returns a noun form--otherwise the common value is returned. It's easy to invent better schemes,
I think.
So it is possible for floor to return an incorrect value for a constant expression. But I don't have an example. As I
recall, I have tweaked the floor code a few times as users reported errors--if you find a bug in it, please report it.
There is an example of some crazy looking non integer constant expression involving maybe pi and roots that is very
close to an integer--it's pretty cute, but I can't locate it....
--Barton
________________________________________
On 8/14/2013 9:34 AM, Henry Baker wrote:
> I've noticed that floor(expression) attempts to evaluate 'expression'
> to an actual integer.
>
> How good is it?
>
> Does floor ask bfloat to compute enough precision, and then come back
> again with more?
Depending on what the expression includes, the determination of what is
"enough precision" may be
undecidable.. Bill Gosper has written stuff for algebraic expressions,
but I think that got into
Macsyma not Maxima. And I don't know if floor used it.
Basically you need some theorems to show that if an expression in a
certain class is less than
a certain small quantity, then that expression is equivalent to zero.
>
> Is there any way to achieve this kind of evaluation, other than programming
> it myself?
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima