mirror of
https://github.com/gonum/gonum.git
synced 2025-10-16 04:00:48 +08:00
Closes #32
This commit is contained in:
@@ -15,7 +15,7 @@ https://lists.debian.org/debian-legal/2004/12/msg00295.html
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var (
|
var (
|
||||||
badParamOutOfBounds = "cephes: parameter out of bounds"
|
paramOutOfBounds = "cephes: parameter out of bounds"
|
||||||
badParamUnderflow = "cephes: underflow error"
|
badParamUnderflow = "cephes: underflow error"
|
||||||
badParamFunctionSingularity = "cephes: function singularity"
|
badParamFunctionSingularity = "cephes: function singularity"
|
||||||
)
|
)
|
||||||
|
@@ -135,7 +135,7 @@ func Igam(a, x float64) float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if x < 0 || a <= 0 {
|
if x < 0 || a <= 0 {
|
||||||
panic(badParamOutOfBounds)
|
panic(paramOutOfBounds)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Asymptotic regime where a ~ x; see [2].
|
// Asymptotic regime where a ~ x; see [2].
|
||||||
@@ -155,7 +155,7 @@ func Igam(a, x float64) float64 {
|
|||||||
// IgamC computes the complement of the incomplete Gamma integral
|
// IgamC computes the complement of the incomplete Gamma integral
|
||||||
func IgamC(a, x float64) float64 {
|
func IgamC(a, x float64) float64 {
|
||||||
if x < 0 || a <= 0 {
|
if x < 0 || a <= 0 {
|
||||||
panic(badParamOutOfBounds)
|
panic(paramOutOfBounds)
|
||||||
} else if x == 0 {
|
} else if x == 0 {
|
||||||
return 1
|
return 1
|
||||||
} else if math.IsInf(x, 0) {
|
} else if math.IsInf(x, 0) {
|
||||||
|
@@ -78,7 +78,7 @@ func IgamI(a, y0 float64) float64 {
|
|||||||
dithresh := 5.0 * machEp
|
dithresh := 5.0 * machEp
|
||||||
|
|
||||||
if y0 < 0 || y0 > 1 || a <= 0 {
|
if y0 < 0 || y0 > 1 || a <= 0 {
|
||||||
panic(badParamOutOfBounds)
|
panic(paramOutOfBounds)
|
||||||
}
|
}
|
||||||
|
|
||||||
if y0 == 0 {
|
if y0 == 0 {
|
||||||
|
@@ -24,7 +24,7 @@ const (
|
|||||||
// Incbet computes the regularized incomplete beta function.
|
// Incbet computes the regularized incomplete beta function.
|
||||||
func Incbet(aa, bb, xx float64) float64 {
|
func Incbet(aa, bb, xx float64) float64 {
|
||||||
if aa <= 0 || bb <= 0 {
|
if aa <= 0 || bb <= 0 {
|
||||||
panic(badParamOutOfBounds)
|
panic(paramOutOfBounds)
|
||||||
}
|
}
|
||||||
if xx <= 0 || xx >= 1 {
|
if xx <= 0 || xx >= 1 {
|
||||||
if xx == 0 {
|
if xx == 0 {
|
||||||
@@ -33,7 +33,7 @@ func Incbet(aa, bb, xx float64) float64 {
|
|||||||
if xx == 1 {
|
if xx == 1 {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
panic(badParamOutOfBounds)
|
panic(paramOutOfBounds)
|
||||||
}
|
}
|
||||||
|
|
||||||
var flag int
|
var flag int
|
||||||
|
@@ -108,13 +108,13 @@ func Ndtri(y0 float64) float64 {
|
|||||||
|
|
||||||
if y0 <= 0.0 {
|
if y0 <= 0.0 {
|
||||||
if y0 < 0 {
|
if y0 < 0 {
|
||||||
panic(badParamOutOfBounds)
|
panic(paramOutOfBounds)
|
||||||
}
|
}
|
||||||
return math.Inf(-1)
|
return math.Inf(-1)
|
||||||
}
|
}
|
||||||
if y0 >= 1.0 {
|
if y0 >= 1.0 {
|
||||||
if y0 > 1 {
|
if y0 > 1 {
|
||||||
panic(badParamOutOfBounds)
|
panic(paramOutOfBounds)
|
||||||
}
|
}
|
||||||
return math.Inf(1)
|
return math.Inf(1)
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,7 @@ func Zeta(x, q float64) float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if x < 1 {
|
if x < 1 {
|
||||||
panic(badParamOutOfBounds)
|
panic(paramOutOfBounds)
|
||||||
}
|
}
|
||||||
|
|
||||||
if q <= 0 {
|
if q <= 0 {
|
||||||
@@ -90,7 +90,7 @@ func Zeta(x, q float64) float64 {
|
|||||||
panic(badParamFunctionSingularity)
|
panic(badParamFunctionSingularity)
|
||||||
}
|
}
|
||||||
if x != math.Floor(x) {
|
if x != math.Floor(x) {
|
||||||
panic(badParamOutOfBounds) // because q^-x not defined
|
panic(paramOutOfBounds) // because q^-x not defined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user