Exercise

Use Taylor expansion to show the following formula \[\frac{1}{h}(u(x+h)-u(x))=u'(x)+\frac{h}{2}u''(x)+\frac{h^2}{3!}u'''(x)+\mathcal{O}(h^3).\]

Exercise

Use Taylor expansion to show the following formula \[\frac{1}{h}(u(x)-u(x-h))=u'(x)-\frac{h}{2}u''(x)+\frac{h^2}{3!}u'''(x)+\mathcal{O}(h^3).\]

Exercise

Use Taylor expansion to show the following formula \[\frac{1}{2h}(u(x+h)-u(x-h))=u'(x)+\frac{h^2}{3!}u'''(x)+\mathcal{O}(h^3).\]

Exercise

We now derive the first terms in the expansion of the error for the central difference formula for the second derivative. The assumption is that u is a smooth function. Consider the central difference formula \[\frac{1}{h^2}\delta^2\,u(x)=\frac{1}{h^2}(u(x+h)-2u(x)+u(x-h)),\] and apply Taylor expansion to get \[\frac{1}{h^2}\delta^2\,u(x)=\frac{1}{h^2}[u(x)+hu'(x)+\frac{h^2}{2}u^{(2)}(x)+\frac{h^3}{3!}u^{(3)}(x)+ \frac{h^4}{4!}u^{(4)}(x)\] \[\hskip2.7cm-2u(x)+u(x)-hu'(x)+\frac{h^2}{2}u^{(2)}(x)-\frac{h^3}{3!}u^{(3)}(x)+ \frac{h^4}{4!}u^{(4)}(x)+\mathcal{O}(h^5)]\] \[\frac{1}{h^2}\delta^2\,u(x)=u^{(2)}(x)+\frac{h^2}{12}u^{(4)}(x)+\mathcal{O}(h^4).\]

Exercise

An approximation of the third derivative is given by a combination of forward and central differences

\[\frac{1}{h}\Delta\,\frac{1}{h^2}\delta^2\,u(x) \] this gives \[\frac{1}{h}\Delta\,\frac{1}{h^2}\delta^2\,u(x)=\frac{1}{h^3}(u(x+2h)-2u(x+h)+u(x)-u(x+h)+2u(x)-u(x-h)\] and \[\frac{1}{h}\Delta\,\frac{1}{h^2}\delta^2\,u(x)=\frac{1}{h^3}(u(x+2h)-3u(x+h)+3u(x)-u(x-h)).\] To figure out how the difference formula approximates the third derivative, we use the formula for the error in the approximation of the second derivative obtained in the previous exercise, we obtain: \[\frac{1}{h}\Delta\,\frac{1}{h^2}\delta^2\,u(x)=\frac{1}{h}\Delta (u^{(2)}(x)+\frac{1}{12}h^2 u^{(4)}(x)+\mathcal{O}(h^4)),\] \[\frac{1}{h}\Delta\,\frac{1}{h^2}\delta^2\,u(x)=\frac{1}{h} (u^{(2)}(x+h)+\frac{1}{12}h^2 u^{(4)}(x+h)-u^{(2)}(x)-\frac{1}{12}h^2 u^{(4)}(x)+\mathcal{O}(h^4)),\] and using Taylor expansion \[\frac{1}{h}\Delta\,\frac{1}{h^2}\delta^2\,u(x)=\frac{1}{h} (u^{(2)}(x)+hu^{(3)}(x)+\frac{h^2}{2}u^{(4)}(x)+\frac{1}{12}h^2u^{(4)}(x)-u^{(2)}(x)-\frac{1}{12}h^2u^{(4)}(x)+\mathcal{O}(h^3)),\] \[\frac{1}{h}\Delta\,\frac{1}{h^2}\delta^2\,u(x)=u^{(3)}(x)+\frac{h}{2}u^{(4)}(x)+\mathcal{O}(h^2).\]

2015-01-05, Elena Celledoni