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

SciPy Trac scipy-tickets@scipy....
Mon Dec 3 11:07:53 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):

 {{{
 import numpy
 func = lambda k: numpy.where(k == 0, -1.0, 1.0 / k)
 print func(numpy.array([0.0, 2.0]))
 }}}
 yields
 {{{
 F:\DevPricing\PythonLibGIT\DE_optimizer.py:2: RuntimeWarning: divide by
 zero encountered in divide
   func = lambda k: numpy.where(k == 0, -1.0, 1.0 / k)
 }}}
 Seems to be a bug in numpy.where .

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


More information about the Scipy-tickets mailing list