Beta (Apache Commons Math 3.3 API)

org.apache.commons.math3.special

## Class Beta

- java.lang.Object
- - org.apache.commons.math3.special.Beta

-     public class Beta
      extends Object

  This is a utility class that provides computation methods related to the Beta family of functions.

  Implementation of `logBeta(double, double)` is based on the algorithms described in

  - Didonato and Morris (1986), Computation of the Incomplete Gamma Function Ratios and their Inverse, TOMS 12(4), 377-393,
  - Didonato and Morris (1992), Algorithm 708: Significant Digit Computation of the Incomplete Beta Function Ratios, TOMS 18(3), 360-373,
  and implemented in the NSWC Library of Mathematical Functions, available here. This library is "approved for public release", and the Copyright guidance indicates that unless otherwise stated in the code, all FORTRAN functions in this library are license free. Since no such notice appears in the code these functions can safely be ported to Commons-Math.
  Version:
    $Id: Beta.java 1546350 2013-11-28 11:41:12Z erans $

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static double` | `logBeta(double p, double q)` Returns the value of log B(p, q) for 0 ≤ x ≤ 1 and p, q > 0.
    `static double` | `logBeta(double a, double b, double epsilon, int maxIterations)` Deprecated. as of version 3.1, this method is deprecated as the computation of the beta function is no longer iterative; it will be removed in version 4.0. Current implementation of this method internally calls `logBeta(double, double)`.
    `static double` | `regularizedBeta(double x, double a, double b)` Returns the regularized beta function I(x, a, b).
    `static double` | `regularizedBeta(double x, double a, double b, double epsilon)` Returns the regularized beta function I(x, a, b).
    `static double` | `regularizedBeta(double x, double a, double b, double epsilon, int maxIterations)` Returns the regularized beta function I(x, a, b).
    `static double` | `regularizedBeta(double x, double a, double b, int maxIterations)` Returns the regularized beta function I(x, a, b).

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### regularizedBeta

          public static double regularizedBeta(double x,
                               double a,
                               double b)

      Returns the regularized beta function I(x, a, b).
      Parameters:
        `x` - Value.
        `a` - Parameter `a`.
        `b` - Parameter `b`.
      Returns:
        the regularized beta function I(x, a, b).
      Throws:
        `MaxCountExceededException` - if the algorithm fails to converge.

    - #### regularizedBeta

          public static double regularizedBeta(double x,
                               double a,
                               double b,
                               double epsilon)

      Returns the regularized beta function I(x, a, b).
      Parameters:
        `x` - Value.
        `a` - Parameter `a`.
        `b` - Parameter `b`.
        `epsilon` - When the absolute value of the nth item in the series is less than epsilon the approximation ceases to calculate further elements in the series.
      Returns:
        the regularized beta function I(x, a, b)
      Throws:
        `MaxCountExceededException` - if the algorithm fails to converge.

    - #### regularizedBeta

          public static double regularizedBeta(double x,
                               double a,
                               double b,
                               int maxIterations)

      Returns the regularized beta function I(x, a, b).
      Parameters:
        `x` - the value.
        `a` - Parameter `a`.
        `b` - Parameter `b`.
        `maxIterations` - Maximum number of "iterations" to complete.
      Returns:
        the regularized beta function I(x, a, b)
      Throws:
        `MaxCountExceededException` - if the algorithm fails to converge.

    - #### regularizedBeta

          public static double regularizedBeta(double x,
                               double a,
                               double b,
                               double epsilon,
                               int maxIterations)

      Returns the regularized beta function I(x, a, b). The implementation of this method is based on:
      - Regularized Beta Function.
      - Regularized Beta Function.
      Parameters:
        `x` - the value.
        `a` - Parameter `a`.
        `b` - Parameter `b`.
        `epsilon` - When the absolute value of the nth item in the series is less than epsilon the approximation ceases to calculate further elements in the series.
        `maxIterations` - Maximum number of "iterations" to complete.
      Returns:
        the regularized beta function I(x, a, b)
      Throws:
        `MaxCountExceededException` - if the algorithm fails to converge.

    - #### logBeta

          @Deprecated
          public static double logBeta(double a,
                                  double b,
                                  double epsilon,
                                  int maxIterations)

      Deprecated. as of version 3.1, this method is deprecated as the computation of the beta function is no longer iterative; it will be removed in version 4.0. Current implementation of this method internally calls `logBeta(double, double)`.
      Returns the natural logarithm of the beta function B(a, b). The implementation of this method is based on:
      - Beta Function, equation (1).
      Parameters:
        `a` - Parameter `a`.
        `b` - Parameter `b`.
        `epsilon` - This parameter is ignored.
        `maxIterations` - This parameter is ignored.
      Returns:
        log(B(a, b)).

    - #### logBeta

          public static double logBeta(double p,
                       double q)

      Returns the value of log B(p, q) for 0 ≤ x ≤ 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(Beta(p, q))`, `NaN` if `p <= 0` or `q <= 0`.

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.