MathGroup Archive 1996

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

Search the Archive

Re: Numerical Differentiation

  • To: mathgroup at
  • Subject: [mg4277] Re: Numerical Differentiation
  • From: sfpse at (Russell Brunelle)
  • Date: Sat, 29 Jun 1996 03:53:04 -0400
  • Organization: University of Washington, Seattle
  • Sender: owner-wri-mathgroup at

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.  It gets a little more precision over the regular 
definition by defining the derivative slightly differently, and it takes 
advantage of Mathematica's arbitrary precision.  I'd love any suggestions 
or critique, as this function is actually a cornerstone of some work I'm 
doing.  There's more info on numerical differentiation in the book 
_Numerical Recipes in C_

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]]

Russell D. Brunelle             |  Lab Ph.:  (206) 685-4343
University of Washington        |  Fax:      (206) 685-3072
Industrial Engineering          |  Home Ph.: (206) 526-5328
Box 352650                      |  E-Mail:   sfpse at
Seattle, WA 98195-2650          |


  • Prev by Date: Re: Numerical Differentiation
  • Next by Date: Re: Numerical Differentiation
  • Previous by thread: Re: Numerical Differentiation
  • Next by thread: Re: Numerical Differentiation