Esempio n. 1
0
 /**
  * The natural logarithm of the beta function.
  *
  * @param p require p>0
  * @param q require q>0
  * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow
  * @author Jaco van Kooten
  */
 private static function logBeta($p, $q)
 {
     if ($p != self::$logBetaCacheP || $q != self::$logBetaCacheQ) {
         self::$logBetaCacheP = $p;
         self::$logBetaCacheQ = $q;
         if ($p <= 0.0 || $q <= 0.0 || $p + $q > LOG_GAMMA_X_MAX_VALUE) {
             self::$logBetaCacheResult = 0.0;
         } else {
             self::$logBetaCacheResult = self::logGamma($p) + self::logGamma($q) - self::logGamma($p + $q);
         }
     }
     return self::$logBetaCacheResult;
 }