# commons-dev mailing list archives

##### Site index · List index
Message view
Top
From "Brent Worden" <br...@worden.org>
Subject Re: [math] Priorities, help needed
Date Fri, 23 May 2003 06:39:57 GMT
```The exp(log()) technique is almost always more numerically accurate because
log() significantly reduces the magnitude of large numbers.  Thus, reducing
the chance of significant digit loss when adding.  Also, since the log()
values are smaller there is less chance of numerical overflow with large
data sets.

Another approach I've used to reduce numerical overflow and numerical error
is by employing induction (e.g. recursive) formulas.  For instance, the mean
of n numbers can easily be computed from the mean of the first n-1 numbers
and the n-th number.  Knuth's "The Art of Programming" describes this
formula and attests to its numerical accuracy.  I think one could derive a
induction formula for geometric mean that would exhibit similar numerical
accuracy.

Brent Worden
http://www.brent.worden.org

"Mark R. Diggory" <mdiggory@latte.harvard.edu> wrote in message
news:3ECC037E.6000304@latte.harvard.edu...
> Phil Steitz wrote:
>
> >Yes.  The computation is easy.  The question is is it a)
> >more efficient and/or b) more accurate.  That is what we
> >need to find out.
> >
> >
>
> Details I've seen thus far describe it as more efficient to use the log
> approach. I think your points about accuracy and rounding are strong as
> well.
>
> It really depends on the java.lang.Math approach to log() and exp().
> Both these methods deligate to a native C implimentations deep in JVM.
>
>
> http://mathforum.org/library/drmath/view/52804.html
> http://www.buzzardsbay.org/geomean.htm
> http://www.imsa.edu/edu/math/journal/volume3/articles/AlgebraAverages.pdf
>
> -Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org