Big float Round off errors



I did something like this for my "Heun function or whatever" power series I got but with some differences.  I looked at four numbers 

A = log(abs(biggest_pos_term))
B = log(abs(smallest_pos_term))

C = log(abs(biggest_neg_term))
D = log(abs(smallest_neg_term))

That basically gives you the number for fpprec to use.  But you have to compute

fpprec = max(A - B,C - D) and then add some more to that for good measure.  (Keep in mind B and D are negative)

Rich




 ------------Original Message------------
From: Barton Willis <willisb at unk.edu>
To: "Stavros Macrakis" <macrakis at alum.mit.edu>
Cc: "Richard Hennessy" <rvh2007 at comcast.net>, "Maxima List" <maxima at math.utexas.edu>, fateman at cs.berkeley.edu
Date: Wed, May-7-2008 11:48 AM
Subject: Re: [Maxima] Big float Round off errors

macrakis at gmail.com wrote on 05/07/2008 10:09:55 AM:

> >  but if you are having problems summing alternating series, you could 
try
> >  adding up the positive terms separately from the negative ones
> 
> Really?  I would have thought that that would be the *worst* order.
> Isn't it better to combine terms that nearly cancel first, starting
> with the smallest?

Yes, I would generally expect (sum of positive)-(sum negatives) to be
the worst order. But this ordering has one advantage over other
orders: it puts all the subtractive cancellation into a single
difference. So the cost of bounding the subtractive cancellation is
O(1) instead of O(n). If you are going to redo the calculation with a
larger value for fpprec when the error is too big, doing (sum of
positive)-(sum negatives) might be the way to go. The downside is that
you might set fpprec to a value that is larger than it needs to
be--and I suppose there is a O(fpprec^2) penalty for multiplication
and division.

Of course, increasing fpprec beyond the accuracy of the summands
doesn't work. 


Barton