Skip to content

Commit

Permalink
case out Kummer
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelSlevinsky committed Dec 15, 2021
1 parent d904ae6 commit 251d422
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "HypergeometricFunctions"
uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a"
version = "0.3.6"
version = "0.3.7"

[deps]
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

A Julia package for calculating hypergeometric functions

This package implements the generalized hypergeometric function `pFq([a1,…,am], [b1,…,bn], z)`. In particular, the Gauss hypergeometric function is available as `_₂F₁(a, b, c, z)`, and also `_₃F₂([a1, a2, a3], [b1, b2], z)`.
This package implements the generalized hypergeometric function `pFq([a1,…,am], [b1,…,bn], z)`. In particular, the Gauss hypergeometric function is available as `_₂F₁(a, b, c, z)`, Kummer's confluent hypergeometric function is available as `_₁F₁(a, b, z)` and `HypergeometricFunctions.M(a, b, z)`, as well as `_₃F₂([a1, a2, a3], [b1, b2], z)`.
3 changes: 2 additions & 1 deletion src/HypergeometricFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ module HypergeometricFunctions

using DualNumbers, LinearAlgebra, SpecialFunctions

export _₂F₁, _₃F₂, pFq
export _₁F₁, _₂F₁, _₃F₂, pFq

include("specialfunctions.jl")
include("gauss.jl")
include("kummer.jl")
include("generalized.jl")
include("drummond.jl")
include("weniger.jl")
Expand Down
2 changes: 2 additions & 0 deletions src/generalized.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ function pFq(α::AbstractVector, β::AbstractVector, z; kwds...)
return exp(z)
elseif length(α) == 1 && length(β) == 0
return exp(-α[1]*log1p(-z))
elseif length(α) == 1 && length(β) == 1
return _₁F₁(α[1], β[1], float(z))
elseif length(α) == 2 && length(β) == 1
return _₂F₁(α[1], α[2], β[1], float(z))
elseif abs(z) ρ
Expand Down
12 changes: 12 additions & 0 deletions src/kummer.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
Compute Kummer's confluent hypergeometric function `₁F₁(a; b; z)`.
"""
function _₁F₁(a, b, z)
if real(z) 0
return _₁F₁maclaurin(a, b, z)
else
return exp(z)*_₁F₁(b-a, b, -z)
end
end

const M = _₁F₁
13 changes: 12 additions & 1 deletion src/specialfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function unsafe_gamma(x::BigFloat)
return z
end
unsafe_gamma(z::Dual) = (r = realpart(z);w = unsafe_gamma(r); dual(w, w*digamma(r)*dualpart(z)))
unsafe_gamma(z) = gamma(z)
unsafe_gamma(z) = gamma(z)
"""
@lanczosratio(z, ϵ, c₀, c...)
Expand Down Expand Up @@ -492,6 +492,17 @@ function _₂F₁taylor(a::Number, b::Number, c::Number, z::Number)
return S₁
end

function _₁F₁maclaurin(a::Number, b::Number, z::Number)
T = float(promote_type(typeof(a), typeof(b), typeof(z)))
S₀, S₁, j = one(T), one(T)+a*z/b, 1
while errcheck(S₀, S₁, 10eps(real(T))) || j 1
rⱼ = (a+j)/((b+j)*(j+1))
S₀, S₁ = S₁, S₁+(S₁-S₀)*rⱼ*z
j += 1
end
return S₁
end

function _₃F₂maclaurin(a₁, a₂, a₃, b₁, b₂, z)
T = float(promote_type(typeof(a₁), typeof(a₂), typeof(a₃), typeof(b₁), typeof(b₂), typeof(z)))
S₀, S₁, j = one(T), one(T)+(a₁*a₂*a₃*z)/(b₁*b₂), 1
Expand Down

2 comments on commit 251d422

@MikaelSlevinsky
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/50623

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.7 -m "<description of version>" 251d4221b7d6dccbe00f554948ac582299cee10d
git push origin v0.3.7

Please sign in to comment.