[Scipy-tickets] [SciPy] #1782: RuntimeWarning encountered at first p_roots or ps_roots call.

SciPy Trac scipy-tickets@scipy....
Mon Dec 3 11:03:26 CST 2012

#1782: RuntimeWarning encountered at first p_roots or ps_roots call.
 Reporter:  sylvain.corlay  |       Owner:  pv         
     Type:  defect          |      Status:  new        
 Priority:  normal          |   Milestone:  Unscheduled
Component:  scipy.special   |     Version:  0.11.0     
 Keywords:  orthogonal      |  

Comment(by sylvain.corlay):

 Hi again,
 Calling p_roots(3), the problem occurs at the first call of
 gen_roots_and_weights(n,an_Js,sbn_Js,mu0)             # line 254 of
 stepping-in, the error occurs at
 an_func(np.concatenate(([0], nn)))                    #line 160 of
 stepping in the lambda function an_Js, the warning comes from the last
 argument of the np.where function.
 (2.0*k*(k+p)+q*(p-1.0)) / ((2.0*k+p+1.0)*(2*k+p-1.0)) # line 246 of
 that yields array([nan, 0.5, 0.5]).

 Eventually, the whole np.where instruction yields the expected array([0.5,
 0.5, 0.5])

 This problem could be due to a bug in numpy.where. The last argument
 should not be evaluated in the case where k==0.


Ticket URL: <http://projects.scipy.org/scipy/ticket/1782#comment:4>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list