# hypergeom

Hypergeometric function

## Syntax

• `hypergeom(a,b,z)` example

## Description

example

````hypergeom(a,b,z)` represents the generalized hypergeometric function.```

## Examples

### Hypergeometric Function for Numeric and Symbolic Arguments

Depending on its arguments, `hypergeom` can return floating-point or exact symbolic results.

Compute the hypergeometric function for these numbers. Because these numbers are not symbolic objects, you get floating-point results.

```A = [hypergeom([1, 2], 2.5, 2), hypergeom(1/3, [2, 3], pi), hypergeom([1, 1/2], 1/3, 3*i)]```
```A = -1.2174 - 0.8330i 1.2091 + 0.0000i -0.2028 + 0.2405i```

Compute the hypergeometric function for the numbers converted to symbolic objects. For most symbolic (exact) numbers, `hypergeom` returns unresolved symbolic calls.

```symA = [hypergeom([1, 2], 2.5, sym(2)), hypergeom(1/3, [2, 3], sym(pi)), hypergeom([1, 1/2], sym(1/3), 3*i)]```
```symA = hypergeom([1, 2], 5/2, 2) hypergeom(1/3, [2, 3], pi) hypergeom([1/2, 1], 1/3, 3i)```

Use `vpa` to approximate symbolic results with the required number of digits:

`vpa(symA,10)`
```ans = - 1.21741893 - 0.8330405509i 1.209063189 - 0.2027516975 + 0.2405013423i```

### Special Values

The hypergeometric function has special values for some parameters:

```syms a b c d x hypergeom([], [], x) hypergeom([a, b, c, d], [a, b, c, d], x) hypergeom(a, [], x)```
```ans = exp(x) ans = exp(x) ans = 1/(1 - x)^a```

Any hypergeometric function, evaluated at 0, has the value 1:

```syms a b c d hypergeom([a, b], [c, d], 0)```
```ans = 1```

If, after canceling identical parameters, the list of upper parameters contains 0, the resulting hypergeometric function is constant with the value 1:

`hypergeom([0, 0, 2, 3], [a, 0, 4], x)`
```ans = 1```

If, after canceling identical parameters, the upper parameters contain a negative integer larger than the largest negative integer in the lower parameters, the hypergeometric function is a polynomial. If all parameters as well as the argument `x` are numeric, a corresponding explicit value is returned:

`hypergeom([(-4), -2 , 3], [-3, 1, 4], x*pi*sqrt(2))`
```ans = (6*pi^2*x^2)/5 - 2*2^(1/2)*pi*x + 1```

Hypergeometric functions also reduce to other special functions for some parameters:

```hypergeom([1], [a], x) hypergeom([a], [a, b], x)```
```ans = (exp(x/2)*whittakerM(1 - a/2, a/2 - 1/2, -x))/(-x)^(a/2) ans = x^(1/2 - b/2)*gamma(b)*besseli(b - 1, 2*x^(1/2))```

### Handling Expressions That Contain Hypergeometric Functions

Many functions, such as `diff` and `taylor`, can handle expressions containing `hypergeom`.

Differentiate this expression containing hypergeometric function:

```syms a b c d x diff(1/x*hypergeom([a, b], [c, d], x), x)```
```ans = (a*b*hypergeom([a + 1, b + 1], [c + 1, d + 1], x))/(c*d*x)... - hypergeom([a, b], [c, d], x)/x^2 ```

Compute the Taylor series of this hypergeometric function:

`taylor(hypergeom([1, 2], [3], x), x)`
```ans = (2*x^5)/7 + x^4/3 + (2*x^3)/5 + x^2/2 + (2*x)/3 + 1```

## Input Arguments

collapse all

### `a` — Upper parameters of hypergeometric functionnumber | vector | symbolic number | symbolic variable | symbolic expression | symbolic function | symbolic vector

Upper parameters of hypergeometric function, specified as a number, variable, symbolic expression, symbolic function, or vector.

### `b` — Lower parameters of hypergeometric functionnumber | vector | symbolic number | symbolic variable | symbolic expression | symbolic function | symbolic vector

Lower parameters of hypergeometric function, specified as a number, variable, symbolic expression, symbolic function, or vector.

### `z` — Argument of hypergeometric functionnumber | vector | symbolic number | symbolic variable | symbolic expression | symbolic function | symbolic vector

Argument of hypergeometric function, specified as a number, variable, symbolic expression, symbolic function, or vector. If `z` is a vector, `hypergeom(a,b,z)` is evaluated element-wise.

collapse all

### Generalized Hypergeometric Function

The generalized hypergeometric function of order p, q is defined as follows:

${}_{p}F{}_{q}\left(a;b;z\right)=\sum _{k=0}^{\infty }\left(\frac{{\left({a}_{1}\right)}_{k}{\left({a}_{2}\right)}_{k}\dots {\left({a}_{p}\right)}_{k}}{{\left({b}_{1}\right)}_{k}{\left({b}_{2}\right)}_{k}\dots {\left({b}_{q}\right)}_{k}}\right)\left(\frac{{z}^{k}}{k!}\right)$

Here a = [a1,a2,...,ap] and b = [b1,b2,...,bq] are vectors of lengths p and q, respectively.

(a)k and (b)k are Pochhammer symbols.

For empty vectors a and b, `hypergeom` is defined as follows:

$\begin{array}{l}{}_{0}F{}_{q}\left(;b;z\right)=\sum _{k=0}^{\infty }\frac{1}{{\left({b}_{1}\right)}_{k}{\left({b}_{2}\right)}_{k}\dots {\left({b}_{q}\right)}_{k}}\left(\frac{{z}^{k}}{k!}\right)\\ {}_{p}F{}_{0}\left(a;;z\right)=\sum _{k=0}^{\infty }{\left({a}_{1}\right)}_{k}{\left({a}_{2}\right)}_{k}\dots {\left({a}_{p}\right)}_{k}\left(\frac{{z}^{k}}{k!}\right)\\ {}_{0}F{}_{0}\left(;;z\right)=\sum _{k=0}^{\infty }\left(\frac{{z}^{k}}{k!}\right)={e}^{z}\end{array}$

### Pochhammer Symbol

The Pochhammer symbol is defined as follows:

${\left(x\right)}_{n}=\frac{\Gamma \left(x+n\right)}{\Gamma \left(x\right)}$

If n is a positive integer, then (x)n = x(x + 1)...(x + n - 1).

### Tips

• For most exact arguments, the hypergeometric function returns a symbolic function call. If an upper parameter coincides with a lower parameter, these values cancel and are removed from the parameter lists.

• If, after cancellation of identical parameters, the upper parameters contain a negative integer larger than the largest negative integer in the lower parameters, then pFq(a;b;z) is a polynomial in z.

• The following special values are implemented:

• pFp(a;a;z) = 0F0(;;z) = ez.

• pFq(a;b;z) = 1 if the list of upper parameters a contains more `0`s than the list of lower parameters b.

• pFq(a;b;0) = 1.

### Algorithms

The series

${}_{p}F{}_{q}\left(a;b;z\right)=\sum _{k=0}^{\infty }\left(\frac{{\left({a}_{1}\right)}_{k}{\left({a}_{2}\right)}_{k}\dots {\left({a}_{p}\right)}_{k}}{{\left({b}_{1}\right)}_{k}{\left({b}_{2}\right)}_{k}\dots {\left({b}_{q}\right)}_{k}}\right)\left(\frac{{z}^{k}}{k!}\right)$

• Converges for any |z| < ∞ if p ≤ q.

• Converges for |z| < 1 if p = q + 1. For |z| >= 1, the series diverges, and pFq is defined by analytic continuation.

• Diverges for any z <> 0 if p > q + 1. The series defines an asymptotic expansion of pFq(a;b;z) around z = 0. The positive real axis is the branch cut.

If one of the parameters in a is equal to `0` or a negative integer, then the series terminates, turning into what is called a hypergeometric polynomial.

pFq(a;b;z) is symmetric with respect to the parameters, that is, it does not depend on the order of the arrangement a1, a2, … in a or b1, b2, … in b.

If at least one upper parameter equals n = `0`,`-1`,`-2`,…, the function turns into a polynomial of degree n. If the previous condition for the lower parameters b is relaxed, and there is some lower parameter equal to m = `0`,`-1`,`-2`,…, then the function pFq(a;b;z) also reduces to a polynomial in z provided n > m. It is undefined if m > n or if no upper parameter is a nonpositive integer (resulting in division by `0` in one of the series coefficients). The case m = n is handled by the following rule.

. If for r values of the upper parameters, there are r values of the lower parameters equal to them (that is, a = [a1,…,ap - r, c1,…,cr], b = [b1,…,bq - r, c1,…,cr]), then the order (p, q) of the function pFq(a;b;z) is reduced to (p - r, q - r):

$\begin{array}{l}{}_{p}F{}_{q}\left({a}_{1},\dots ,{a}_{p-r},{c}_{1},\dots ,{c}_{r};{b}_{1},\dots ,{b}_{q-r},{c}_{1},\dots ,{c}_{r};z\right)=\\ {}_{p-r}F{}_{q-r}\left({a}_{1},\dots ,{a}_{p-r};{b}_{1},\dots ,{b}_{q-r};z\right)\end{array}$

This rule applies even if any of the ci is zero or a negative integer. For details, see Luke, Y.L. "The Special Functions and Their Approximations", vol. 1, p. 42.

$U\left(z\right)={}_{p}F{}_{q}\left(a;b;z\right)$ satisfies a differential equation in z:

where (δ + a) and (δ + b) stand for

$\prod _{i=1}^{p}\left(\delta +{a}_{i}\right)$

and

$\prod _{j=1}^{q}\left(\delta +{b}_{j}\right),$

respectively. Thus, the order of this differential equation is max(p, q + 1) and the hypergeometric function is only one of its solutions. If p < q + 1, this differential equation has a regular singularity at z = 0 and an irregular singularity at z = ∞. If p = q + 1, the points z = 0, z = 1, and z = ∞ are regular singularities, thus explaining the convergence properties of the hypergeometric series.

## References

[1] Oberhettinger, F. "Hypergeometric Functions." Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. (M. Abramowitz and I. A. Stegun, eds.). New York: Dover, 1972.

[2] Luke, Y.L. "The Special Functions and Their Approximations", Vol. 1, Academic Press, New York, 1969.

[3] Prudnikov, A.P., Yu.A. Brychkov, and O.I. Marichev, "Integrals and Series", Vol. 3: More Special Functions, Gordon and Breach, 1990.