コード例 #1
0
ファイル: Functions.php プロジェクト: linhanwei/TP
 /**
  * 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;
 }