# hypergeom

Hypergeometric function

## Syntax

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

## Description

example

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

## Examples

### Hypergeometric Function for Numeric and Symbolic Arguments

Depending on whether the input is floating point or symbolic, `hypergeom` returns floating point or symbolic results.

Compute the hypergeometric function for these numbers. Because these numbers are floating point, `hypergeom` returns 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```

Return exact symbolic results by converting at least one of the inputs to symbolic form by using `sym`. For most symbolic (exact) inputs, `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)] ```

Convert the symbolic result to high-precision floating-point by using `vpa`.

`vpa(symA)`
```ans = [ - 1.2174189301051728850455150601879 - 0.83304055090469367131547768563638i,... 1.2090631887094273193917339575087,... - 0.20275169745081962937527290365593 + 0.24050134226872040357481317881983i] ```

### Special Values of Hypergeometric Function

Show that `hypergeom` returns special values for certain input values.

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

Show that the hypergeometric function is always `1` at `0`.

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

If, after cancelling identical parameters in the first two arguments, the list of upper parameters contains 0, the resulting hypergeometric function is constant with the value `1`. For details, see Algorithms.

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

If, after canceling identical parameters in the first two arguments, the upper parameters contain a negative integer larger than the largest negative integer in the lower parameters, the hypergeometric function is a polynomial.

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

Hypergeometric functions reduce to other special functions for certain input values.

```hypergeom(, [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 symbolic functions, such as `diff` and `taylor`, handle expressions containing `hypergeom`.

Differentiate this expression containing the 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

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

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

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

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)={}_{p}F{}_{q}\left({a}_{1},\dots ,{a}_{j},\dots ,{a}_{p};{b}_{1},\dots ,{b}_{k},\dots ,{b}_{q};z\right)=\sum _{n=0}^{\infty }\left(\frac{{\left({a}_{1}\right)}_{n}\dots {\left({a}_{j}\right)}_{n}\dots {\left({a}_{p}\right)}_{n}}{{\left({b}_{1}\right)}_{n}\dots {\left({b}_{k}\right)}_{n}\dots {\left({b}_{q}\right)}_{n}}\right)\left(\frac{{z}^{n}}{n!}\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

`${\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).

## Algorithms

The hypergeometric function is

`${}_{p}F{}_{q}\left(a;b;z\right)={}_{p}F{}_{q}\left({a}_{1},\dots ,{a}_{j},\dots ,{a}_{p};{b}_{1},\dots ,{b}_{k},\dots ,{b}_{q};z\right)=\sum _{n=0}^{\infty }\left(\frac{{\left({a}_{1}\right)}_{n}\dots {\left({a}_{j}\right)}_{n}\dots {\left({a}_{p}\right)}_{n}}{{\left({b}_{1}\right)}_{n}\dots {\left({b}_{k}\right)}_{n}\dots {\left({b}_{q}\right)}_{n}}\right)\left(\frac{{z}^{n}}{n!}\right).$`
• The hypergeometric function has convergence criteria:

• Converges if p ≤ q and |z| < ∞.

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

• Diverges if p > q + 1 and z ≠ 0. Here, the series is defined by an asymptotic expansion of pFq(a;b;z) around z = 0. The branch cut is the positive real axis.

• The function is a polynomial, called the hypergeometric polynomial, if any aj is a nonpositive integer.

• The function is undefined:

• If any bk is a nonpositive integer such that bk > aj where aj is also a nonpositive integer, because division by 0 occurs

• If any bk is a nonpositive integer and no aj is a nonpositive integer

• The function has reduced order when upper and lower parameter values are equal and cancel. If r values of the upper and lower parameters are equal (that is, a = [a1,…,ap - r, c1,…,cr], b = [b1,…,bq - r, c1,…,cr]), then the order (p, q) of 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 ci is zero or a negative integer .

• pFq(a;b;z) is symmetric. That is, it does not depend on the order a1, a2, … in a or b1, b2, … in b.

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

Here, (δ + a) represents

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

And (δ + b) represents

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

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, which explains the convergence properties of the hypergeometric series.

• The hypergeometric function has these special values:

• 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.

 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.

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

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

## Support

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos