[SciPy-user] Partial Derivatives

R. Padraic Springuel rspringuel at smcvt.edu
Fri Feb 25 17:18:33 CST 2005


Is there a way to use the "derivative" function to take a partial 
derivative?  What if one of the inputs is a list of numbers instead of a 
single number?

Example:
def y(x,p):
    return p[0] + p[1]*x + p[2]*x**2

I can get the derivative with respect to x fairly easily with the following:

derivative(y, 3, args=([[0, 0, 1]])

where the numbers can be arbitrarily replaced.  However I can't seem to 
get the derivative with respect to say p[0] or any other member of p.  I 
keep getting a TypeError regarding the number of arguments for y.  Any 
suggestions?

-- 

R. Padraic Springuel




More information about the SciPy-user mailing list