0
$\begingroup$

So, Let $f(x) = \frac{1} {1 + x^2}$, $f'(x) = Af(x-2h) + Bf(x-h) + Cf(x) + Df(x+h) + Ef(x+2h)$, Use central difference scheme to approximate $f'(1)$ to show the order of convergence and the de-stabilization of the numerical methods of $h$.

So using central difference formula i've gotten this far, but im stuck as what to do next:

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

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

do i plug in 1 for x? What do i have to do or use with the other equation? My notes on the matter just show scientific notation.

::::EDIT::::

I decided to take another approach, i expanded the taylor series and multiplied by $\frac{1}{1+x^2}$. So i get something link this: $ \frac{f(x)}{2h+2hx^2} + \frac{f'(x)}{2h+2hx^2} + \frac{f''(x)}{4h+4hx^2} + \frac{f'''(x)h^2}{6h + 6hx^2} - \frac{f'(x)}{2h+2hx^2} + \frac{f''(x)}{4h+4hx^2}-\frac{f'''(x)h^2}{6h + 6hx^2} $ Then we remove like terms and simplify: $ \frac{f'(x)}{h + hx^2} + \frac{f'''(x)h^2}{3h + 4hx^2} + \frac{f''''(x)h^4}{5h + 5hx^2} $ somehow $\frac{f'''(x)h^2}{3h + 3hx^2}$ is chosen to be $\frac{f(c)h^2}{3h+3hx^2}$ and is rewritten as $theta(h^2)$ and this makes it the central difference a scheme of order two.

$\endgroup$
  • $\begingroup$ I decided to take another approach: $\endgroup$ – Undead Cosmonaut Nov 2 '17 at 4:04
0
$\begingroup$

To give the overall idea without completely solving your homework, change to the second derivative and another function.

I take it that the approximation formula has to make the best of all 5 function values. At first, forget about the specific form of $f$, only use that it is sufficiently often continuously differentiable. Then by combining Taylor series the normal central difference formula has error terms $$ D_2(x,h)=\frac{f(x-h)-2f(x)+f(x+h)}{h^2}=f''(x)+\frac{2f^{(4)}(x)}{4!}h^2+\frac{2f^{(6)}(x)}{6!}h^4+\frac{2f^{(8)}(x)}{8!}h^6+... $$ Now replace $h$ by $2h$ in that formula$$ D_2(x,2h)=\frac{f(x-2h)-2f(x)+f(x+2h)}{4h^2}=f''(x)+\frac{2\cdot 2^2f^{(4)}(x)}{4!}h^2+\frac{2⋅2^4f^{(6)}(x)}{6!}h^4+\frac{2⋅2^6f^{(8)}(x)}{8!}h^6+... $$ Now it is easy to see what combination of both formulas will eliminate the leading quadratic error term $$ 4D_2(x,h)-D_2(x,2h)=3f''(x)-\frac{2⋅(2^4-4)f^{(6)}(x)}{6!}h^4+O(h^6) $$ giving the formula \begin{align} D_4(x,h)=\frac{4D_2(x,h)-D_2(x,2h)}3 &=\frac{-f(x-2h)+16f(x-h)-30f(x)+16f(x+h)-f(x+2h)}{12h^2}\\ &=f''(x)-\frac{f^{(6)}(x)}{90}h^4+O(h^6) \end{align}

For $f(x)=\sin(x)$ where we know $f''(x)=-\sin(x)=f^{(6)}(x)$, we can try to numerically confirm that picture

enter image description here

where the error is drawn together with the numerical error bound composed of bounds for the floating point evaluation and the leading error term $$ \frac{64|f(x)|\epsilon}{12h^2}+\frac{|f^{(6)}(x)|}{90}h^4 $$ where $ϵ\simeq 10^{-16}$ is the floating point machine constant. As to be expected from this formula, the error is minimal where the terms are equal, around $h\sim\sqrt[6]{500ϵ}\approx 0.006$.

$\endgroup$
  • $\begingroup$ wow, okay, i somewhat get it, but what about these two equations that were provided, what purpose do they serve? : $f(x) = \frac{1} {1 + x^2}$, $f'(x) = Af(x-2h) + Bf(x-h) + Cf(x) + Df(x+h) + Ef(x+2h)$ $\endgroup$ – Undead Cosmonaut Nov 2 '17 at 18:33
  • $\begingroup$ You have to determine these numbers $A,B,C,D,E$. They are universal constant relative to $f$ and should be scalar multiples of $1/h$. $\endgroup$ – LutzL Nov 2 '17 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.