Пример #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::$logBetaCache_p || $q != self::$logBetaCache_q) {
         self::$logBetaCache_p = $p;
         self::$logBetaCache_q = $q;
         if ($p <= 0.0 || $q <= 0.0 || $p + $q > LOG_GAMMA_X_MAX_VALUE) {
             self::$logBetaCache_result = 0.0;
         } else {
             self::$logBetaCache_result = self::logGamma($p) + self::logGamma($q) - self::logGamma($p + $q);
         }
     }
     return self::$logBetaCache_result;
 }