hypergeo {Davies} | R Documentation |
The Hypergeometric and generalized hypergeometric functions as defined by Abramowitz and Stegun.
hypergeo (A, B, C, z, tol = 1e-06, maxiter = 2000, strict=TRUE) hypergeo2(A, B, C, z, tol = 1e-06, maxiter = 2000, strict=TRUE) genhypergeo(U, L, z, tol = 1e-06, maxiter = 2000, strict=TRUE)
A,B,C |
Parameters for hypergeo() |
U,L |
Upper and lower vector parameters for genhypergeo() |
z |
argument |
tol |
absolute tolerance |
maxiter |
Maximum number of iterations |
strict |
Boolean, with default TRUE meaning to return
NA if the series appears not to converge, and FALSE
meaning to return the partial sum |
The hypergeometric function as defined by Abramowitz and Stegun, equation 15.1.1, page 556 is
[omitted; see PDF]
where (a)_n=Gamma(a+n)/Gamma(a) is the Pochammer symbol (6.1.22, page 256).
The generalized hypergeometric function appears from time to time in the literature (eg Mathematica) as
[omitted; see PDF]
where U=(u_1,...,u_i) and L=(l_1,...,l_i) are the “upper” and “lower” vectors respectively.
For the Confluent Hypergeometric function, use genhypergeo()
with
length-1 vectors for arguments U
and V
.
For the 0F1 function (ie no “upper” arguments), use
genhypergeo(NULL,L,x)
.
Abramowitz and Stegun state:
“The radius of convergence of the Gauss hypergeometric series ... is |z|=1” (AMS-55, section 15.1, page 556).
This reference book gives the correct radius of convergence; use the ratio test to verify it. Just to be absolutely specific: if |z|>1, the hypergeometric series will diverge.
However, AMS-55 give a transformation: eqn 15.3.7, page 559 converts a
function of z to one of 1/z. This is used in function
hypergeo2()
; note that values are coerced to complex.
The functions described here are deprecated. For the
hypergeometric function, see function hypergeo()
of the
hypergeo package, which supports a wide range of transformations
and is able to deal with a wide range of special cases of the
parameters
Robin K. S. Hankin
Abramowitz and Stegun 1955. Handbook of mathematical functions with formulas, graphs and mathematical tables (AMS-55). National Bureau of Standards
# equation 15.1.3, page 556: f1 <- function(x){-log(1-x)/x} f2 <- function(x){hypergeo(1,1,2,x)} f3 <- function(x){hypergeo(1,1,2,x,tol=1e-10)} x <- seq(from = -0.6,to=0.6,len=14) f1(x)-f2(x) f1(x)-f3(x) # Note tighter tolerance # equation 15.1.7, p556: g1 <- function(x){log(x + sqrt(1+x^2))/x} g2 <- function(x){hypergeo(1/2,1/2,3/2,-x^2)} g1(x)-g2(x) # should be small abs(g1(x+0.1i) - g2(x+0.1i)) # should have small modulus. # Just a random call, verified by Maple [ Hypergeom([],[1.22],0.9087) ]: genhypergeo(NULL,1.22,0.9087)