2

I have a doubt on how to solve this problem, I don't know what does it mean.

Calculate two approximations by differentiation of first order with different truncation error and compare them with the analytic solution of the following given functions in the intervals and size of steps specified. Don't forget to graphic your results. $y=x^4-2x^2+1, x\in(-2,2), h=0.2, 0.1$

What is supposed I must do? I was thinking about defining a function $g(x)=\frac{f(x+h)-f(x)}{h}$ in the interval $(-2,2)$ for example for $h=0.2.$ (In this case I take the forward-difference formula) and then compare the graphic of it with the graphic of the derivative. Am I right on this?

Moo
  • 11,311

1 Answers1

0

The formulas are given by

Two-point Forward Difference Formula (FDF): $$f(x) ≈ \dfrac{f(x + h) − f(x)}{h} $$

Two-point Backward Difference Formula (BDF): $$f(x) ≈ \dfrac{f(x) − f(x − h)}{h}$$

Two-point Central Difference Formula (CDF): $$f(x) ≈ \dfrac{f(x + h) − f(x)}{h}$$

The truncation errors are $O(h)$ for FDF and BDF and $O(h^2)$ for CDF.

Here are three captures for all three at $x = -2, 0, 2$, $h = 0.2$

enter image description here

enter image description here

enter image description here

Here is a movie over the entire range (notice it provides graphs, values and errors)

enter image description here

Moo
  • 11,311