Numerical summation of series




> -----Original Message-----
> From: Michel Van den Bergh [mailto:michel.vandenbergh at uhasselt.be]
>

I thought fpprec gave the current number of significant digits of
> bfloats.

No. each bfloat has its own precision.  If you set fpprec:100

then all the following operations will be done in 100-digit arithmetic.
Actually the numbers are stored in a binary form, and something like 335
bits will be used for the fraction part.


> This is not the same as the required precision of a numerical operation
> (which I think
> normally should be less than fpprec, to accomodate for rounding errors).
> Have I misunderstood
> this?

You probably want to specify the "required accuracy" for an answer.  Based
on what the calculation is, you can try to set the precision for
intermediate results needed to achieve that accuracy.

> 
> Perhaps the correct strategy is to temporarily increase fpprec during a
> computation and to reset
> it afterwards?

You could do this. 

The numbers each have their own precision. 
> 

....

> 
> That goes without saying. But then one still has to inform the user that
> an unusual condition has occured.
> Normally this is done by throwing some kind of exception. Or else by
> setting some status variable.

If you have a maxima system, just type 1.0/0.0 to see what happens.

You can also try
 g(x,y):=block([],modedeclare([x,y],float),x/y);
 compile(g);
g(1.0,0.0);

in which case you will probably get a  LISP error message.  This can be
handled by a lisp handler-case construct, which was invented about 20 years
after Maxima was designed.

You can also read about errcatch in the manual, and try errcatch(1.0/0.0),
which will print the error message but return an empty list [].

Good luck