[SciPy-user] Partial Derivatives

Stephen Walton stephen.walton at csun.edu
Fri Feb 25 18:41:08 EST 2005


On Fri, 2005-02-25 at 18:18 -0500, R. Padraic Springuel wrote:
> Is there a way to use the "derivative" function to take a partial 
> derivative?

Looking at the source for derivative (derivative?? in IPython) shows the
following line as relevant:

val += weights[k]*func(x0+(k-ho)*dx,*args)

So it looks like derivative is hard wired to take the derivative with
respect to the first argument of 'func' only.

>   What if one of the inputs is a list of numbers instead of a 
> single number?

In [31]: derivative(y,array([7,4]),args=[[1,4,3]])
Out[31]: NumPy array, format: long
[ 46.  28.]

:-)





More information about the SciPy-User mailing list