MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Numerical Differentiation


In article <4qirpi$3cq at dragonfly.wolfram.com> sfpse at u.washington.edu (Russell  
Brunelle) writes:
> I have needed to perform numerical differentiation as well.  The following 
> function, which finds the derivative with respect to f[t] at point t0 is 
> the best I could do.  
> 
> ND[f_, t_, t0_, prec_:$MachinePrecision] :=
>    With[{h=1/(2 10^(prec-6)), t0p=SetPrecision[t0,prec]},
>    N[((f /. t->(t0p+h)) - (f /. t->(t0p=h)))/(2 h), prec]]

No need to write your own, it already exists in stock Mathematica in the  
NLimit package:

In[1]:= Needs["NumericalMath`NLimit`"]

In[2]:= ?ND
ND[expr, x, x0] gives a numerical approximation to the derivative of expr
   with respect to x at the point x0.  ND[expr, {x, n}, x0] gives a
   numerical approximation to the n-th derivative of expr with respect to x
   at the point x0.  ND attempts to evaluate expr at x0.  If this fails, ND
   fails.


--
Rex Dieter 
Computer System Manager 	
Department of Mathematics and Statistics	 
University of Nebraska Lincoln

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: distance learning
  • Next by Date: Re: What's behind PseudoInverse
  • Previous by thread: Re: Numerical Differentiation
  • Next by thread: Re: Numerical Differentiation