Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

**George,Y****Member**- Registered: 2006-03-12
- Posts: 1,315

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[1]-y[-1]) /2/dx

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

But I found this one on five points :

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

ddy/dx/dx = (-y[-2] +16*y[-1] -30*y[0]+ 16*y[1] -y[2]) / (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?

**X'(y-Xβ)=0**

Offline

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.

**LearnMathsFree: Videos on various topics.New: Integration Problem | Adding FractionsPopular: Continued Fractions | Metric Spaces | Duality**

Offline

**George,Y****Member**- Registered: 2006-03-12
- Posts: 1,315

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_formulaThere 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]

**X'(y-Xβ)=0**

Offline