# How to increase maxterms for hypergeometric?

Anonymous

I'm trying to compute a (bunch of) hypergeometric functions for which I get a NoConvergence error

e.g.

hypergeometric([4.14 + 15*I, -3.14 + 15*I],[1. - 1.12e7*I], -500000)


The suggestion of the error message is to try increasing 'maxterms'. However, I don't seem to find a way to do this as e.g.hypergeometric([4.14 + 15*I, -3.14 + 15*I],[1. - 1.12e7*I], -500000,maxterms=10^6) does not work.

(I could be missing something very basic, I'm rather new to sage)

edit retag close merge delete

(please note, when pasting code it's important to be careful of formatting, as some symbols such as * have special meaning in markdown; always format code examples either by indenting a whole line with 4 spaces or putting bits of code in backtick quotes)

( 2019-04-24 16:37:50 +0200 )edit

Indeed, that is not a very helpful message. It seems that the underlying low-level sage.libs.mpmath.ext_impl.MPF_hypsum function does accept a maxterms argument, but there is a disconnect that prevents this from being passed to it from the higher-level generic hypergeometric function. I would consider this a bug.

( 2019-04-24 16:44:18 +0200 )edit

Sort by » oldest newest most voted

By digging into the code and going a little lower-level I was able to do effectively the same thing while close-enough to the lower-level code that it accepted the maxterms argument (of course, you shouldn't have to do this at all and I would consider it a bug):

sage: from mpmath import hyper
sage: from sage.libs.mpmath import utils as mpmath_utils
sage: mpmath_utils.call(hyper, [4.14 + 15*I, -3.14 + 15*I],[1. - 1.12e7*I], -500000, maxterms=10^6)
-608213.273405350 - 24201.2928264098*I


I make no guarantee as to the accuracy of the result or if it's even expected be convergent for the given $a$'s and $b$'s.

more

Thanks! This indeed works and I will heed your word of caution but mathematica seems to agree ...

( 2019-04-25 13:32:43 +0200 )edit

Great. I went ahead and opened a ticket for the maxtermsissue: https://trac.sagemath.org/ticket/27785 Coincidentally, a different bug involving arguments to hypergeometric was just fixed, but I don't think it has anything to do with this one.

( 2019-05-06 16:51:06 +0200 )edit

## Stats

Seen: 88 times

Last updated: Apr 24 '19