# Problems with If condition when Pochhammer symbols are zero

There is a formula for the hypergeometric ($_2F_1$) that expresses it as a sum of Pochhammer symbols, times something that reads

$$_2F_1(a,b,c;x) = \sum_{i=0}^{\infty} \frac{(a)_i (b)_i}{(c)_i} \frac{x^i}{i!}$$

This is a result that I easily verified.

 Result1 =
Series[Hypergeometric2F1[a22, b22, c22, y], {y, 0, 10}];

Result2 =
Sum[(Pochhammer[a22, w] Pochhammer[b22, w])/Pochhammer[c22, w]*y^w/
w!, {w, 0, 10}];

Normal[Result1/Result2 // Factor // Simplify] // Timing

{1.04688, 1}


In what I need to write down I have products of hypergeometric functions but the arguments have the same structure and for each hypergeometric the value of $n$ is fixed -see below the exact form.

For now I am only interested in clarifying the following thing.

This is one of the hypergeometric functions that I have.

Hypergeometric2F1[1/2 (Δ + l) + n,
1/2 (Δ + l) + n, Δ + l + 2 n, x]


And this is how I re-wrote it

Sum[(Pochhammer[1/2 (Δ + l) + n, i] Pochhammer[
1/2 (Δ + l) + n, i])/
Pochhammer[(Δ + l + 2 n), i]*x^i/i!, {i, 0, 10}]


For my purposes, I need to sum over values of $\Delta,l$ and this is where the problem starts.

Some standard results for the Pochhammer symbol.

Pochhammer[0, 0]

1

Pochhammer[0, 1]

0

Pochhammer[0, 2]

0


This means that for certain combinations of $\Delta, l, n$ the denominator can be zero. The good thing is that the numerator comes with two zeros, and there is an exact cancellation; actually we would get zero. Mathematica does not want to handle a fraction like $\frac{0*0}{0}$, so I need to put by hand the following:

If $\Delta + l + 2n \neq 0$ give me all the terms in the sum, otherwise if $\Delta + l + 2n = 0$ and $n=0$ the corresponding term in the sum is $1$ and all the other terms in the sum are $0$ and I want to sum this.

An example with numbers just to clarify a bit more.

$\Delta = 4, l=0, n=1$, then the sum runs smoothly.

$\Delta = 4, l=0, n=-2$ then I would like to get back $1$ when $i=0$ and $0$ for the other values of $i$ and in the end sum this thing, which gives $1$.

My attempts:

First one:

ftest[x_, z_, Δ_, l_, n_] :=
If[(1/2 (Δ + l) + n != 0),
Sum[(Pochhammer[1/2 (Δ + l) + n, i] Pochhammer[
1/2 (Δ + l) + n, i])/
Pochhammer[(Δ + l + 2 n), i]*x^i/i!, {i, 0, 10}],
If[(1/2 (Δ + l) + n == 0) ∧ (i == 0),
Sum[(Pochhammer[1/2 (Δ + l) + n, i] Pochhammer[
1/2 (Δ + l) + n, i])/
Pochhammer[(Δ + l + 2 n), i]*x^i/i!, {i, 0, 10}],
0]]


Second one:

 ftest[x_, z_, Δ_, l_, n_] :=
If[(1/2 (Δ + l) + n !=
0) ∨ ((1/2 (Δ + l) + n == 0) ∧ (i == 0)),
Sum[(Pochhammer[1/2 (Δ + l) + n, i] Pochhammer[
1/2 (Δ + l) + n, i])/
Pochhammer[(Δ + l + 2 n), i]*x^i/i!, {i, 0, 10}],
0]


The problem I have:

In the example with the specific numbers I gave above I have no troubles. I am showing the results using the the expression in the second effort

ftest[x, z, 4, 0, 1]

1 + (3 x)/2 + (12 x^2)/7 + (25 x^3)/14 + (25 x^4)/14 + (
7 x^5)/4 + (56 x^6)/33 + (18 x^7)/11 + (225 x^8)/143 + (
275 x^9)/182 + (132 x^10)/91


For the other example I gave, with the zero value of the Pochhammer $\Delta = 4, l=0, n=-2$ I get the following

 ftest[x, z, 4, 0, -2]

If[i == 0, \!$$\*UnderoverscriptBox[\(\[Sum]$$, $$i = 0$$, $$10$$]
\*FractionBox[$$\((Pochhammer[ \*FractionBox[\(4 + 0$$, $$2$$] - 2, i]\ Pochhammer[
\*FractionBox[$$4 + 0$$, $$2$$] - 2, i])\)\
\*SuperscriptBox[$$x$$, $$i$$]\), $$Pochhammer[ 4 + 0 + 2\ \((\(-2$$)\), i]\ $$i!$$\)]\), 0]


I would just sum the hypergeometric functions, and then apply Series:

l = 2 m;
Δ = 2 t + 2 + l;

hf = Hypergeometric2F1[1/2 (Δ+l)+n,1/2 (Δ+l)+n,Δ+l+2 n,x];

sum = Sum[hf, {t,4}, {m, 0, 3}]


Hypergeometric2F1[2 + n, 2 + n, 4 + 2 n, x] + Hypergeometric2F1[3 + n, 3 + n, 6 + 2 n, x] + 2 Hypergeometric2F1[4 + n, 4 + n, 8 + 2 n, x] + 2 Hypergeometric2F1[5 + n, 5 + n, 10 + 2 n, x] + 2 Hypergeometric2F1[6 + n, 6 + n, 12 + 2 n, x] + 2 Hypergeometric2F1[7 + n, 7 + n, 14 + 2 n, x] + 2 Hypergeometric2F1[8 + n, 8 + n, 16 + 2 n, x] + 2 Hypergeometric2F1[9 + n, 9 + n, 18 + 2 n, x] + Hypergeometric2F1[10 + n, 10 + n, 20 + 2 n, x] + Hypergeometric2F1[11 + n, 11 + n, 22 + 2 n, x]

Applying Series:

Series[sum, {x, 0, 10}] /. n->-2 //TeXForm


$16+36 x+\frac{973535884 x^2}{14549535}+\frac{519825136 x^3}{4849845}+\frac{151011295 x^4}{969969}+\frac{175416565 x^5}{831402}+\frac{12117390949 x^6}{44618574}+\frac{2141664077 x^7}{6374082}+\frac{7704764371 x^8}{19122246}+\frac{35040553351 x^9}{74364290}+\frac{40146310247 x^{10}}{74364290}+O\left(x^{11}\right)$

• Very nice suggestion. Thank you very much @Carl Woll – Darth_Bane May 3 '18 at 19:18

After a billion of efforts, the following seems to be working fine.

 l = 2 m;

\[CapitalDelta] = 2 t + 2 + l;

test2[x_, z_, \[CapitalDelta]_, l_, n_] :=
If[(\[CapitalDelta] + l + 2 n) != 0,
Sum[(Pochhammer[1/2 (\[CapitalDelta] + l) + n, i] Pochhammer[
1/2 (\[CapitalDelta] + l) + n, i])/
Pochhammer[(\[CapitalDelta] + l + 2 n), i]*x^i/i!, {i, 0, 10}],
Sum[(Pochhammer[1/2 (\[CapitalDelta] + l) + n, i] Pochhammer[
1/2 (\[CapitalDelta] + l) + n, i])/
Pochhammer[(\[CapitalDelta] + l + 2 n), i]*x^i/i!, {i, 0, 0}]]

test2[x, z, 4, 0, -2]

1

Sum[test2[x, z, \[CapitalDelta], l, -2], {t, 1, 4}, {m, 0, 3}]

16 + 36 x + (973535884 x^2)/14549535 + (
519825136 x^3)/4849845 + (151011295 x^4)/969969 + (
175416565 x^5)/831402 + (12117390949 x^6)/44618574 + (
2141664077 x^7)/6374082 + (7704764371 x^8)/19122246 + (
35040553351 x^9)/74364290 + (40146310247 x^10)/74364290


In case someone spent time with my question, thank you. If you have a more elegant piece of code, please let me know.

Cheers!!!