id summary reporter owner description type status milestone component version severity resolution keywords cc 9672 PDF and CDF of a laplace distribution throwing domain_error HS Paul A. Bristow "Hello, I would expect the following to behave just like a normal distribution (or a cauchy distribution) at x=+-infinity: {{{ // #define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error #include #include #include #include #include #include static const double INFTY = std::numeric_limits< double >::infinity(); template< typename T > void TestBoundary( const char* distName, const T& t ) { std::printf( ""%15s ---------------------\n"" ""%15s %'*g %'*g\n"", distName, ""pdf"", boost::math::pdf( t, -INFTY ), 10, boost::math::pdf( t, INFTY ), 10 ); std::printf( ""%15s %'*g %'*g\n"", ""cdf"", boost::math::cdf( t, -INFTY ), 10, boost::math::cdf( t, INFTY ), 10 ); std::printf( ""%15s %'*g %'*g\n"", ""co-cdf"", boost::math::cdf( boost::math::complement( t, -INFTY ) ), 10, boost::math::cdf( boost::math::complement( t, INFTY ) ), 10 ); }; int main() { std::printf( ""%15s %10s %10s\n"", ""Distribution"", ""x=-infty"", ""x=+infty"" ); double _location = 3.2; double _scale = 0.7; /* TestBoundary( ""Normal"", boost::math::normal_distribution<>( _location, _scale ) ); TestBoundary( ""Cauchy"", boost::math::cauchy_distribution<>( _location, _scale ) ); */ // To NOT throw domain_error exception at infinity? TestBoundary( ""Laplace"", boost::math::laplace_distribution<>( _location, _scale ) ); return EXIT_SUCCESS; } }}} Simply compile with ""g++ filename.cpp"" and obtain the following when the resulting executable is ran: {{{ terminate called after throwing an instance of 'boost::exception_detail::clone_impl >' what(): Error in function boost::math::pdf(const laplace_distribution&, d)): Random variate x is inf, but must be finite! Abort }}} If a random variable is documented to have a domain [-infty, +infty]---notice the closed interval, does it mean that the implementation will honor it (in that it would return the valid PDF or CDF at any value of the domain)---see the line above the graph of the PDF on http://www.boost.org/doc/libs/1_55_0/libs/math/doc/html/math_toolkit/dist_ref/dists/laplace_dist.html; I assumed it meant to say the ""domain of the random variable"" instead of ""the range of the random variable"" (the last expression under ''Non-member Accessors'' paragraph has it right). Thank you.[[br]] HS P.S. The following is from ""git log -2"" inside libs/math: {{{ commit ec438ff39d855f810e236dbaf14b8755f7157869 Author: Beman Date: Sun Dec 1 09:14:12 2013 -0500 End-of-line normalization. Most normalization was taken care of by .gitattributes, but a few files originally committed to svn with incorrect eol tags need explicit normalization. See .gitattributes man page and extensive list discussion. commit fb52d2de42ff7e1cbc61103a25fbc82c5e034a90 Author: John Maddock Date: Thu Oct 24 08:35:41 2013 +0000 Fix initialization of power series so that we don't get a spurious overflow error from tgamma when the res ult is actually zero. [SVN r86415] }}} " Feature Requests closed Boost 1.56.0 math Boost Development Trunk Showstopper fixed laplace