cephes

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package cephes implements functions originally in the Netlib code by Stephen Mosher.

Index

Constants

This section is empty.

Variables

View Source
var P0 = [5]float64{
	-5.99633501014107895267e1,
	9.80010754185999661536e1,
	-5.66762857469070293439e1,
	1.39312609387279679503e1,
	-1.23916583867381258016e0,
}

approximation for 0 <= |y - 0.5| <= 3/8

View Source
var P1 = [9]float64{
	4.05544892305962419923e0,
	3.15251094599893866154e1,
	5.71628192246421288162e1,
	4.40805073893200834700e1,
	1.46849561928858024014e1,
	2.18663306850790267539e0,
	-1.40256079171354495875e-1,
	-3.50424626827848203418e-2,
	-8.57456785154685413611e-4,
}

Approximation for interval z = math.Sqrt(-2 log y ) between 2 and 8 i.e., y between exp(-2) = .135 and exp(-32) = 1.27e-14.

View Source
var P2 = [9]float64{
	3.23774891776946035970e0,
	6.91522889068984211695e0,
	3.93881025292474443415e0,
	1.33303460815807542389e0,
	2.01485389549179081538e-1,
	1.23716634817820021358e-2,
	3.01581553508235416007e-4,
	2.65806974686737550832e-6,
	6.23974539184983293730e-9,
}

Approximation for interval z = math.Sqrt(-2 log y ) between 8 and 64 i.e., y between exp(-32) = 1.27e-14 and exp(-2048) = 3.67e-890.

View Source
var Q0 = [8]float64{

	1.95448858338141759834e0,
	4.67627912898881538453e0,
	8.63602421390890590575e1,
	-2.25462687854119370527e2,
	2.00260212380060660359e2,
	-8.20372256168333339912e1,
	1.59056225126211695515e1,
	-1.18331621121330003142e0,
}
View Source
var Q1 = [8]float64{

	1.57799883256466749731e1,
	4.53907635128879210584e1,
	4.13172038254672030440e1,
	1.50425385692907503408e1,
	2.50464946208309415979e0,
	-1.42182922854787788574e-1,
	-3.80806407691578277194e-2,
	-9.33259480895457427372e-4,
}
View Source
var Q2 = [8]float64{

	6.02427039364742014255e0,
	3.67983563856160859403e0,
	1.37702099489081330271e0,
	2.16236993594496635890e-1,
	1.34204006088543189037e-2,
	3.28014464682127739104e-4,
	2.89247864745380683936e-6,
	6.79019408009981274425e-9,
}

Functions

func Hyp2f1 added in v0.17.0

func Hyp2f1(a, b, c, x float64) float64
							hyp2f1.c
 *
 *	Gauss hypergeometric function   F
 *	                               2 1
 *
 *
 * SYNOPSIS:
 *
 * double a, b, c, x, y, hyp2f1();
 *
 * y = hyp2f1( a, b, c, x );
 *
 *
 * DESCRIPTION:
 *
 *
 *  hyp2f1( a, b, c, x )  =   F ( a, b; c; x )
 *                           2 1
 *
 *           inf.
 *            -   a(a+1)...(a+k) b(b+1)...(b+k)   k+1
 *   =  1 +   >   -----------------------------  x   .
 *            -         c(c+1)...(c+k) (k+1)!
 *          k = 0
 *
 *  Cases addressed are
 *	Tests and escapes for negative integer a, b, or c
 *	Linear transformation if c - a or c - b negative integer
 *	Special case c = a or c = b
 *	Linear transformation for  x near +1
 *	Transformation for x < -0.5
 *	Psi function expansion if x > 0.5 and c - a - b integer
 *      Conditionally, a recurrence on c to make c-a-b > 0
 *
 * |x| > 1 is rejected.
 *
 * The parameters a, b, c are considered to be integer
 * valued if they are within 1.0e-14 of the nearest integer
 * (1.0e-13 for IEEE arithmetic).
 *
 * ACCURACY:
 *
 *
 *               Relative error (-1 < x < 1):
 * arithmetic   domain     # trials      peak         rms
 *    IEEE      -1,7        230000      1.2e-11     5.2e-14
 *
 * Several special cases also tested with a, b, c in
 * the range -7 to 7.
 *
 * ERROR MESSAGES:
 *
 * A "partial loss of precision" message is printed if
 * the internally estimated relative error exceeds 1^-12.
 * A "singularity" message is printed on overflow or
 * in cases not addressed (such as x < -1).

func Hys2f1 added in v0.17.0

func Hys2f1(a, b, c, x float64) (s, loss float64)
Defining power series expansion of Gauss hypergeometric function

loss estimates loss of significance upon return.

func Igam

func Igam(a, x float64) float64

Igam computes the incomplete Gamma integral.

Igam(a,x) = (1/ Γ(a)) \int_0^x e^{-t} t^{a-1} dt

The input argument a must be positive and x must be non-negative or Igam will panic.

func IgamC

func IgamC(a, x float64) float64

IgamC computes the complemented incomplete Gamma integral.

IgamC(a,x) = 1 - Igam(a,x)
           = (1/ Γ(a)) \int_0^\infty e^{-t} t^{a-1} dt

The input argument a must be positive and x must be non-negative or IgamC will panic.

func IgamI

func IgamI(a, p float64) float64

IgamI computes the inverse of the incomplete Gamma function. That is, it returns the x such that:

IgamC(a, x) = p

The input argument a must be positive and p must be between 0 and 1 inclusive or IgamI will panic. IgamI should return a positive number, but can return 0 even with non-zero y due to underflow.

func Incbet

func Incbet(aa, bb, xx float64) float64

Incbet computes the regularized incomplete beta function.

func Incbi

func Incbi(aa, bb, yy0 float64) float64

Incbi computes the inverse of the regularized incomplete beta integral.

func Ndtri

func Ndtri(y0 float64) float64

Ndtri returns the argument, x, for which the area under the Gaussian probability density function (integrated from minus infinity to x) is equal to y.

func Zeta

func Zeta(x, q float64) float64

Zeta computes the Riemann zeta function of two arguments.

Zeta(x,q) = \sum_{k=0}^{\infty} (k+q)^{-x}

Note that Zeta returns +Inf if x is 1 and will panic if x is less than 1, q is either zero or a negative integer, or q is negative and x is not an integer.

Note that:

zeta(x,1) = zetac(x) + 1

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL