[Scipy-tickets] [SciPy] #1510: Add Hessian method to Scipy

SciPy Trac scipy-tickets@scipy....
Fri Sep 9 04:53:18 CDT 2011

#1510: Add Hessian method to Scipy
 Reporter:  deil                                               |       Owner:  somebody   
     Type:  enhancement                                        |      Status:  new        
 Priority:  normal                                             |   Milestone:  Unscheduled
Component:  scipy.optimize                                     |     Version:  0.9.0      
 Keywords:  Hesse, Hessian, numerical differentiationrical di  |  

Comment(by pbrod):

 I am the coauthor of numdifftools and I can not guarantee that
 numdifftools is bugfree.
 There are some situations where the result from numdifftools is not as
 accurate as requested. You will find
 one  example in this post:


 Numdifftools does by default determine the best step-size in an
 automatic way.  This is not foolproof, but works in most situations for
 well behaved functions.
 In the example referred to above the automatic stepsize broke down
 resulting in that the final stepsize was too big to give an accurate
 answer. (Please note the numdifftools now calculates the derivatives
 correctly in the above-mentioned example, but there can always be
 constructed examples where numdifftools will not calculate the correct

 In the same post
 Sebastian Walter made me aware of automatic differentiation tools, which
 are more robust and more stable than numerical differentiation.  The con
 is (as it seems to me) that the call syntax is more complicated.  Here is
 an overview of available AD
 software libraries:


 In numdifftools I have made an easy-to-use interface to ScientificPython
 and algopy

 and compared them to numdifftools for this function (for dimensions of the
 problem (N) ranging from 1 to 100):

 import numpy as np

 class F:
     def __init__(self,N):
         A = np.arange(N*N,dtype=float).reshape((N,N))
         self.A = np.dot(A.T,A)

     def __call__(self, xi):
         x = np.array(xi)

         tmp = np.dot(self.A,x) #np.array([(x*self.A[i]).sum() for i in
         return 0.5*np.dot(x*x, tmp)


 The accuracy and speed results are shown in the attached files.

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

More information about the Scipy-tickets mailing list