numerical differentiation?
Brian Gough
bjg@network-theory.co.uk
Mon May 29 16:08:00 GMT 2000
One way to solve the general problem of writing a routine to operate
on a badly-behaved function is by providing an interval where the
function is well-behaved, and restricting evaluations to this
interval. I do not claim any more insight than this ;-)
As you say, the typical symmetric derivative routine is sufficient for
most practical purposes. I am fully in favor of having a routine to do
that. A separate routine to handle difficult cases might be useful.
Dave Morrison writes:
> Hi Brian, Gerard,
>
> I'm just not sure I see the point of requiring a domain to be defined
> as a prerequisite for calculating a derivative. Differentiation
> depends on properties of a function in a neighborhood of the point at
> which you want to know the derivative. Sure, for integration you need
> to know something about the function over the domain of integration,
> but that's very different than the case for differentiation. I've
> looked and looked, but I can't find any implementation or discussion
> of any algorithm which requires this. The NAG routine D04AAF requires
> you to specify an initial step size, as does the CERNLIB routine
> DERIV, but neither requires you to specify a domain over which the
> derivative is defined. The discussion in Conte and de Boor says
> nothing about domains. The way to handle this is for the user to
> choose between forward, backward or centered difference methods as
> appropriate.
>
> Besides, what domain would you specify? Suppose I have a smooth
> function with a discontinuous derivative, a cusp say, at each integer.
> Now I want the derivative at x = 0.5. Do I really have to tell the
> routine that the derivative doesn't exist at x = 1,000,000?
>
> Cheers,
> Dave
>
> Brian Gough wrote:
> >
> > Regarding endpoint problems and singularities. In QUADPACK a similar
> > situation occurs. It is handled by having two versions of the general
> > integration function (QAG vs QAGP). One version assumes a well-behaved
> > function which can be evaluated anywhere. The other version avoids
> > using endpoints (in fact, it avoids a set of user-specified singular
> > points).
> >
> > For numerical derivatives it sounds as if you could have a similar
> > setup. One routine would be free to evaluate the function
> > anywhere. Another routine would take a range as an argument and avoid
> > the endpoints. In this way the routine can choose the type of
> > derivative to use -- one-sided if the step-size would overshoot the
> > end, but symmetric in the middle. Since the function will be varying
> > the stepsize it may need to change its choice dynamically.
>
> --
> David Morrison Brookhaven National Laboratory phone: 631-344-5840
> Physics Department, Bldg 510 C fax: 631-344-3253
> Upton, NY 11973-5000 email: dave@bnl.gov
>
>
More information about the Gsl-discuss
mailing list