
Topher Cooper wrote:
At 05:11 AM 7/12/2006, you wrote:
T distribution(T x) const; // Probability Density Function or pdf or p T cumulative_probability(T x) const; // Cumulative Distribution Function. P
cumulative_probability is too long :-(
Do we REALLY need the cumulative here?
T probability(T x) const; // Cumulative Distribution Function or cdf or P
Sorry, as attractive as it seems at first blush, I think just "probability" is a very poor choice. ...
<explanation about why and discussion about using intervals snipped> I definitely do not want to use the same function name for both the density function and the cumulative probability. Your point about people confusing the meaning of the density function is on the mark, and I think using the same function name will only exacerbate the confusion. Do I would still vote for: double density(double x) const; (Despite the origin of the word "density" from physics, it is definitely used by mathematicians, statisticans, and engineers to mean exactly this. And I agree that the word "distribution" is not a synonym for "density".) On the other hand, I like the idea of using an interval type for the "probability" function and requiring an explicit interval constructor when calling the function, like student_t dist(2.0); double p = dist.probability(interval(-1.0, 2.0)); double q = dist.probability(interval(infinity, -1.0)); To me, syntax like this just makes it easier for me to understand what's going on. And I agree that we shouldn't just use the Boost Interval library. I think we should define an interval class specific to the statistics library, where the left endpoint is allowed to be -infinity and the right endpoint +infinity. Then we get a syntax that is easy to read and understand, and we don't need to come up with a good name for the cumulative or complementary cumulative probability functions.