You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/gauss.jl
+67-26Lines changed: 67 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,9 @@
3
3
"""
4
4
Compute the Gauss hypergeometric function `₂F₁(a, b; c; z)`.
5
5
"""
6
-
function_₂F₁(a, b, c, z)
6
+
function_₂F₁(a, b, c, z; method::Symbol=:general)
7
7
ifreal(b) <real(a)
8
-
return_₂F₁(b, a, c, z) # ensure a ≤ b
8
+
return_₂F₁(b, a, c, z; method = method) # ensure a ≤ b
9
9
elseifisequal(a, c) # 1. 15.4.6
10
10
returnexp(-b*log1p(-z))
11
11
elseifisequal(b, c) # 1. 15.4.6
@@ -47,29 +47,23 @@ function _₂F₁(a, b, c, z)
47
47
elseifisequal(c, 2.5) &&abeqcd(a, b, 1, 1.5)
48
48
returnspeciallog(z)
49
49
end
50
-
return_₂F₁general(a, b, c, z) # catch-all
51
-
end
52
-
53
-
# Special case of (-x)^a*_₂F₁ to handle LogNumber correctly in RiemannHilbert.jl
54
-
functionmxa_₂F₁(a, b, c, z)
55
-
ifisequal(c, 2)
56
-
ifabeqcd(a, b, 1) # 6. 15.4.1
57
-
returnlog1p(-z)
58
-
end
59
-
elseifisequal(c, 4)
60
-
ifabeqcd(a, b, 2)
61
-
return6*(-2+ (1-2/z)*log1p(-z))
62
-
end
50
+
if method ==:positive
51
+
return_₂F₁positive(a, b, c, z)
52
+
else#if method == :general
53
+
return_₂F₁general(a, b, c, z) # catch-all
63
54
end
64
-
return (-z)^a*_₂F₁(a, b, c, z)
65
55
end
66
56
67
57
"""
68
-
Compute the Gauss hypergeometric function `₂F₁(a, b; c; z)` with positive parameters a, b, and c and non-negative argument z. Useful for statisticians.
58
+
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.
69
59
"""
70
-
functionpositive₂F₁(a, b, c, z)
60
+
function_₂F₁positive(a, b, c, z)
71
61
@assert a >0&& b >0&& c >0&&0≤ z ≤1
72
-
return_₂F₁maclaurin(a, b, c, z)
62
+
if z ==1
63
+
return_₂F₁argument_unity(a, b, c, float(z))
64
+
else
65
+
return_₂F₁maclaurin(a, b, c, z)
66
+
end
73
67
end
74
68
75
69
"""
@@ -79,12 +73,13 @@ This polyalgorithm is designed based on the paper
79
73
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, Comp. Phys. Commun., 178:535–551, 2008.
80
74
"""
81
75
function_₂F₁general(a, b, c, z)
82
-
T =promote_type(typeof(a), typeof(b), typeof(c), typeof(z))
0 commit comments