6
$\begingroup$

Suppose we have a grid (possibly irregular) of $N$ function/value pairs, $(x_i, f_i)$, $i=1...N$. The function is differentiable everywhere at least twice (perhaps more).

What would be a good way to find, for example, a polynomial (or other) approximation for the derivative of the function in an interval $(x_j, x_{j+1})$, or perhaps $(x_{j-1}, x_{j+1})$, for a given $j$?

Say, cubic splines would provide the derivative, but it seems too wasteful to compute a spline approximation over all $N$ points, when all is needed is a neighborhood of just one point $j$. On the other hand, piecewise linear approximation only needs two points, but is rather imprecise, since we know that there are no jumps in the true derivative. What would be good alternatives that would need only a small number of points around $j$?

$\endgroup$
2
  • 2
    $\begingroup$ Please forgive my stupid comment, but you say: "What would be good alternatives that would need only a small number of points around j?" Why don't you just throw away the data for faraway points?! Such data is irrelevant to the derivative anyway! $\endgroup$
    – Zen Harper
    Commented Feb 22, 2011 at 7:59
  • $\begingroup$ Basically the question was, how to determine how many, and which exactly, points to throw away, how to adjust the algorithm near ends of sample, etc. -- eg. Kruger's paper cited by JJ Green below gives a well defined procedure. $\endgroup$
    – laxxy
    Commented Feb 25, 2011 at 21:56

3 Answers 3

6
$\begingroup$

CJC Kruger has a paper on "constrained cubic splines" which only use the nearby points, (pdf), it may be of interest.

$\endgroup$
1
  • $\begingroup$ This looks very much like what is needed, thanks a lot!! $\endgroup$
    – laxxy
    Commented Feb 21, 2011 at 22:07
7
$\begingroup$

In general you could try out spectral methods. Spectral methods also do a good job of capturing derivatives. If you want a polynomial approximation, Chebyshev polynomials do a good job and are probably the best when it comes to polynomial interpolations. (No Runge phenomenon as in the case of Lagrange interpolation)

$\endgroup$
5
$\begingroup$

Lagrange interpolation is the classic approach to this problem. In order for it to work, you'll need very precise function values, since the problem of numerical differentiation is ill-conditioned.

If you don't have accurate function values, then you'll have to smooth the function values to get stable (but biased) derivatives.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .