Skip to content

Commit 1ed19b0

Browse files
close #68
1 parent 46ec66a commit 1ed19b0

6 files changed

+19
-17
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "HypergeometricFunctions"
22
uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a"
3-
version = "0.3.21"
3+
version = "0.3.22"
44

55
[deps]
66
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://github.com/JuliaMath/HypergeometricFunctions.jl/workflows/CI/badge.svg)](https://github.com/JuliaMath/HypergeometricFunctions.jl/actions?query=workflow%3ACI) [![codecov](https://codecov.io/gh/JuliaMath/HypergeometricFunctions.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaMath/HypergeometricFunctions.jl) [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaMath.github.io/HypergeometricFunctions.jl/stable) [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaMath.github.io/HypergeometricFunctions.jl/dev)
44

5-
This package provides an implementation of the generalized hypergeometric function `pFq((α1,…,αp), (β1,…,βq), z)`.
5+
This package provides an implementation of the generalized hypergeometric function `pFq(α, β, z)`.
66

77
```julia
88
julia> using HypergeometricFunctions

src/confluent.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# The references to special cases are to NIST's DLMF.
22

33
"""
4-
Compute Kummer's confluent hypergeometric function `₁F₁(a, b; z)`.
4+
Compute Kummer's confluent hypergeometric function `₁F₁(a, b, z)`.
55
"""
66
function _₁F₁(a, b, z; kwds...)
77
z = float(z)
@@ -11,7 +11,7 @@ function _₁F₁(a, b, z; kwds...)
1111
if -a ℕ₀ && real(a) real(b)
1212
return _₁F₁maclaurin(a, b, z; kwds...)
1313
else
14-
return throw(DomainError(b, "M(a, b, z) = ₁F₁(a; b; z) is not defined for negative integer b unless a is a nonpositive integer and a ≥ b."))
14+
return throw(DomainError(b, "M(a, b, z) = ₁F₁(a, b, z) is not defined for negative integer b unless a is a nonpositive integer and a ≥ b."))
1515
end
1616
elseif -a ℕ₀
1717
return _₁F₁maclaurin(a, b, z; kwds...)
@@ -32,12 +32,12 @@ function _₁F₁general(a, b, z; kwds...)
3232
end
3333

3434
"""
35-
Compute Kummer's confluent hypergeometric function `M(a, b, z) = ₁F₁(a, b; z)`.
35+
Compute Kummer's confluent hypergeometric function `M(a, b, z) = ₁F₁(a, b, z)`.
3636
"""
3737
const M = _₁F₁
3838

3939
"""
40-
Compute Tricomi's confluent hypergeometric function `U(a, b, z) ∼ z⁻ᵃ ₂F₀((a, a-b+1), (); -z⁻¹)`.
40+
Compute Tricomi's confluent hypergeometric function `U(a, b, z) ∼ z⁻ᵃ ₂F₀((a, a-b+1), (), -z⁻¹)`.
4141
"""
4242
function U(a, b, z; kwds...)
4343
return z^-a*pFq((a, a-b+1), (), -inv(z); kwds...)

src/gauss.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# The references to special cases are to Table of Integrals, Series, and Products, § 9.121, followed by NIST's DLMF.
22

33
"""
4-
Compute the Gauss hypergeometric function `₂F₁(a, b, c; z)`.
4+
Compute the Gauss hypergeometric function `₂F₁(a, b, c, z)`.
55
"""
66
function _₂F₁(a, b, c, z; method::Symbol = :general, kwds...)
77
z = float(z)
@@ -58,7 +58,7 @@ function _₂F₁(a, b, c, z; method::Symbol = :general, kwds...)
5858
end
5959

6060
"""
61-
Compute the Gauss hypergeometric function `₂F₁(a, b, c; z)` with positive parameters a, b, and c and argument 0 ≤ z ≤ 1. Useful for statisticians.
61+
Compute the Gauss hypergeometric function `₂F₁(a, b, c, z)` with positive parameters a, b, and c and argument 0 ≤ z ≤ 1. Useful for statisticians.
6262
"""
6363
function _₂F₁positive(a, b, c, z; kwds...)
6464
@assert a > 0 && b > 0 && c > 0 && 0 z 1
@@ -70,7 +70,7 @@ function _₂F₁positive(a, b, c, z; kwds...)
7070
end
7171

7272
"""
73-
Compute the Gauss hypergeometric function `₂F₁(a, b, c; z)` with general parameters a, b, and c.
73+
Compute the Gauss hypergeometric function `₂F₁(a, b, c, z)` with general parameters a, b, and c.
7474
This polyalgorithm is designed based on the paper
7575
7676
> N. Michel and M. V. Stoitsov, [Fast computation of the Gauss hypergeometric function with all its parameters complex with application to the Pöschl–Teller–Ginocchio potential wave functions](https://doi.org/10.1016/j.cpc.2007.11.007), *Comp. Phys. Commun.*, **178**:535–551, 2008.
@@ -100,7 +100,7 @@ function _₂F₁general(a, b, c, z; kwds...)
100100
end
101101

102102
"""
103-
Compute the Gauss hypergeometric function `₂F₁(a, b, c; z)` with general parameters a, b, and c.
103+
Compute the Gauss hypergeometric function `₂F₁(a, b, c, z)` with general parameters a, b, and c.
104104
This polyalgorithm is designed based on the review
105105
106106
> J. W. Pearson, S. Olver and M. A. Porter, [Numerical methods for the computation of the confluent and Gauss hypergeometric functions](https://doi.org/10.1007/s11075-016-0173-0), *Numer. Algor.*, **74**:821–866, 2017.

src/generalized.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@doc raw"""
2-
pFq(α, β; z)
2+
pFq(α, β, z)
33
Compute the generalized hypergeometric function, defined by
44
```math
5-
{}_pF_q(α, β; z) = \sum_{k=0}^\infty \dfrac{(\alpha_1)_k\cdots(\alpha_p)_k}{(\beta_1)_k\cdots(\beta_q)_k}\dfrac{z^k}{k!},
5+
{}_pF_q(α, β, z) = \sum_{k=0}^\infty \dfrac{(\alpha_1)_k\cdots(\alpha_p)_k}{(\beta_1)_k\cdots(\beta_q)_k}\dfrac{z^k}{k!},
66
```
77
where the series converges and elsewhere by analytic continuation.
88
@@ -79,7 +79,7 @@ end
7979
pFq::AbstractVector, β::AbstractVector, z; kwds...) = pFq(Tuple(α), Tuple(β), z; kwds...)
8080

8181
"""
82-
Compute the generalized hypergeometric function `pFq(α, β; z)` by continued fraction.
82+
Compute the generalized hypergeometric function `pFq(α, β, z)` by continued fraction.
8383
"""
8484
function pFqcontinuedfraction::AbstractVector{S}, β::AbstractVector{U}, z::V) where {S, U, V}
8585
T = promote_type(S, U, V)
@@ -91,7 +91,7 @@ function pFqcontinuedfraction(α::AbstractVector{S}, β::AbstractVector{U}, z::V
9191
end
9292

9393
"""
94-
Compute the generalized hypergeometric function `₃F₂(a₁, 1, 1, b₁, 2; z)`.
94+
Compute the generalized hypergeometric function `₃F₂(a₁, 1, 1, b₁, 2, z)`.
9595
"""
9696
_₃F₂(a₁, b₁, z; kwds...) = _₃F₂(a₁, 1, 1, b₁, 2, z; kwds...)
9797
"""

src/specialfunctions.jl

+5-3
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,10 @@ function Aone(a, b, c, w, m::Int, ϵ)
348348
end
349349

350350
function Bone(a, b, c, w, m::Int, ϵ)
351+
T = promote_type(typeof(a), typeof(b), typeof(c), typeof(w), typeof(m), typeof(ϵ))
351352
βₙ, γₙ = reconeβ₀(a, b, c, w, m, ϵ)*one(w), reconeγ₀(a, b, c, w, m, ϵ)*w
352353
ret, n = βₙ, 0
353-
while abs(βₙ) > 8abs(ret)*eps() || n 0
354+
while abs(βₙ) > 8abs(ret)*eps(real(T)) || n 0
354355
βₙ = (a+m+n+ϵ)*(b+m+n+ϵ)/((m+n+1+ϵ)*(n+1))*w*βₙ + ( (a+m+n)*(b+m+n)/(m+n+1) - (a+m+n) - (b+m+n) - ϵ + (a+m+n+ϵ)*(b+m+n+ϵ)/(n+1) )*γₙ/((m+n+1+ϵ)*(n+1-ϵ))
355356
ret += βₙ
356357
γₙ *= (a+m+n)*(b+m+n)/((m+n+1)*(n+1-ϵ))*w
@@ -412,10 +413,11 @@ function AInf(a, b, c, w, m::Int, ϵ)
412413
end
413414

414415
function BInf(a, b, c, win, m::Int, ϵ)
416+
T = promote_type(typeof(a), typeof(b), typeof(c), typeof(win), typeof(m), typeof(ϵ))
415417
w = win
416418
βₙ, γₙ = recInfβ₀(a, b, c, win, m, ϵ)*one(w), recInfγ₀(a, b, c, win, m, ϵ)*w
417419
ret, n = βₙ, 0
418-
while abs(βₙ) > 8abs(ret)*eps() || n 0
420+
while abs(βₙ) > 8abs(ret)*eps(real(T)) || n 0
419421
βₙ = (a+m+n+ϵ)*(1-c+a+m+n+ϵ)/((m+n+1+ϵ)*(n+1))*w*βₙ + ( (a+m+n)*(1-c+a+m+n)/(m+n+1) - (a+m+n) - (1-c+a+m+n) - ϵ + (a+m+n+ϵ)*(1-c+a+m+n+ϵ)/(n+1) )*γₙ/((m+n+1+ϵ)*(n+1-ϵ))
420422
ret += βₙ
421423
γₙ *= (a+m+n)*(1-c+a+m+n)/((m+n+1)*(n+1-ϵ))*w
@@ -555,7 +557,7 @@ function pFqmaclaurin(a::NTuple{p, S}, b::NTuple{q, U}, z::V; kmax::Int = KMAX)
555557
S₀, S₁ = S₁, S₁+(S₁-S₀)*rₖ
556558
k += 1
557559
end
558-
k < kmax || @warn "Maclaurin approximation to "*pFq2string(Val{p}(), Val{q}())*" reached the maximum degree of "*string(kmax)*"."
560+
k < kmax || @warn "Maclaurin approximation to "*pFq2string(Val(p), Val(q))*" reached the maximum degree of "*string(kmax)*"."
559561
return S₁
560562
end
561563

0 commit comments

Comments
 (0)