|laziness, impatience, and hubris|
Getting Binomial Distribution under Math::Pari (log) and Combinatorial Methodby monkfan (Curate)
|on Mar 23, 2005 at 10:03 UTC||Need Help??|
monkfan has asked for the
wisdom of the Perl Monks concerning the following question:
I am attempting to compute a binomial distribution based on formulation here.
Basically binomial distributions return the probability of an event occuring $k times. In $n attempts, where the probability of it occuring in a single attempt is $p.
I tried two methods that should give the identical result. One subroutine using Math::Pari via its 'binomial' function plus logarithmic function and the other one using brute combinatorial method. In the end it's the log-Math::Pari method which I intended to use, since it is able to handle large number.
But however the result given by log-Math::Pari function is different from the correct combinatorial Method.
What's wrong with my log-Math::Pari subroutine? It seems to me I have constructed log version mathematically in a right way. Or have I used the Math::Pari function wrongly?