Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
0

How to increase maxterms for hypergeometric?

asked 5 years ago

anonymous user

Anonymous

updated 2 years ago

tmonteil gravatar image

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)

Preview: (hide)

Comments

(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)

Iguananaut gravatar imageIguananaut ( 5 years ago )

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.

Iguananaut gravatar imageIguananaut ( 5 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 5 years ago

Iguananaut gravatar image

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.

Preview: (hide)
link

Comments

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

virtual_neutrino gravatar imagevirtual_neutrino ( 5 years ago )

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.

Iguananaut gravatar imageIguananaut ( 5 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 5 years ago

Seen: 458 times

Last updated: Apr 24 '19