[Numpy-discussion] any interest in including a second-ordergradient?
Tue Oct 28 16:57:25 CDT 2008
Le mardi 28 octobre 2008 à 15:28 -0600, Andrew Hawryluk a écrit :
> I agree that the gradient functions should be combined, especially
> considering how much redundant code would be added by keeping them
> separate. Here is one possible implementation, but I don't like the
> signature yet as it departs from the current behaviour. At the risk of
> demonstrating my ignorance, is there no way to place the named
> parameter (order) after the variable-length parameter (dx) in Python?
> > Stéfan van der Walt
> > We should discuss different options for the implementation. The
> > namespace is fairly cluttered, and it may be that we want to implement
> > gradient3 some time in the future as well. Maybe something like
> > gradient(f, 1, 2, 3, order=2)
> > would work -- then we can combine gradient and gradient2 (and
> > gradient3). What do you think?
> > Andrew Hawryluk:
> > > We wrote a simple variation on the gradient() function to calculate
> > > the second derivatives. Would there be any interest in including a
> > > gradient2() in numpy?
Are there some parts of the code that may be used only once to calculate
both the gradient and the second derivative (isn't it called the
hessian, at least in the N-d case) ?
If a common function would fasten the computation of the gradient and
the hessian with a single call to a new function gradients(), it is
If the intent is just a reduction of the total length of the file
containing the gradient and gradient2 functions, I do not understand why
modifying the existent code. Why not creating a new function hessian()
having the same signature than gradient?
More information about the Numpy-discussion