Skip to content

Commit

Permalink
add Tricomi's U through rational approximation of its asymptotic expa…
Browse files Browse the repository at this point in the history
…nsion
  • Loading branch information
MikaelSlevinsky committed Dec 22, 2021
1 parent 251d422 commit 2b47e2f
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 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.7"
version = "0.3.8"

[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)`, 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)`.
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)`, confluent hypergeometric function is available as `_₁F₁(a, b, z) ≡ HypergeometricFunctions.M(a, b, z)` and `HypergeometricFunctions.U(a, b, z)`, as well as `_₃F₂([a1, a2, a3], [b1, b2], z)`.
2 changes: 1 addition & 1 deletion src/HypergeometricFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export _₁F₁, _₂F₁, _₃F₂, pFq

include("specialfunctions.jl")
include("gauss.jl")
include("kummer.jl")
include("confluent.jl")
include("generalized.jl")
include("drummond.jl")
include("weniger.jl")
Expand Down
22 changes: 22 additions & 0 deletions src/confluent.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
Compute Kummer's confluent hypergeometric function `M(a, b, z) = ₁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

"""
Compute Kummer's confluent hypergeometric function `M(a, b, z) = ₁F₁(a; b; z)`.
"""
const M = _₁F₁

"""
Compute Tricomi's confluent hypergeometric function `U(a, b, z) ∼ z⁻ᵃ ₂F₀([a, a-b+1]; []; -z⁻¹)`.
"""
function U(a, b, z)
return z^-a*pFq([a, a-b+1], typeof(z)[], -inv(z))
end
14 changes: 12 additions & 2 deletions src/generalized.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,18 @@ function pFq(α::AbstractVector, β::AbstractVector, z; kwds...)
return _₁F₁(α[1], β[1], float(z))
elseif length(α) == 2 && length(β) == 1
return _₂F₁(α[1], α[2], β[1], float(z))
elseif abs(z) ρ
return pFqmaclaurin(α, β, float(z); kwds...)
elseif length(α) length(β)
if real(z) 0
return pFqmaclaurin(α, β, float(z); kwds...)
else
return pFqweniger(α, β, float(z); kwds...)
end
elseif length(α) == length(β) + 1
if abs(z) ρ
return pFqmaclaurin(α, β, float(z); kwds...)
else
return pFqweniger(α, β, float(z); kwds...)
end
else
return pFqweniger(α, β, float(z); kwds...)
end
Expand Down
12 changes: 0 additions & 12 deletions src/kummer.jl

This file was deleted.

3 comments on commit 2b47e2f

@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/51053

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.8 -m "<description of version>" 2b47e2f3cdad38d54154fc06e35bfb25ac16f7a3
git push origin v0.3.8

@linqiu15
Copy link

Choose a reason for hiding this comment

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

Thanks for immediate and kind commit for hypergeometricU function which is what I really need now, MikaelSlevinsky.But unstability occurs for small z. I compare the function you write with the function built-in Mathematica by MathLink.jl. And this difference shows as the picture. I would if there's any need of tuning , at least for small z case
!Thanks again!
Difference between julia and Mathematica
.

Please sign in to comment.