Re: [Boost-bugs] [Boost C++ Libraries] #11395: Beta Binonial Distriction/ log beta / boost::math::beta not usable when the result would be very small (was: boost::math::beta not working for large a, b values)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11395: Beta Binonial Distriction/ log beta / boost::math::beta not usable when the result would be very small (was: boost::math::beta not working for large a, b values)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-15 18:18:36


#11395: Beta Binonial Distriction/ log beta / boost::math::beta not usable when the
result would be very small
--------------------------------------------+-------------------------
  Reporter: Oli Quinet <quinet.olivier@…> | Owner: johnmaddock
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: math
   Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------------+-------------------------
Changes (by johnmaddock):

 * type: Patches => Feature Requests

Comment:

 OK, I'm changing this to a feature request, since beta is returning the
 correct value (0) in the case you give, as the result is outside the range
 of a double.

 If you expect less error from using logs then you will be *very*
 disappointed: {{{ exp(a-b) }}} is the classic example that *causes*
 cancellation error. In the extreme case where a and b are close in value,
 ''you will get no significant digits correct in the result.'' This is
 true, even when a and b are correct to 0.5ulp - and typically they will
 have much larger error than that. This is why we go to great lengths to
 avoid computing via logs everywhere in Boost.Math - the errors produced
 are typically several orders of magnitude lower.

 However, without investigating this much more in depth than I have time
 for at present, it does look like you're stuck with logs, suggest you use
 the alternate form listed here:
 http://www.wolframalpha.com/input/?i=Binomial[n%2Ck]+*+Beta[k%2Ba%2C+n-k%2Bb]+%2F+Beta[a%2Cb]
 and use lgamma (check I typed the equations correctly though!!) You will
 also need to do a very careful error analysis to make sure the results
 aren't garbage.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11395#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC