MathGroup Archive 1996

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

Search the Archive

Re: Numerical Differentiation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4275] Re: Numerical Differentiation
  • From: sfpse at u.washington.edu (Russell Brunelle)
  • Date: Sat, 29 Jun 1996 03:52:43 -0400
  • Organization: University of Washington, Seattle
  • Sender: owner-wri-mathgroup at wolfram.com

Oops...  There was a typo in the function I just posted.  Here's a 
corrected version of the whole post...


>Subject: Re: Numerical Differentiation
>Organization: University of Washington, Seattle

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 u.washington.edu
Seattle, WA 98195-2650          |
-------------------------------------------------------------------


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


  • Prev by Date: Re: Numerical Differentiation
  • Next by Date: Re: Help: Column/Row Vector
  • Previous by thread: Re: Numerical Differentiation
  • Next by thread: Newsgroup Rules and Administration