SciPy, GSL, and jmat all support evaluating the limit of the besselk function as it approaches infinity, returning zero. However, neither the fp nor the mp contexts for mpmath do so even though limits are in other functions.
>>> mp.besselk(0, inf)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/mpmath/ctx_mp_python.py", line 1035, in f_wrapped
retval = f(ctx, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/mpmath/functions/bessel.py", line 169, in besselk
ctx.prec += M
File "/usr/local/lib/python3.6/dist-packages/mpmath/ctx_mp_python.py", line 611, in _set_prec
ctx._prec = ctx._prec_rounding[0] = max(1, int(n))
File "/usr/local/lib/python3.6/dist-packages/mpmath/ctx_mp_python.py", line 141, in __int__
def __int__(s): return int(to_int(s._mpf_))
File "/usr/local/lib/python3.6/dist-packages/mpmath/libmp/libmpf.py", line 351, in to_int
raise ValueError("cannot convert inf or nan to int")
ValueError: cannot convert inf or nan to int
>>> mp.besselk(1, inf)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/mpmath/ctx_mp_python.py", line 1035, in f_wrapped
retval = f(ctx, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/mpmath/functions/bessel.py", line 169, in besselk
ctx.prec += M
File "/usr/local/lib/python3.6/dist-packages/mpmath/ctx_mp_python.py", line 611, in _set_prec
ctx._prec = ctx._prec_rounding[0] = max(1, int(n))
File "/usr/local/lib/python3.6/dist-packages/mpmath/ctx_mp_python.py", line 141, in __int__
def __int__(s): return int(to_int(s._mpf_))
File "/usr/local/lib/python3.6/dist-packages/mpmath/libmp/libmpf.py", line 351, in to_int
raise ValueError("cannot convert inf or nan to int")
ValueError: cannot convert inf or nan to int
>>> fp.besselk(1, inf)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/mpmath/ctx_fp.py", line 57, in f_wrapped
return f(ctx, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/mpmath/functions/bessel.py", line 173, in besselk
return ctx.hypercomb(h, [n], **kwargs)
File "/usr/local/lib/python3.6/dist-packages/mpmath/functions/hypergeometric.py", line 127, in hypercomb
[ctx.rgamma(b) for b in beta_s] + \
File "/usr/local/lib/python3.6/dist-packages/mpmath/functions/hypergeometric.py", line 219, in hyper
if q == 1: return ctx._hyp0f1(b_s, z, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/mpmath/functions/hypergeometric.py", line 307, in _hyp0f1
return ctx.hypsum(0, 1, (btype,), [b], z, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/mpmath/ctx_fp.py", line 213, in hypsum
raise ctx.NoConvergence
mpmath.libmp.libhyper.NoConvergence
SciPy, GSL, and jmat all support evaluating the limit of the besselk function as it approaches infinity, returning zero. However, neither the fp nor the mp contexts for mpmath do so even though limits are in other functions.