ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 06 May 2019 16:51:06 +0200How to increase maxterms for hypergeometric?https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/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)Wed, 24 Apr 2019 16:19:34 +0200https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/Comment by Iguananaut for <p>I'm trying to compute a (bunch of) hypergeometric functions for which I get a NoConvergence error</p>
<p>e.g.</p>
<pre><code>hypergeometric([4.14 + 15*I, -3.14 + 15*I],[1. - 1.12e7*I], -500000)
</code></pre>
<p>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.<code>hypergeometric([4.14 + 15*I, -3.14 + 15*I],[1. - 1.12e7*I], -500000,maxterms=10^6)</code> does not work. </p>
<p>(I could be missing something very basic, I'm rather new to sage)</p>
https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?comment=46338#post-id-46338(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)Wed, 24 Apr 2019 16:37:50 +0200https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?comment=46338#post-id-46338Comment by Iguananaut for <p>I'm trying to compute a (bunch of) hypergeometric functions for which I get a NoConvergence error</p>
<p>e.g.</p>
<pre><code>hypergeometric([4.14 + 15*I, -3.14 + 15*I],[1. - 1.12e7*I], -500000)
</code></pre>
<p>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.<code>hypergeometric([4.14 + 15*I, -3.14 + 15*I],[1. - 1.12e7*I], -500000,maxterms=10^6)</code> does not work. </p>
<p>(I could be missing something very basic, I'm rather new to sage)</p>
https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?comment=46339#post-id-46339Indeed, 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.Wed, 24 Apr 2019 16:44:18 +0200https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?comment=46339#post-id-46339Answer by Iguananaut for <p>I'm trying to compute a (bunch of) hypergeometric functions for which I get a NoConvergence error</p>
<p>e.g.</p>
<pre><code>hypergeometric([4.14 + 15*I, -3.14 + 15*I],[1. - 1.12e7*I], -500000)
</code></pre>
<p>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.<code>hypergeometric([4.14 + 15*I, -3.14 + 15*I],[1. - 1.12e7*I], -500000,maxterms=10^6)</code> does not work. </p>
<p>(I could be missing something very basic, I'm rather new to sage)</p>
https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?answer=46340#post-id-46340By 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.Wed, 24 Apr 2019 16:59:05 +0200https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?answer=46340#post-id-46340Comment by virtual_neutrino for <p>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 <code>maxterms</code> argument (of course, you shouldn't have to do this at all and I would consider it a bug):</p>
<pre><code>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
</code></pre>
<p>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.</p>
https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?comment=46358#post-id-46358Thanks! This indeed works and I will heed your word of caution but mathematica seems to agree ...Thu, 25 Apr 2019 13:32:43 +0200https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?comment=46358#post-id-46358Comment by Iguananaut for <p>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 <code>maxterms</code> argument (of course, you shouldn't have to do this at all and I would consider it a bug):</p>
<pre><code>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
</code></pre>
<p>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.</p>
https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?comment=46462#post-id-46462Great. I went ahead and opened a ticket for the `maxterms` issue: 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.Mon, 06 May 2019 16:51:06 +0200https://ask.sagemath.org/question/46337/how-to-increase-maxterms-for-hypergeometric/?comment=46462#post-id-46462