<![CDATA[Math Is Fun Forum / the Mythical formula to calculate Numerical Derivatives!]]> 2018-02-13T10:42:05Z FluxBB http://www.mathisfunforum.com/viewtopic.php?id=24242 <![CDATA[Re: the Mythical formula to calculate Numerical Derivatives!]]> zetafunc wrote:

These coefficients are part of a more general phenomenon called the Savitzky-Golay filter in numerical analysis. In fact the traditional five-point 'stencil' reads:

where
. You can derive this result simply by playing around with the Taylor series for
with
. It's a little tedious, but you can see the derivation here: https://en.wikipedia.org/wiki/Five-poin … he_formula

There are analogous formulae for higher order derivatives too, and several published papers about the error term.

That is very informative, zeta. Thanks for the reply.

I wonder if there is a way to calculate the midpoint differentials by 4 points around it:

dy/dx ]x=0

ddy/dx/dx ]x=0

given y[-0.5], y[0.5], y[-1.5] & y[1.5]

]]>
http://www.mathisfunforum.com/profile.php?id=3192 2018-02-13T10:42:05Z http://www.mathisfunforum.com/viewtopic.php?pid=402160#p402160
<![CDATA[Re: the Mythical formula to calculate Numerical Derivatives!]]>
These coefficients are part of a more general phenomenon called the Savitzky-Golay filter in numerical analysis. In fact the traditional five-point 'stencil' reads:

where
. You can derive this result simply by playing around with the Taylor series for
with
. It's a little tedious, but you can see the derivation here: https://en.wikipedia.org/wiki/Five-poin … he_formula

There are analogous formulae for higher order derivatives too, and several published papers about the error term.

]]>
http://www.mathisfunforum.com/profile.php?id=206089 2018-02-12T20:14:24Z http://www.mathisfunforum.com/viewtopic.php?pid=402158#p402158
<![CDATA[the Mythical formula to calculate Numerical Derivatives!]]> I come across this method when trying to calculate the derivative of an unknown curve which I have only sample points at equal grids.

The simplest way to calculate numerical derivative is three-point formula:

dy/dx = (y-y[-1]) /2/dx
ddy/dx/dx = (y+y[-1]-2*y) /dx/dx

But I found this one on five points :

dy/dx = ( y[-2] -8*y[-1] +8*y -y) / (12*dx)

ddy/dx/dx = (-y[-2] +16*y[-1] -30*y+ 16*y -y)  / (12*dx^2)

It is surprisingly accurate when I test the derivative on exp(3) using exp(2) exp(2.5) exp(3) exp(3.5) exp(4)

the result of 1st numerical derivative and 2nd are
20.04243  &   20.07127

remember the correct answer are both exp(3) = 20.08554

Can anyone prove how this works?
4th polynomial?

]]>
http://www.mathisfunforum.com/profile.php?id=3192 2018-02-12T08:48:31Z http://www.mathisfunforum.com/viewtopic.php?pid=402153#p402153