[SciPy-user] Does Scipy have the differenciation function?

Nils Wagner nwagner@iam.uni-stuttgart...
Sat Feb 24 01:41:15 CST 2007


On Sat, 24 Feb 2007 16:04:03 +0900
  "Hui Chang Moon" <topengineer@gmail.com> wrote:
> Hello, Scipy-user Group members,
> 
> I want to know if the Scipy has the differencitaion 
>function.
> I can find the integration fuction (quad), but I can't 
>know where the
> differenciation function.
> 
> Whoever knows the differenciation function, let me know.
> 
> Thank you.
  
You might use
from scipy import *
#
# Using Complex Variables to Estimate Derivatives of Real 
Functions
# William Squire, George Trapp
# SIAM Review, Vol. 40, No. 1 (Mar., 1998), pp. 110-112
#
#
def f(x):

     return sin(x)

def fp(x):
     """ First derivative of f """

     return cos(x)

print 'The derivative of f is fp'

eps = 1.e-8
print
print 'Analytical solution',fp(0.1)
print
print 'Numerical solution',f(0.1+1j*eps).imag/eps

Otherwise you can use interpolate

       splrep    -- find smoothing spline given (x,y) 
points on curve.
       splprep   -- find smoothing spline given 
parametrically defined curve.
       splev     -- evaluate the spline or its 
derivatives.
       splint    -- compute definite integral of a spline.
       sproot    -- find the roots of a cubic spline.
       spalde    -- compute all derivatives of a spline at 
given points.



Nils


More information about the SciPy-user mailing list