[Scipy-tickets] [SciPy] #1214: scipy.optimize.newton fails for a function with integer coefficient

SciPy Trac scipy-tickets@scipy....
Mon Jun 28 22:41:32 CDT 2010


#1214: scipy.optimize.newton fails for a function with integer coefficient
------------------------------+---------------------------------------------
 Reporter:  warren.weckesser  |       Owner:  somebody
     Type:  defect            |      Status:  new     
 Priority:  normal            |   Milestone:  0.8.0   
Component:  scipy.optimize    |     Version:  0.7.0   
 Keywords:  newton            |  
------------------------------+---------------------------------------------
 The following demonstrates an incorrect value returned by
 scipy.optimize.newton:
 {{{
 >>> from scipy.optimize import newton
 >>> newton(lambda x: x**2 - 1, x0=2, fprime=lambda x: 2*x)
 2
 }}}
 The solution should be 1.  Changing any of the coefficients or the initial
 guess to a float results in the correct solution:
 {{{
 >>> newton(lambda x: x**2 - 1, x0=2.0, fprime=lambda x: 2*x)
 1.0
 >>> newton(lambda x: x**2 - 1, x0=2, fprime=lambda x: 2.0*x)
 1.0
 >>> newton(lambda x: x**2 - 1.0, x0=2, fprime=lambda x: 2*x)
 1.0
 }}}

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


More information about the Scipy-tickets mailing list