Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Incomplete Beta Function ratios Ix(a,b) and Iy(a,b) #165

Merged
merged 26 commits into from
Jun 10, 2019
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/beta_inc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ I_{x}(a,b) = G(a,b) \\int_{0}^{x} t^{a-1}(1-t)^{b-1} dt,
```
and ``I_{y}(a,b) = 1.0 - I_{x}(a,b)``.
given
``B(a,b) = 1/G(a,b) = \\Gamma(a)\\Gamma(b)/\\Gamma(a+b)`` and y = 1.0 - x
``B(a,b) = 1/G(a,b) = \\Gamma(a)\\Gamma(b)/\\Gamma(a+b)`` and ``x+y = 1``.
"""
function beta_inc(a::Float64, b::Float64, x::Float64, y::Float64)
p = 0.0
Expand Down Expand Up @@ -819,8 +819,9 @@ function beta_inc(a::Float64, b::Float64, x::Float64, y::Float64)
return ind ? (q, p) : (p, q)
end

beta_inc(a::Float32,b::Float32,x::Float32,y::Float32) = (Float32(beta_inc(Float64(a),Float64(b),Float64(x),Float64(y))[1]), Float32(beta_inc(Float64(a),Float64(b),Float64(x),Float64(y))[2]))
beta_inc(a::Float16,b::Float16,x::Float16,y::Float16) = (Float16(beta_inc(Float64(a),Float64(b),Float64(x),Float64(y))[1]), Float16(beta_inc(Float64(a),Float64(b),Float64(x),Float64(y))[2]))
beta_inc(a::Real,b::Real,x::Real,y::Real) = beta_inc(float(a),float(b),float(x),float(y))
beta_inc(a::Integer,b::Float64,x::Integer,y::Float64) = beta_inc(Float64(a),Float64(b),Float64(x),Float64(y))
beta_inc(a::AbstractFloat,b::AbstractFloat,x::AbstractFloat,y::AbstractFloat) = throw(MethodError(beta_inc,(a,b,x,y,"")))
beta_inc(a::Float64, b::Float64, x::Float64) = beta_inc(a, b, x, 1.0 - x)
beta_inc(a::Float32, b::Float32, x::Float32, y::Float32) = (Float32(beta_inc(Float64(a), Float64(b), Float64(x), Float64(y))[1]), Float32(beta_inc(Float64(a), Float64(b), Float64(x), Float64(y))[2]))
Sumegh-git marked this conversation as resolved.
Show resolved Hide resolved
beta_inc(a::Float16, b::Float16, x::Float16, y::Float16) = (Float16(beta_inc(Float64(a), Float64(b), Float64(x), Float64(y))[1]), Float16(beta_inc(Float64(a), Float64(b), Float64(x), Float64(y))[2]))
beta_inc(a::Real, b::Real, x::Real, y::Real) = beta_inc(float(a), float(b), float(x), float(y))
Sumegh-git marked this conversation as resolved.
Show resolved Hide resolved
beta_inc(a::Integer, b::Float64, x::Integer, y::Float64) = beta_inc(Float64(a), Float64(b), Float64(x), Float64(y))
Sumegh-git marked this conversation as resolved.
Show resolved Hide resolved
beta_inc(a::AbstractFloat, b::AbstractFloat, x::AbstractFloat, y::AbstractFloat) = throw(MethodError(beta_inc,(a, b, x, y,"")))
Sumegh-git marked this conversation as resolved.
Show resolved Hide resolved