github.com/gopherd/gonum@v0.0.4/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 "github.com/gopherd/gonum/mathext/internal/gonum"
     8  
     9  // Beta returns the value of the complete beta function B(a, b). It is defined as
    10  //  Γ(a)Γ(b) / Γ(a+b)
    11  // Special cases are:
    12  //  B(a,b) returns NaN if a or b is Inf
    13  //  B(a,b) returns NaN if a and b are 0
    14  //  B(a,b) returns NaN if a or b is NaN
    15  //  B(a,b) returns NaN if a or b is < 0
    16  //  B(a,b) returns +Inf if a xor b is 0.
    17  //
    18  // See http://mathworld.wolfram.com/BetaFunction.html for more detailed informations.
    19  func Beta(a, b float64) float64 {
    20  	return gonum.Beta(a, b)
    21  }
    22  
    23  // Lbeta returns the natural logarithm of the complete beta function B(a,b).
    24  // Lbeta is defined as:
    25  //  Ln(Γ(a)Γ(b)/Γ(a+b))
    26  // Special cases are:
    27  //  Lbeta(a,b) returns NaN if a or b is Inf
    28  //  Lbeta(a,b) returns NaN if a and b are 0
    29  //  Lbeta(a,b) returns NaN if a or b is NaN
    30  //  Lbeta(a,b) returns NaN if a or b is < 0
    31  //  Lbeta(a,b) returns +Inf if a xor b is 0.
    32  func Lbeta(a, b float64) float64 {
    33  	return gonum.Lbeta(a, b)
    34  }