Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mpmath import *
>>> import numpy as np
>>> mp.legendre(1.2, np.nan)
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/ctx_mp_python.py", line 1035, in f_wrapped
retval = f(ctx, *args, **kwargs)
File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/functions/orthogonal.py", line 363, in legendre
return ctx.hyp2f1(-n,n+1,1,(1-x)/2, **kwargs)
File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/functions/hypergeometric.py", line 251, in hyp2f1
return ctx.hyper([a,b],[c],z,**kwargs)
File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/functions/hypergeometric.py", line 226, in hyper
if q == 1: return ctx._hyp2f1(a_s, b_s, z, **kwargs)
File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/functions/hypergeometric.py", line 473, in _hyp2f1
v = _hyp2f1_gosper(ctx,a,b,c,z,**kwargs)
File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/functions/hypergeometric.py", line 380, in _hyp2f1_gosper
kakbz = (k+a)*(k+b)*z / (4*(k+1)*kch*(k+c1h))
File "<string>", line 7, in __mul__
File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/libmp/libmpf.py", line 894, in python_mpf_mul
return normalize1(sign, man, sexp+texp, bc, prec, rnd)
File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/libmp/libmpf.py", line 230, in _normalize1
if not man & 1:
KeyboardInterrupt
mpmath version: 1.1.0
When the second argument to the legendre function is a NaN, a hang is
caused. This is true for both the fp and the mp contexts.
Example: