landdenaw

2022-06-29

Given stepsizes ${h}_{1}$ and ${h}_{2}$ , develop a numerical scheme to approximate ${f}^{\mathrm{\prime }\mathrm{\prime }}\left({x}_{0}\right)$ with function values $f\left({x}_{0}\right)$ , $f\left({x}_{0}+{h}_{1}\right)$ and $f\left({x}_{0}+{h}_{2}\right)$ . Under what conditions will your method not work?

Lisbonaid

Step 1
If ${h}_{1}=-{h}_{2}$ , you can use second derivative midpoint formula
${f}^{{}^{″}}\left({x}_{0}\right)=\frac{1}{{h}^{2}}\left[f\left({x}_{0}-h\right)-2f\left({x}_{0}\right)+f\left({x}_{0}+h\right)\right]+o\left({h}^{3}\right)$
If ${h}_{1}\ne -{h}_{2}$ , you can do like this:
$f\left({x}_{0}+{h}_{1}\right)=f\left({x}_{0}\right)+{h}_{1}{f}^{\prime }\left({x}_{0}\right)+\frac{{h}_{1}^{2}}{2}{f}^{{}^{″}}\left({x}_{0}\right)+o\left({h}_{1}^{3}\right)$
$f\left({x}_{0}+{h}_{2}\right)=f\left({x}_{0}\right)+{h}_{2}{f}^{\prime }\left({x}_{0}\right)+\frac{{h}_{2}^{2}}{2}{f}^{{}^{″}}\left({x}_{0}\right)+o\left({h}_{2}^{3}\right)$
Minus the two equations
$f\left({x}_{0}+{h}_{2}\right)-f\left({x}_{0}+{h}_{1}\right)=\left({h}_{2}-{h}_{1}\right){f}^{\prime }\left({x}_{0}\right)+\frac{{h}_{2}^{2}-{h}_{1}^{2}}{2}{f}^{{}^{″}}\left({x}_{0}\right)+o\left({h}_{2}^{3}-{h}_{1}^{3}\right)$
and
${f}^{\prime }\left({x}_{0}\right)=\frac{f\left({x}_{0}+{h}_{2}\right)-f\left({x}_{0}+{h}_{1}\right)}{{h}_{2}-{h}_{1}}+o\left({h}_{2}^{2}-{h}_{1}^{2}\right)$
But, considering the accuracy, in general, we pick ${h}_{1}=-{h}_{2}$ , which cancels out the ${f}^{\prime }\left({x}_{0}\right)$ that has a low accuracy in a certain sense.
An alternative way to find ${f}^{{}^{″}}\left({x}_{0}\right)$ using only $f\left({x}_{0}\right)$ , $f\left({x}_{0}+{h}_{1}\right)$ and $f\left({x}_{0}+{h}_{2}\right)$ and not involving ${f}^{\prime }\left({x}_{0}\right)$ is that you should express ${f}^{\prime }\left({x}_{0}\right)$ with $f\left({x}_{0}\right)$ , $f\left({x}_{0}+{h}_{1}\right)$ and $f\left({x}_{0}+{h}_{2}\right)$ , so a potential formula is
$f\left({x}_{0}+{h}_{1}\right)=f\left({x}_{0}\right)+\frac{{h}_{1}}{{h}_{1}+{h}_{2}}\left[f\left({x}_{0}+{h}_{1}\right)+f\left({x}_{0}+{h}_{2}\right)-2f\left({x}_{0}\right)-\left(\frac{{h}_{2}^{2}-{h}_{1}^{2}}{2}{f}^{{}^{″}}\left({x}_{0}\right)\right)\right]+\frac{{h}_{1}^{2}}{2}{f}^{{}^{″}}\left({x}_{0}\right)$

Kiana Dodson

Step 1
${f}_{1}\approx {f}_{0}+{h}_{1}{f}_{0}^{\prime }+\frac{{h}_{1}^{2}}{2}{f}_{0}^{″},$
${f}_{2}\approx {f}_{0}+{h}_{2}{f}_{0}^{\prime }+\frac{{h}_{2}^{2}}{2}{f}_{0}^{″}.$
Then by elimination of ${f}_{0}^{\prime }$ , you get
${h}_{2}\left({f}_{1}-{f}_{0}\right)-{h}_{1}\left({f}_{2}-{f}_{0}\right)=\frac{{h}_{1}{h}_{2}\left({h}_{1}-{h}_{2}\right)}{2}{f}_{0}^{″}.$

Do you have a similar question?