Exactly! And that "re-arranging by hand" I would like to have some tips for,
or preferably some handy CAS routines. My expr is a very big and complicated
structure of mainly cosh and sinh, I know its right because it gives the
right answer for small x. Just larger x cannot be evaluated, very
frustrating...
Anyway, thanks for the B-float tips, for sure nice to play with too.
Bastiaan.
-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of Dan
Sent: Friday, August 06, 2010 4:06 AM
To: Maxima mailing list
Subject: Re: [Maxima] Expressions with exploding factors
On Thu, 5 Aug 2010, Jeffrey Hankins wrote:
> What's numerical hygiene? I searched for it, but didn't find it.
Imagine you have some number a, and you ask a computer to calculate,
in floating point,
a-(1.0-1.0e-50)*a
The computer will first work out (1.0-1.0e-50)*a with limited
precision, introducing an error that is some very small but non-zero
percentage of (1.0-1.0e-50)*a.
The trouble is, when the computer takes the small difference
a-(1.0-1.0e-50)*a, that same "small" error becomes a very large
percentage of the small difference, and the computer gives you an
answer that is wildly wrong.
What you should do, before passing the expression to the computer, is
rearrange it by hand (or perhaps by CAS) to
1.0e-50*a
which doesn't involve taking a small difference between two large
numbers. Then the computer gets it right. That by-hand rearrangement
is an example of "numerical hygiene". It can also refer to more
general rearrangments that reduce the number of individual
floating-point opeartions the computer has to do, to avoid
accumulating rounding errors. Unfortunately, the only detailed
documentation of the use of the term I can find right now is in
unpublished lecture handouts (Dr. Frank H. King's "Computing
Techniques and Applications") from the mid-1990s ;-(.
I mentioned it because Bastiaan's original problem involved taking a
near-unity quotient of two numbers whose logarithms are large, which
is equivalent to taking a small difference between two large numbers.
--
HTH,
Dan
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima