MathGroup Archive 1996

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

Search the Archive

Re: Numerical Differentiation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4371] Re: Numerical Differentiation
  • From: Robert Knapp <rknapp>
  • Date: Mon, 15 Jul 1996 06:41:08 -0400
  • Organization: Wolfram Research, Inc.
  • Sender: owner-wri-mathgroup at wolfram.com

Dr. T. L. Marchioro II wrote:
> 
>  Robert Knapp wrote:
> > Mark James wrote:
> > >
> > > Does anyone know of a function that calculates the derivative of
> > > a function (that can't be differentiated symbolically) at a given
> > > point by numerical means?  I can't find it as a built-in or in the
> > > standard packages.  Thanks.
> >
> > The function ND in the package NumericalMath`NLimit does this.
> >
> > I mention in passing that numerical derivatives will be computed
> > automatically in the next release of Mathematica.
> 
> Really?  By what method?  Where will they be well defined? That is, if
> you have a discrete data stream will be the derivatives be accurate at
> the same points you know the data, or at the midpoints between the data,
> or somewhere else?  To what order will be the derivatives be accurately
> calculable?
> 
> Inquiring minds and all that :)
> 
Heres an example(from Mathematica 3.0 beta 2)


In[1]:= f[x_?NumberQ,t_?NumberQ] :=NDSolve[{y'[s] == x y[s],y[0] ==
1},y,{s,0,t}][[1,1,2]][t]
 
In[2]:= Derivative[1,0][f][x,t]
 
         (1,0)
Out[2]= f     [x, t]
 
In[3]:= Derivative[1,0][f][1,1]
 
         (1,0)
Out[3]= f     [1, 1]
 
not done since it is exact


In[4]:= Derivative[1,0][f][1.,1.]
 
Out[4]= 2.71828

This is calculated to machine precision.  If your function was defined
such that it could be calculated to higher precision, the derivative
routine would attempt to calculate to the precision of the arguments.
 
It works using high order finite differences.  There is not a limit to
the order derivative it uses since the wieghts are generated on
calculation, however, high order derivatives can take excessively
long.  

Also, mixed partials are not computed since error detection is much
more difficult.  

Rob
-- 
Rob Knapp
Wolfram Research, Inc.

http://www.wri.com/~rknapp

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


  • Prev by Date: Re: Time Series
  • Next by Date: Re: Abort options in Windows
  • Previous by thread: Re: Numerical Differentiation
  • Next by thread: rendering digital landscapes