You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Luc Maisonobe <lu...@spaceroots.org> on 2012/08/08 16:58:18 UTC

[math] some more utilities functions

Hi all,

I have encountered some missing functions that are easy to fix in
[math]. I've done it on my local copy but would like your opinion before
committing them.

There are no function to raise a double to an int argument. There are
similar functions to raise an int, a long or a BigDecimal, but not
double. I have added one and arbitrarily choose to put it in FastMath.

There are no function to compute Stirling numbers of the second kind
(they are used in some combinatorial problems, and also appear in some
high order derivatives). I have added one in ArithmeticUtils, with some
lazy evaluation and caching to avoid recomputing them all the time, as
we often need only the smaller ones.

The function to compute binomial coefficients in ArithmeticUtils does
not cache its results. This could be easily added for the smallest
coefficients (I've done that for Striling number as explained in the
paragraph above).

What do you think about these additions?

Luc

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


Re: [math] some more utilities functions

Posted by Phil Steitz <ph...@gmail.com>.
On 8/8/12 7:58 AM, Luc Maisonobe wrote:
> Hi all,
>
> I have encountered some missing functions that are easy to fix in
> [math]. I've done it on my local copy but would like your opinion before
> committing them.
>
> There are no function to raise a double to an int argument. There are
> similar functions to raise an int, a long or a BigDecimal, but not
> double. I have added one and arbitrarily choose to put it in FastMath.

+1 to add this to FastMath
>
> There are no function to compute Stirling numbers of the second kind
> (they are used in some combinatorial problems, and also appear in some
> high order derivatives). I have added one in ArithmeticUtils, with some
> lazy evaluation and caching to avoid recomputing them all the time, as
> we often need only the smaller ones.

+1 to add this.
>
> The function to compute binomial coefficients in ArithmeticUtils does
> not cache its results. This could be easily added for the smallest
> coefficients (I've done that for Striling number as explained in the
> paragraph above).

The computations are trivial for small n, so I am not sure this is
really worth it.
>
> What do you think about these additions?

Sorry for slow response.  Looks like this has already been done now.


One thing to think about is eventually splitting the combinatorial
methods out into a separate package.

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


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