Boost logo

Boost-Commit :

From: pbristow_at_[hidden]
Date: 2007-12-17 10:51:53


Author: pbristow
Date: 2007-12-17 10:51:53 EST (Mon, 17 Dec 2007)
New Revision: 42123
URL: http://svn.boost.org/trac/boost/changeset/42123

Log:
Changed support range to avoid a discontinuity at zero.
Text files modified:
   sandbox/math_toolkit/boost/math/distributions/weibull.hpp | 7 +++++--
   1 files changed, 5 insertions(+), 2 deletions(-)

Modified: sandbox/math_toolkit/boost/math/distributions/weibull.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/distributions/weibull.hpp (original)
+++ sandbox/math_toolkit/boost/math/distributions/weibull.hpp 2007-12-17 10:51:53 EST (Mon, 17 Dec 2007)
@@ -111,7 +111,9 @@
 { // Range of supported values for random variable x.
    // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
    using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>());
+ using boost::math::tools::min_value;
+ return std::pair<RealType, RealType>(min_value<RealType>(), max_value<RealType>());
+ // A discontinuity at x == 0, so only support down to min_value.
 }
 
 template <class RealType, class Policy>
@@ -131,8 +133,9 @@
       return result;
 
    if(x == 0)
+ { // Special case, but x == min, pdf = 1 for shape = 1,
       return 0;
-
+ }
    result = exp(-pow(x / scale, shape));
    result *= pow(x / scale, shape) * shape / x;
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk