On Mon, Apr 20, 2009 at 7:53 PM, Matt <hellzfury+pyt...@gmail.com> wrote: > I'm trying to calculate the derivative of a function in Python like so: > > def D5(func,h=1e-5): > ""' Return derivative of function func''' > def df(x): return (func(x+h)-func(x))/h > df.__name__ = func.__name__ + '_dx' > return df > > However, I run into the problem of limited float precision.
> Is there any way that any of you can think of to avoid this for > general-purpose functions? Thanks. mpmath? http://code.google.com/p/mpmath/ Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor