[Numpy-tickets] [NumPy] #564: poly1d subtraction yields coefficient of 0

NumPy numpy-tickets@scipy....
Sun Aug 5 19:29:22 CDT 2007


#564: poly1d subtraction yields coefficient of 0
-----------------------+----------------------------------------------------
 Reporter:  DrIdiot    |       Owner:  somebody
     Type:  defect     |      Status:  new     
 Priority:  normal     |   Milestone:          
Component:  numpy.lib  |     Version:  none    
 Severity:  normal     |    Keywords:  poly1d  
-----------------------+----------------------------------------------------
 Using ipython -pylabs, explicitly setting the leading coefficient to 0
 does this:


 In [3]: a = numpy.poly1d([1,2,3])
 In [4]: a[2] = 0
 In [5]: print a
  + 2 x + 3
 In [6]: a.coeffs
 Out[6]: array([0, 2, 3])

 Likewise,

 In [10]: a = numpy.poly1d([1,2,3])
 In [11]: a[2] = 0
 In [12]: a[1] = 0
 In [13]: print a
  + 3
 In [14]: a.coeffs
 Out[14]: array([0, 0, 3])

 Likewise,
 In [15]: a = numpy.poly1d([1,2,3])
 In [16]: a[2] = 0
 In [17]: a[1] = 0
 In [18]: a[0] = 0
 In [19]: print a

 In [20]: a.coeffs
 Out[20]: array([0, 0, 0])

 (The correct behavior is:)
 In [22]: a = numpy.poly1d([0])
 In [23]: print a
 0

 I am running Gentoo Linux and numpy version 1.0.3

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/564>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list