[SciPy-user] derivative
Stephen Walton
stephen.walton at csun.edu
Wed Feb 23 09:02:04 EST 2005
Nils Wagner wrote:
> Hi all,
>
> Is it somehow possible to improve the accuracy of derivative ?
Higher order?
from scipy import *
def func(x):
return exp(2*x)
for i in arange(1,6):
d=derivative(func,0.0,dx,i,order=9)
print i,' derivative of exp(2*x) at x=0',d,'exact',2**i
print ' rel error %e' % (d/2**i - 1)
Changing the order to 9 improves the accuracy of the 6th derivative from
1e-4 to 3e-7.
More information about the SciPy-User
mailing list