On 8/1/06, sen1 at math.msu.edu <sen1 at math.msu.edu> wrote:
>
> I would like to run certain entire maxima sessions in high precision
> arithmetic.
I'm afraid Maxima doesn't support this currently.
I have tried setting fpprec: 32.
This only affects the precision of bigfloats, that is literals written in
the form xxxByyy e.g. 1.0b0. Literals written as xxxEyyy or xxx.yyy are
interpreted as machine floats.
The numbers get listed as having that precision. But, it seems that
> floating point errors I expect from functions with standard double
> precision are still there. Does every single variable in an
> expression have to be converted?
>
> Is it expected that, once one sets fpprec: 32, all further
> computations, even with previously defined functions, will be at that
> precision?
>
Well, yes and no. The precision of computations does not depend on when
functions were defined. It depends on the precision of the numbers used in
the calculation. For example:
div3(x):=x/3$
div3(1) => 1/3 -- integers/rationals give exact arithmetic
div3(1.0) => 0.33333333333333 -- floats use native floating point
fpprec:15$
div3(1.0b0) => 3.33333333333333b-2
fpprec:30$
div3(1.0b0) => 3.33333333333333333333333333333b-2
Once a number has been read in or calculated at a given precision, changing
fpprec does not change its precision, though new calculations with it result
in the new current precision:
fpprec:4$
third4: 1.0b0/3$
fpprec:10$
third10:1.0b0/3$
third4; 3.333b-1
third4+0.0b0; 3.333358765b-1 (shows effect of rounding to 4
digits)
third10; 3.333333333b-1
third10+0.0b0; 3.333333333b-1
third10-third4; -2.543129085b-6
If you want your calculation to be repeated at different precisions, you
should not use explicit floating-point or bigfloat literals at all; instead,
you should convert exact numbers, e.g.
foo(x) := [ x + bfloat(2/3), x / bfloat(%pi) ]$
Does this make things clearer?
-s