poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <ye...@dinom.ru>
Subject Re: Commons Math dependency?
Date Mon, 26 Jul 2010 12:39:20 GMT
I didn't realize how simple is the implementation of POISSON until I 
chatted with Josh :) It is really a few lines of code:

         private double probability(int k, double lambda) {
             return Math.pow(lambda, k) * Math.exp(-lambda) / factorial(k);
         }

         private double cumulativeProbability(int x, double lambda) {
             double result = 0;
             for(int k = 0; k <= x; k++){
                 result += probability(k, lambda);
             }
             return result;
         }

It  agrees with Excel, all unit tests in bug #49538 pass and I don't see 
why should use commons-math's implementation instead of writing a few 
lines of code.

Nevertheless, I'm for including commons-math in POI dependencies if we 
need more stat distributions.

Yegor

On Fri, 16 Jul 2010, Yegor Kozlov wrote:
>> Perhaps for now, the best is to copy the implementation of POISSON 
>> from Commons-Math to POI, but if we want to take more stuff I would 
>> seriously consider a jar dependency.
>
> There's the fraction stuff too that I'm interested in. From the look 
> of your list of other functions, I think maybe a jar is the way to go
>
>> I gave a quick look at what can be useful for POI. The left column is 
>> Excel function, the right column is Math's implementation.
>>
> * snip 13 functions *
>
> Looks like we will probably fairly soon want the fraction stuff, and 
> 14 stats functions. Based on everyone's investigations, that does look 
> like probably too large a group to maintain our own hacked, minimal 
> copies of...
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
>


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


Mime
View raw message