commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <>
Subject Re: [math] Greetings from a newcomer (but not to numerics)
Date Sun, 25 May 2003 16:11:12 GMT
Hello Al,

I think any participation concerning quality and soundness of Numerical 
Algorithms will always be needed and welcomed. The math commons 
component is different than most other components because its 
implementation is so involved with using the correct algorithm for a 
numerical calculation. This is seldom a question of a opinion or 
personal taste and (like you say) more deeply rooted in finite-precision 

I think we're starting out with very rudimentary implementations right 
now and working towards both clearly defining numerical accuracy and 
optimizing the design.

I may be a bit overzealous to put things into [math]. My last email 
tended to suggest adding allot more capabilities than are currently 
planed. Phil reclarified these and it help me to get perspective again.

> The Math project shall create and maintain a library of lightweight, 
> self-contained mathematics and statistics components addressing the 
 > most common practical problems not immediately available in the Java
 > programming language or commons-lang. The guiding principles for
 > commons-math will be:
> 1. Real-world application use cases determine priority
> 2. Emphasis on small, easily integrated components rather than large
>    libraries with complex dependencies
> 3. All algorithms are fully documented and follow generally accepted
>    best practices
> 4. In situations where multiple standard algorithms exist, use the
>    Strategy pattern to support multiple implementations
> 5. No external dependencies beyond Commons components and the JDK

I think your observations about legacy code are warranted and (as Phil 
pointed out) its clear now that we initially do now want to replicate 
other entire legacy projects out there and fall into the trap of 
implementing "all kinds" of math functionality when others have 
accomplished that already.

In terms of precision, I can already see simple examples of what you are 
talking about in our code where we calculate moments in Univar.


where if sum << n there will be loss in precision. Say your averaging a 
very large number of very small double values. There will be loss of 
precision that may be problematic.


Al Chou wrote:
> Greetings to the commons-math community!  I emailed Robert Donkin privately a
> few days ago asking, as I take it others have, about the reasoning behind
> creating a numerics library from scratch rather than incorporating an existing
> one.  I think I understand that reasoning now, but despite not wanting to
> dampen anyone's enthusiasm, I do want to caution those who have not done a lot
> of numerical computing that it can very easily be done wrong.  A big reason why
> there's a lot of legacy code in scientific computing is that it's hard to get
> numerical algorithms right, so once you do, there's great inertia towards
> changing anything (there are of course other big reasons, such as the fact that
> many computational scientists are not actually as computer-savvy as they are
> science-savvy, so they're not very facile at creating new code).
> As an example, the high school quadratic formula 
> r = ( -b +- sqrt( b^2 - 4 * a * c ) ) / ( 2 * a )
> is extremely inaccurate, because of finite-precision arithmetic, when
> 4 * a * c << b^2 ,
> because of the subtraction of nearly-equal values.  But in high school they
> never teach you that fact.
> On a more positive note, let me recommend _Numerical Recipes_, _Numerical
> Methods that [Usually] Work_ (which incidentally presents an alternate
> quadratic formula for use in the regime where the traditional one fails), and
> _Real Computing Made REAL_ as easy-to-read and down-to-earth references that
> show how easy it is for the naive implementation to be woefully inadequate as
> well as teach how to do numerical math correctly.
> I'd like to participate in commons-math in an advisory capacity of some sort,
> as I can't in good faith commit to being able to contribute code to the
> project.  Robert indicated that such a role would be useful to the project, so
> I hope you all feel the same!
> Al
> =====
> Albert Davidson Chou
>     Get answers to Mac questions at .
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message