flintlib / arb

Arb has been merged into FLINT -- use https://github.com/flintlib/flint/ instead
http://arblib.org/
GNU Lesser General Public License v2.1
456 stars 137 forks source link

Selecting algorithm in wrapper functions #355

Closed unageek closed 2 years ago

unageek commented 3 years ago

arb_hypgeom_shi calls acb_hypgeom_shi which in turn calls acb_hypgeom_si and which heuristically chooses an algorithm from acb_hypgeom_si_1f2 and acb_hypgeom_si_asymp. But of course, the chosen algorithm is not always the best one. So I want to try both algorithms and take the intersection of the results to add some robustness.

The best way I can think of is to modify or copy-paste the code of the functions to add a parameter for specifying the algorithm. However, it would be hard for me to keep them in sync with the original code. Is there a more convenient way to achieve this?

fredrik-johansson commented 3 years ago

Do you have an example where arb_hypgeom_shi performs poorly?

I'm aware that acb_hypgeom_shi (imaginary argument) and arb_hypgeom_si give bad results in the transition regions.

It would be best to just fix all the exponential/trigonometric/hyperbolic integrals to do the right thing, similarly to what acb_hypgeom_erf already does (evaluate at midpoint, automatically increase precision to ensure that the result is accurate; use derivative for error bound).

unageek commented 2 years ago

Thank you for your response, and sorry for so late reply.

Do you have an example where arb_hypgeom_shi performs poorly?

I'm afraid not. Apparently, I was looking at a different function. So let me close this issue.

PS: I'm building a graphing calculator^1 that leverages Arb, and I'm very impressed by the quality of the library. Please keep up the great work!