Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

My question seems pretty easy. Prove the correctness of the following approximation:

$$f(x)''= \frac{-f(x-2h)+16f(x-h)-30f(x)+16f(x-h)-f(x+2h)}{12h^2}$$

I rendered myself deeply saddened upon stumbling on this and being seemingly unable solve it by my own. I also failed to find proof anywhere online. Only final answer.

The way I tried to it is via pretty common Taylor series expansion:

$$f(x+h) = f(x) + f'(x)h+\frac{1}{2!}f''(x)h^2+\frac{1}{3!}f^{(3)}(x)h^3 + \sum_{n=4}^\infty \frac{1}{n!}f^{(n)}(x)h^n\quad (1)$$

I cut it off after $f^{(3)}$.

I use this formula to get rest of the points to have 5-stencils, simply by substituting $h$ with $\{-h; 2h; -2h\}$ Thus I get:

$$f(x-h) = f(x) - f'(x)h+\frac{1}{2!}f''(x)h^2-\frac{1}{3!}f^{(3)}(x)h^3\quad (2)$$ $$f(x+2h) = f(x) + 2f'(x)h+\frac{4}{2!}f''(x)h^2+\frac{8}{3!}f^{(3)}(x)h^3\quad (3)$$ $$f(x-2h) = f(x) - 2f'(x)h+\frac{4}{2!}f''(x)h^2-\frac{8}{3!}f^{(3)}(x)h^3\quad (4)$$

When I use equations $(1)$ and $(2)$, and add them by sides, I can get the 3-point formula:

$$f(x+h) + f(x-h) = 2f(x) + f''(x)h^2\quad (5)$$

$$f''(x) = \frac{f(x-h) - f(2x) + f(x+h)}{h^2}$$

However when I try to do this with all the equations $(1)$-$(4)$ I get:

$$f(x+h) + f(x-h) = 2f(x) + f''(x)h^2 \quad (6)$$
$$f(x+2h) + f(x-2h) = 2f(x) +4f''(x)h^2\quad (7)$$

Then I can try subtracting $(6)$ from $(7)$ and I get:

$$f(x+h) + f(x-h) - f(x+2h) - f(x-2h) = 3 f''(x)h^2\quad (8)$$

which gives

$$f''(x) = \frac{f(x+h) + f(x-h) - f(x+2h) - f(x-2h) } {3 h^2} \quad(9)$$

This is clearly different from what I am expecting. Also doing $(6)$+$(7)$ doesn't seem to yield correct coefficients, even though it preserves $f(x)$ term.

Could you point out flaw in the approach and provide correct reasoning or any materials? All I found were very general or final answers with no explicit transformations. I feel kinda stupid being unable to get it right but I can't spot the flaw.

share|improve this question
    
Please check your first formula for typos: $dh$ for $h$, $16(x-dh)$ where presumably $16(x+h)$ is meant. –  Christian Blatter Dec 20 '12 at 17:39
    
@ChristianBlatter Yes, sorry. h and dh mean exactly the same. Sorry for inconsistency. I edited the question to unifiy it. –  luk32 Dec 20 '12 at 17:43
    
I can't check right now, but I think there is a simple issue, but have to run at the moment. However, look at Five - Point, and derive the First Derivative formula and you might see what I am talking about (rederive the "Obtaining the Formula" section) and I think it shows where you might be going astray. I will try it myself as soon as I can. –  Amzoti Dec 20 '12 at 17:57

2 Answers 2

up vote 3 down vote accepted

For more familiar notation, I write e.g. $x\pm h$ instead of $x \pm dh$ as in your question.

Accounting for typos (please see @ChristianBlatter 's comment on your question), note that the Taylor expansions you wrote out imply the following:

$16 f(x+h) - 16 f(x-h) = 32 f(x) + 16 h^2 f''(x)$

and

$f(x+2h) - f(x-2h) = 2f(x) + 4 h^2 f''(x).$

Subtracting the second equation from the first yields

$16 f(x+h) - 16 f(x-h) - f(x+2h) + f(x-2h) = 30 f(x) - 12 h^2 f''(x)$,

which can be solved for $f''(x)$ by moving $30 f(x)$ to the other side and dividing by $12 h^2$. We get

$f''(x) = \dfrac{16 f(x+h) - 16f(x-h) - 30 f(x) + f(x-2h) - f(x+2h)}{12 h^2}$,

which is perhaps that which you were looking for...

share|improve this answer
    
Ha! I knew it was stupid-level easy. Thank you. However, why use such weights, and is the formula (9) wrong or less accurate ? It just looks like dropping in some weights to increace imporantce of points closer to the $x$. Am I right? –  luk32 Dec 21 '12 at 5:00
    
@luk32: The question in your comment is answered by the last sentence of my answer. –  John Bentin Dec 21 '12 at 9:56
    
@JohnBentin Yeah I got it after a while. Precisely after I read your answer for 3rd time and already had a morning coffe. Too bad I can't accept both answers but I upvoted yours too as it helped me understand the difference. Thank You ! –  luk32 Dec 21 '12 at 9:59

You are on the right track, but you need to take the Taylor series up to the term in $h^4$. Add the series for $f(x+h)$ to the one for $f(x-h)$, which cancels the terms in $h$ and $h^3$, to obtain an expression involving only even powers of $h$. Do the same for the series for $f(x+2h)$ and $f(x-2h)$ to get another expression involving $h^2$ and $h^4$. Now take $16$ times the first expression from the latter one to eliminate $h^4$, and rearrange algebraically to get the required result.

This method shows that the result is accurate up to the fourth order of Taylor approximation. You could get the same result by choosing suitable linear combinations of the second-order approximations, but that wouldn't demonstrate that the accuracy is any better than second-order.

share|improve this answer

Your Answer

 
discard

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.