calculating with bfloats (was: stuff not in 5.13 branch)
Subject: calculating with bfloats (was: stuff not in 5.13 branch)
From: sen1 at math.msu.edu
Date: Sat, 4 Aug 2007 23:17:04 -0400 (EDT)
On Sat, 4 Aug 2007, Harald Geyer wrote:
>> One thing I (and I think other users) would very much like to see is a
>> global key which transparently turns on and off arbitrary
>> precision. I realize that this may require redoing some intrinsic
>> functions, so it may take time to do. Are any of the current lisps
>> set up to do this?
>
> This is not a matter of the lisp implementation. AFAIK bfloats are
> implemented entirely within the maxima source.
>
> If you don't use floats (use rationals instead) you get exact
> arithmetic by default.
Can't use rationals since square roots occur.
>
> I think the main change would be to make the parser read floats as
> bfloats. I don't really see the point of that.
>
>> I have tried to work on individual variables and functions (at this
>> point involving algebraic functions no worse than square roots) by
>> declaring all variables and functions to be bfloat, but for some
>> reason it doesn't work. Certain of the operations still come back as
>> float. Maybe the square root is the problem. I have been using
>> cmucl. Is that a potential problem?
>
> Do you have example sessions, that show this behaviour? Probably there
> are some bugs. I'd fix the bugs rather than inventing a new global
> switch.
>
> The only problem I'm aware of in this context is the numer flag.
> But you shouldn't need to use that, if you work with bfloats from
> the beginning.
>
> HTH,
> Harald
>
My code is long and complicated. It involves polynomials of degree
2^(2^d) with d = 10 or 15. (They come from composing degree
two polynomials 10 or 15 times). Many of the coefficients are
exponentially small, but I can't know that in advance. Trying to
work symbolically, the routines take a very long time --probably
doing things which are irrelevant like adding and subtracting terms of order
10^(-75). When I hit the terms with float or bfloat, they finish in
a reasonable amount of time, but don't seem to be very different.
I played with things like 1e-(200)*3^200 and the precision is
there, so I don't know why I don't see a difference with bfloats
instead of floats.
I thought if I could control the bfloat order in everything, then I
could get more accurate results but which would actually finish in a
reasonable amount of time.
I'll play some more and see what I can get.
Thanks for your answer.
-sen
--
---------------------------------------------------------------------------
| Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu |
| Mathematics Department | |
| Michigan State University | telephone: 517-355-9684 |
| E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 |
---------------------------------------------------------------------------