From: Hassan A. <au...@CR...> - 2000-03-01 15:50:10
|
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 <su9...@na...> > To: Hassan Aurag <au...@CR...> > 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 > |