[Numpy-discussion] Derivatives

Hassan Aurag aurag at CRM.UMontreal.CA
Wed Mar 1 10:46:10 EST 2000


 The answer is yes!
 It is an 1e10 and not 1e-10. At 0.0 you got to pick the interval yourself. You 
can't just use the starting point x
 
 
> Date: Wed, 1 Mar 2000 16:06:28 +0100 (MET)
> From: Fredrik Stenberg <su96-fst at nada.kth.se>
> To: Hassan Aurag <aurag at CRM.UMontreal.CA>
> Subject: Re: [Numpy-discussion] Derivatives
> MIME-Version: 1.0
> 
> > Hi,
> > 
> > attached is a file called Derivative.py.
> > 
> > It computes derivatives and is based on an algorithm found in 
> > Numerical Recipes in C.
> > 
> > What to do you think about it and has anyone started a "serious" 
> > calculus oriented subpackage for Numerical Python in general?
> > 
> > I mean: derivatives, partial derivatives, jacobian, hessian 
> > implemented fast and precise.
> > 
> > On another note, why isn't infinity defined in NumPy?
> > 
> > Why is tan(pi/2) a number even if big? Shouldn't it be infinity?
> > 
> >  
> > 
> 
> I tried your algoritm on sin(x) and i got some rather interesting
> results.
> 
> ######### EXAMPLE#############
> from math import sin
> 
> def f(x):
>     return sin(x)
> 
> import Derivative
> 
> print Derivative.Diff(f,0.0)
> 
> ########RESULT################
> -2.03844228853e-10
> 
> It should be approx 1.0 
> 
> 
> 
> I found the error i think..
> check row 28 in Derivative
>         h = random()/1e-10
> should that be h = random()/1e+10??
> 
> 
> Fredrik
> 





More information about the NumPy-Discussion mailing list