gonum.org/v1/gonum@v0.14.0/mathext/beta.go (about)

     1  // Copyright ©2016 The Gonum Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package mathext
     6  
     7  import "gonum.org/v1/gonum/mathext/internal/gonum"
     8  
     9  // Beta returns the value of the complete beta function B(a, b). It is defined as
    10  //
    11  //	Γ(a)Γ(b) / Γ(a+b)
    12  //
    13  // Special cases are:
    14  //
    15  //	B(a,b) returns NaN if a or b is Inf
    16  //	B(a,b) returns NaN if a and b are 0
    17  //	B(a,b) returns NaN if a or b is NaN
    18  //	B(a,b) returns NaN if a or b is < 0
    19  //	B(a,b) returns +Inf if a xor b is 0.
    20  //
    21  // See http://mathworld.wolfram.com/BetaFunction.html for more detailed informations.
    22  func Beta(a, b float64) float64 {
    23  	return gonum.Beta(a, b)
    24  }
    25  
    26  // Lbeta returns the natural logarithm of the complete beta function B(a,b).
    27  // Lbeta is defined as:
    28  //
    29  //	Ln(Γ(a)Γ(b)/Γ(a+b))
    30  //
    31  // Special cases are:
    32  //
    33  //	Lbeta(a,b) returns NaN if a or b is Inf
    34  //	Lbeta(a,b) returns NaN if a and b are 0
    35  //	Lbeta(a,b) returns NaN if a or b is NaN
    36  //	Lbeta(a,b) returns NaN if a or b is < 0
    37  //	Lbeta(a,b) returns +Inf if a xor b is 0.
    38  func Lbeta(a, b float64) float64 {
    39  	return gonum.Lbeta(a, b)
    40  }