1
$\begingroup$

I have a function of which I only know the value of at some discrete points. Now I want to calculate the derivative of this function. The approximation of taking the difference of two consecutive values is not good enough for my purpose. In a book about my field of study they propose the formula

$\Delta f(x) = (\sum_{l=-L}^L l * f(x+l)) / (\sum_{l=-L}^L l^2)$

to calculate a better approximation of the derivative. They approximate the discrete function by a polynomial in an interval of $2L+1$ discrete steps. L usually takes a value between 1 and 3 in this case. Indeed this formula archives better results but I would like to know a bit more about this formula. How do we arrive there? Does it have a name? Are there other approximations that are better/worse? Unluckily I was not able to find this formula or a similar one on-line.

$\endgroup$

2 Answers 2

1
$\begingroup$

This looks just as the solution of the equation for the least-square problem for the model $$y=a x$$ based on $n$ data points ($x_i,y_i$) $$a=\frac{\sum_{i=1}^n{x_i y_i}}{\sum_{i=1}^n{x_i ^2}}$$ I am sure you see the analogy.

$\endgroup$
3
  • 1
    $\begingroup$ @balea: I don't like this formula very much as it gives greater emphasis to data points far from the evaluation point. I think a weighting that decreases smoothly would be better, like that given by the convolution with the derivative of Gaussian, $-\xi e^{-\xi^2/2\sigma^2}/\sqrt{2\pi}\sigma^3$ (Gaussian derivative). $\endgroup$
    – user65203
    Jul 29, 2015 at 10:24
  • $\begingroup$ @YvesDaoust. This is a very good point to underline. Thanks. $\endgroup$ Jul 29, 2015 at 10:30
  • $\begingroup$ With the hint for the least-square regression I was able to find the paper that introduces this formula for my specific problem, thanks! @YvesDaoust Thanks for the hint I will keep that in mind $\endgroup$
    – Balea
    Jul 29, 2015 at 10:53
1
$\begingroup$

If your data is noisy, the Savitzky-Golay formulas can be a good choice. They combine smoothing with differentiation and can be computed for different interval sizes.

$\endgroup$

You must log in to answer this question.

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