commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <stei...@yahoo.com>
Subject Re: [math] log representaion of sums was:Re: [math] Priorities, help needed
Date Fri, 23 May 2003 14:57:49 GMT

--- Phil Steitz <phil@steitz.com> wrote:
> Brent Worden wrote:
> > 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.
> 
> Can you provide a (ideally web) reference confirming this
> (ideally 
> showing full interval analysis and taking into account
> the way the JVM 
> actually does the multiplication)?  I recall the same
> thing, but I have 
> not been able to locate a reference confirming that the
> error introduced 
> by the log approximation (and exponentiation) is on
> average 
> significantly less.
> 
> > Also, since the log()
> > values are smaller there is less chance of numerical
> overflow with large
> > data sets.
> > 
> This is obvious; but I am not so sure how practially
> important it is 
> given the size of Double.MAX_VALUE.
> 
> > 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.
> > 
> Here again, a web reference and implementation would be
> nice.
> 
> One more thing.  Before deciding to change
> implementation, it would be 
> nice to run some benchmarks (or get some definitive
> references) to see 
> what the performance difference will be. I suspect that
> the sum of logs 
> approach may actually be slower, but I have no idea by
> how much.
> 

Another thing that we need to keep in mind is that using
running sums of logs to represent products will require
special handling for 0's in the data.  This could get quire
messy in the "rolling" implementations.

Phil

> Phil
> 
> > 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.
> >>
> >>
> >>Just some links through Google
> >>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
> > For additional commands, e-mail:
> commons-dev-help@jakarta.apache.org
> > 
> > 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message