JuliaMath / JuliaMath/SpecialFunctions.jl
beta_inc in the degenerate cases
- Dominant language
- Julia
- Stars
- 381
- Forks
- 113
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 1
Description
So we allow one (but not both) of the parameters in `beta_inc` to be zero https://github.com/JuliaMath/SpecialFunctions.jl/blob/d829f0ac1ebab6d339bf8bada710bde50735ee7d/src/beta_inc.jl#L741-L742 but in that case the integrated density degenerate.
In the original version from the NSWC library they have the following error modes
```
! ierr = 1 if a or b is negative
! ierr = 2 if a = b = 0
! ierr = 3 if x < 0 or x > 1
! ierr = 4 if y < 0 or y > 1
! ierr = 5 if x + y /= 1
! ierr = 6 if x = a = 0
! ierr = 7 if y = b = 0
```
but we don't implement mode 6 and 7. Instead, we unconditionally have https://github.com/JuliaMath/SpecialFunctions.jl/blob/d829f0ac1ebab6d339bf8bada710bde50735ee7d/src/beta_inc.jl#L754-L755. @simonbyrne was that a deliberate decision? Should we error out similarly to the original version? The current behavior
```julia
julia> beta_inc(0.0, 2.0, 0.0)
(0.0, 1.0)
```
is a bit odd from a CDF perspective.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.