Description Usage Arguments Details Value Examples
Gauss' hypergeometric function 2F1 is an infinite series defined as
_2F_1(α, β; γ; z) = ∑_{k=0}^{∞} \frac{(α)_k (β)_k}{(γ)_k} \frac{z^k}{k!}
where the Pochhammer symbol (λ)_k is employed, that is (λ)_0 = 1 and
(λ)_k = λ (λ + 1) (λ + 2) … (λ + k - 1)
This series converges for |z| < 1 and can be analytically continued into the whole complex plane.
1 | sp.hypergeom(a, b, c, z)
|
a,b,c |
real parameters. |
z |
real or complex variable. |
The hypergeometric function is difficult to compute in one program because the four arguments need special care in different situations. Basically, the converging series is used together with recurrence relations and handling of special cases.
Returns the result of the function evaluation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | hgf <- sp.hypergeom
## Hypergeometric function sometimes assume rational numbers:
hgf(1/3, 2/3, 5/6, 27/32) # [1] 1.6 = 8/5
hgf(1/4, 1/2, 3/4, 80/81) # [1] 1.8 = 9/5
## F(1, 1, 1, z) = F(1, 2, 2, z) = 1 /(1-z)
hgf(1, 1, 1, 1i); hgf(1, 2, 2, 1i) # [1] 0.5+0.5i
## Elliptic integral of the second kind:
k2 <- 1 - 0.5^2
Ek2 <- pi/2 * hgf(-0.5, 0.5, 1, k2)
print(4 * Ek2, digits = 12) # ellipse arc length, a = 1, b = 0.5
# [1] 4.84422411027
## An example of very bad computation:
hgf(0.77, 0.88, 0.81, 0.3694-0.8346i) # true value: 0.6890589-0.6718384i
# [1] -48817.81-6297.21i
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.