1======== 2Concrete 3======== 4 5Hypergeometric terms 6-------------------- 7 8The center stage, in recurrence solving and summations, play hypergeometric 9terms. Formally these are sequences annihilated by first order linear 10recurrence operators. In simple words if we are given term `a(n)` then it is 11hypergeometric if its consecutive term ratio is a rational function in `n`. 12 13To check if a sequence is of this type you can use the ``is_hypergeometric`` 14method which is available in Basic class. Here is simple example involving a 15polynomial: 16 17 >>> from sympy import * 18 >>> n, k = symbols('n,k') 19 >>> (n**2 + 1).is_hypergeometric(n) 20 True 21 22Of course polynomials are hypergeometric but are there any more complicated 23sequences of this type? Here are some trivial examples: 24 25 >>> factorial(n).is_hypergeometric(n) 26 True 27 >>> binomial(n, k).is_hypergeometric(n) 28 True 29 >>> rf(n, k).is_hypergeometric(n) 30 True 31 >>> ff(n, k).is_hypergeometric(n) 32 True 33 >>> gamma(n).is_hypergeometric(n) 34 True 35 >>> (2**n).is_hypergeometric(n) 36 True 37 38We see that all species used in summations and other parts of concrete 39mathematics are hypergeometric. Note also that binomial coefficients and both 40rising and falling factorials are hypergeometric in both their arguments: 41 42 >>> binomial(n, k).is_hypergeometric(k) 43 True 44 >>> rf(n, k).is_hypergeometric(k) 45 True 46 >>> ff(n, k).is_hypergeometric(k) 47 True 48 49To say more, all previously shown examples are valid for integer linear 50arguments: 51 52 >>> factorial(2*n).is_hypergeometric(n) 53 True 54 >>> binomial(3*n+1, k).is_hypergeometric(n) 55 True 56 >>> rf(n+1, k-1).is_hypergeometric(n) 57 True 58 >>> ff(n-1, k+1).is_hypergeometric(n) 59 True 60 >>> gamma(5*n).is_hypergeometric(n) 61 True 62 >>> (2**(n-7)).is_hypergeometric(n) 63 True 64 65However nonlinear arguments make those sequences fail to be hypergeometric: 66 67 >>> factorial(n**2).is_hypergeometric(n) 68 False 69 >>> (2**(n**3 + 1)).is_hypergeometric(n) 70 False 71 72If not only the knowledge of being hypergeometric or not is needed, you can use 73``hypersimp()`` function. It will try to simplify combinatorial expression and 74if the term given is hypergeometric it will return a quotient of polynomials of 75minimal degree. Otherwise is will return `None` to say that sequence is not 76hypergeometric: 77 78 >>> hypersimp(factorial(2*n), n) 79 2*(n + 1)*(2*n + 1) 80 >>> hypersimp(factorial(n**2), n) 81 82 83Concrete Class Reference 84------------------------ 85.. autoclass:: sympy.concrete.summations.Sum 86 :members: 87 88.. autoclass:: sympy.concrete.products.Product 89 :members: 90 91.. autoclass:: sympy.concrete.expr_with_intlimits.ExprWithIntLimits 92 :members: 93 94Concrete Functions Reference 95---------------------------- 96 97.. autofunction:: sympy.concrete.summations.summation 98 99.. autofunction:: sympy.concrete.products.product 100 101.. autofunction:: sympy.concrete.gosper.gosper_normal 102 103.. autofunction:: sympy.concrete.gosper.gosper_term 104 105.. autofunction:: sympy.concrete.gosper.gosper_sum 106