Class LogBeta

java.lang.Object
org.apache.commons.numbers.gamma.LogBeta

public final class LogBeta extends Object
Computes \( log_e B(p, q) \).

This class is immutable.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final double[]
    The coefficients of the series expansion of the \( \Delta \) function.
    private static final double
    The constant value of ½log 2π.
    private static final double
    The threshold value of 10 where the series expansion of the \( \Delta \) function applies.
    private static final double
    The threshold value of 1000 for algorithm switch.
    private static final double
    The threshold value of 2 for algorithm switch.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Private constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static double
    deltaMinusDeltaSum(double a, double b)
    Returns the value of \( \Delta(b) - \Delta(a + b) \), with \( 0 \leq a \leq b \) and \( b \geq 10 \).
    private static double
    logGammaMinusLogGammaSum(double a, double b)
    Returns the value of \( \log ( \Gamma(b) / \Gamma(a + b) ) \) for \( a \geq 0 \) and \( b \geq 10 \).
    private static double
    sumDeltaMinusDeltaSum(double p, double q)
    Returns the value of \( \Delta(p) + \Delta(q) - \Delta(p + q) \), with \( p, q \geq 10 \).
    static double
    value(double p, double q)
    Returns the value of \( \log B(p, q) \) for \( 0 \leq x \leq 1 \) and \( p, q > 0 \).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TEN

      private static final double TEN
      The threshold value of 10 where the series expansion of the \( \Delta \) function applies.
      See Also:
    • TWO

      private static final double TWO
      The threshold value of 2 for algorithm switch.
      See Also:
    • THOUSAND

      private static final double THOUSAND
      The threshold value of 1000 for algorithm switch.
      See Also:
    • HALF_LOG_TWO_PI

      private static final double HALF_LOG_TWO_PI
      The constant value of ½log 2π.
      See Also:
    • DELTA

      private static final double[] DELTA
      The coefficients of the series expansion of the \( \Delta \) function. This function is defined as follows: \[ \Delta(x) = \log \Gamma(x) - (x - \frac{1}{2}) \log a + a - \frac{1}{2} \log 2\pi, \]

      See equation (23) in Didonato and Morris (1992). The series expansion, which applies for \( x \geq 10 \), reads

      \[ \Delta(x) = \frac{1}{x} \sum_{n = 0}^{14} d_n (\frac{10}{x})^{2 n} \]
  • Constructor Details

    • LogBeta

      private LogBeta()
      Private constructor.
  • Method Details

    • deltaMinusDeltaSum

      private static double deltaMinusDeltaSum(double a, double b)
      Returns the value of \( \Delta(b) - \Delta(a + b) \), with \( 0 \leq a \leq b \) and \( b \geq 10 \). Based on equations (26), (27) and (28) in Didonato and Morris (1992).
      Parameters:
      a - First argument.
      b - Second argument.
      Returns:
      the value of \( \Delta(b) - \Delta(a + b) \)
      Throws:
      IllegalArgumentException - if a < 0 or a > b
      IllegalArgumentException - if b < 10
    • sumDeltaMinusDeltaSum

      private static double sumDeltaMinusDeltaSum(double p, double q)
      Returns the value of \( \Delta(p) + \Delta(q) - \Delta(p + q) \), with \( p, q \geq 10 \). Based on the NSWC Library of Mathematics Subroutines implementation, DBCORR.
      Parameters:
      p - First argument.
      q - Second argument.
      Returns:
      the value of \( \Delta(p) + \Delta(q) - \Delta(p + q) \).
      Throws:
      IllegalArgumentException - if p < 10 or q < 10.
    • value

      public static double value(double p, double q)
      Returns the value of \( \log B(p, q) \) for \( 0 \leq x \leq 1 \) and \( p, q > 0 \). Based on the NSWC Library of Mathematics Subroutines implementation, DBETLN.
      Parameters:
      p - First argument.
      q - Second argument.
      Returns:
      the value of \( \log B(p, q) \), or NaN if p <= 0 or q <= 0.
    • logGammaMinusLogGammaSum

      private static double logGammaMinusLogGammaSum(double a, double b)
      Returns the value of \( \log ( \Gamma(b) / \Gamma(a + b) ) \) for \( a \geq 0 \) and \( b \geq 10 \). Based on the NSWC Library of Mathematics Subroutines implementation, DLGDIV.
      Parameters:
      a - First argument.
      b - Second argument.
      Returns:
      the value of \( \log(\Gamma(b) / \Gamma(a + b) \).
      Throws:
      IllegalArgumentException - if a < 0 or b < 10.