MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


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$?

share|cite|improve this question
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! – Zen Harper Feb 22 '11 at 7:59
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. – laxxy Feb 25 '11 at 21:56
up vote 4 down vote accepted

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

share|cite|improve this answer
This looks very much like what is needed, thanks a lot!! – laxxy Feb 21 '11 at 22:07

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)

share|cite|improve this answer

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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.