Skip to content

Commit

Permalink
some fixes in hypergeometric
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Sep 11, 2024
1 parent dda7e93 commit 40ade69
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/sage/functions/hypergeometric.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
sage: maxima(hypergeometric([1, 1, 1], [3, 3, 3], x)) # needs sage.symbolic
hypergeometric([1,1,1],[3,3,3],_SAGE_VAR_x)
sage: hypergeometric((5, 4), (4, 4), 3)._sympy_() # needs sympy sage.symbolic
sage: hypergeometric((5,), (4,), 3)._sympy_() # needs sympy sage.symbolic
hyper((5,), (4,), 3)
sage: hypergeometric((5, 4), (4, 4), 3)._mathematica_init_() # needs sage.symbolic
'HypergeometricPFQ[{5,4},{4,4},3]'
Expand Down Expand Up @@ -295,6 +295,11 @@ def __call__(self, a, b, z, **kwargs):
The only simplification that is done automatically is returning 1
if ``z`` is 0. For other simplifications use the
``simplify_hypergeometric`` method.
TESTS::
sage: hypergeometric([2, 3, 4], [4, 1], 1)
hypergeometric((2, 3, 4), (4, 1), 1)
"""
return BuiltinFunction.__call__(self,
SR._force_pyobject(a),
Expand Down Expand Up @@ -458,23 +463,21 @@ def eliminate_parameters(self, a, b, z):
"""
aa = list(a) # tuples are immutable
bb = list(b)
p = pp = len(aa)
q = qq = len(bb)
i = 0
while i < qq and aa:
bbb = bb[i]
if bbb in aa:
aa.remove(bbb)
bb.remove(bbb)
pp -= 1
bbi = bb[i]
if bbi in aa:
aa.remove(bbi)
bb.remove(bbi)
qq -= 1
else:
i += 1
if (pp, qq) != (p, q):
if qq != q:
return hypergeometric(aa, bb, z)
return self

def is_termwise_finite(self, a, b, z):
def is_termwise_finite(self, a, b, z) -> bool:
"""
Determine whether all terms of ``self`` are finite.
Expand Down Expand Up @@ -516,8 +519,6 @@ def is_termwise_finite(self, a, b, z):
return 0 not in b
if abs(z) == Infinity:
return False
if abs(z) == Infinity:
return False
for bb in b:
if bb in ZZ and bb <= 0:
if any((aa in ZZ) and (bb < aa <= 0) for aa in a):
Expand Down

0 comments on commit 40ade69

Please sign in to comment.