|
Boost Users : |
Subject: Re: [Boost-users] [Math] Bug in example code / doc (Binomial Distr.)
From: John Maddock (john_at_[hidden])
Date: 2009-09-05 12:03:00
> Math Toolkit pdf-file, and also at
> http://www.boost.org/doc/libs/1_40_0/libs/math/doc/sf_and_dist/html/math_toolkit/dist/stat_tut/weg/binom_eg/binomial_quiz_example.html
> it is written:
>
> "Probability of getting exactly 11 answers right by chance is
> 2.32831e-010"
>
> I think this is wrong. It rather should be one of these below:
>
> "Probability of getting exactly 11 answers right by chance is 0.000247132"
> or
> "Probability of getting exactly 16 answers right by chance is
> 2.32831e-010"
>
> I have'n checked the underlying source code of this yet;
> ie. maybe it is only a doc error...
>
>
> And this code there seems IMHO to be problematic too:
> "
> int questions = 16; // All the questions in the quiz.
> int answers = 4; // Possible answers to each question.
> double success_fraction = (double)answers / (double)questions; // If a
> random guess.
> // Caution: = answers / questions would be zero (because they are
> integers)!
> binomial quiz(questions, success_fraction);
> "
>
> Shouldn't the second param not simply be the constant p of each item, ie.
> here 0.25,
> even if # of questions is set to a different value, for example 32 ?
> Because 32 / 4, as done above, wouldn't be 0.25 anymore...
I'll investigate as soon as I can, but I'm going to be offline now for a
while...
Paul Bristow might be able to answer this one though... Paul?
HTH, John.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net