# Hypergeometric Bug?

The following code shows a (typical ?) failure. F([m,a,b;m,c;z) should and does for positive m; cancel m. but when m is negative "0" is declared prematurely

--Juptyter code

```
def pochhammer(x,a):
return rising_factorial(x,a)
def fn2ref(a,b,c,z,m): return hypergeometric([a,b],[c],z)
def fn2lm(a,b,c,z,m):
return hypergeometric([m,a,b],[c,m],z)
def fn2l(a,b,c,z,m):
return hypergeometric([-m,a,b],[c,-m],z)
def fn1l(a,b,c,z,m):
var('k')
return sum((pochhammer(a,k)*pochhammer(b,k)/pochhammer(c,k))*(z^k/factorial(k)),k,0,m)
print "2F1(a,b;c;z,5) = ", fn2ref(1,2,3,.5,5)
print "3F2(m,a,b;m,c;z) = ", fn2lm(1,2,3,.5,5)
print "3F2(-m,a,b;-m,c;z) = ", fn2l(1,2,3,.5,5)
print "m terms of 2F1(a,b;c;z) = ", fn1l(1,2,3,.5,5)
```

-- produces

2F1(a,b;c;z,5) = 1.54517744447956

3F2(m,a,b;m,c;z) = 1.54517744447956

3F2(-m,a,b;-m,c;z) = 1.53809523809524

m terms of 2F1(a,b;c;z) = 1.538095238095238

--Whereas Maxima code

```
fn2ref(a,b,c,z):=hypergeometric([a,b],[c],z);
fn2lm(a,b,c,z,m) :=hypergeometric([a,b,m],[c,m],z);
fn2l(a,b,c,z,m) :=hypergeometric([a,b,-m],[c,-m],z);
fn1l(a,b,c,z,m):=
sum((pochhammer(a,k)*pochhammer(b,k)/(pochhammer(c,k))*z^k/factorial(k)),k,0,m);
print ("2F1(a,b;c;z) = ",fn2ref(1,2,3,.5))$
print("3F2(m,a,b;m,c;z) = ",fn2lm(1,2,3,.5,5))$
print("3F2(-m,a,b;-m,c;z) = ",fn2l(1,2,3,.5,5))$
print("m terms of 2F1(a,b;c;z) = ",fn1l(1,2,3,.5,5))$
```

-- Produces

2F1(a,b;c;z) = 1.545177444479563

3F2(m,a,b;m,c;z) = 1.545177444479563

3F2(-m,a,b;-m,c;z) = 1.545177444479563

m terms of 2F1(a,b;c;z) = 1.538095238095238

--

Which accords with the definition and Luke "The Special Functions and their Approximations" which is a pretty standard.

To display blocks of code or error messages, skip a line above and below, and do one of the following (all give the same result):

For instance, typing

produces:

Please edit your question to do that.