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 commonsmath's implementation instead of writing a few
lines of code.
Nevertheless, I'm for including commonsmath 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 CommonsMath 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, email: devunsubscribe@poi.apache.org
> For additional commands, email: devhelp@poi.apache.org
>
>

To unsubscribe, email: devunsubscribe@poi.apache.org
For additional commands, email: devhelp@poi.apache.org
