Second order accurate numerical approximation for first derivative

2.2k Views Asked by At

We just learnt about one sided and centred difference approximations in class and we have been given a problem to find $a_{0}, a_{1}$ and $a_{2}$ in the below numerical approximation for a first derivative in order to make the approximation second order accurate:$$F'(x) \approx \frac{1}{\Delta x}[a_{0}F(x + \Delta x) + a_{1}F(x + 2 \Delta x) + a_2F(x + 3 \Delta x)].$$ Would it be right to say that we want the RHS to be in this form: $$\frac{F(x + \Delta x) - F(x -\Delta x)}{2 \Delta x}$$ and so, somehow, we'd manipulate the Taylor expansion of each $F(...)$ term in the first derivative approximation equation?

2

There are 2 best solutions below

0
On BEST ANSWER

The formula you mention is a centered difference, but you are required to obtain a forward difference. You just need to use Taylor's formula and compute the coefficients that cancel out the lower order terms.

$$ F(x+\Delta x)= F(x)+F'(x) \Delta x + \frac{F''(x)}{2} (\Delta x)^2 + O((\Delta x)^3) $$

$$ F(x+ 2 \Delta x)= F(x)+F'(x) 2 \Delta x + \frac{F''(x)}{2} (2 \Delta x)^2 + O((\Delta x)^3) $$

$$ F(x+3\Delta x)= F(x)+F'(x) 3\Delta x + \frac{F''(x)}{2} (3\Delta x)^2 + O((\Delta x)^3) $$

so you see that \begin{align*} F'(x)-\frac{1}{\Delta x} & (a_0 F(x+\Delta x)+a_1 F(x+2\Delta x) + a_2 F(x+3 \Delta x))\\ =& \frac{1}{\Delta x}\left(F'(x) \Delta x - a_0 (F(x)+F'(x) \Delta x + \frac{F''(x)}{2} (\Delta x)^2 + O((\Delta x)^3))\right.\\ & - a_1 (F(x)+F'(x) 2 \Delta x + \frac{F''(x)}{2} (2 \Delta x)^2 + O((\Delta x)^3))\\ & \left.- a_2 (F(x)+F'(x) 3\Delta x + \frac{F''(x)}{2} (3\Delta x)^2 + O((\Delta x)^3))\right)\\ =& \frac{1}{\Delta x}\left( -(a_0+a_1+a_2)F(x)+(1-a_0-2a_1-3a_2)F'(x)\Delta x\right.\\ & \left.-(a_0+4a_1+9a_2)F''(x) (\Delta x)^2/2 + O((\Delta x)^3)\right) \end{align*}

To get the desired accuracy you just have to set $a_0, a_1, a_2$ such that

$$ a_0+a_1+a_2=0, \quad a_0+2a_1+3a_2 = 1, \quad a_0+4a_2+9a_2=0, $$

that is $$ a_0 = -\frac 52, \quad a_1 =4, \quad a_2=-\frac 32 $$

and the formula becomes $$ F'(x) \approx \frac{1}{2\Delta x} \left(-5 F(x+\Delta x)+8F(x+2 \Delta x) - 4F(x+3 \Delta x) \right) $$

0
On

$a_0f(x+\Delta x) = a_0f(x) + a_0\Delta xf'(x) + a_0\frac{1}{2}\Delta x^2f'(x) + a_0\frac{1}{6}\Delta x^3f'''(\xi_1)$

$a_1f(x+2\Delta x) = a_1f(x) + a_12\Delta xf'(x) + a_12\Delta x^2f''(x) + a_1\frac{4}{3}\Delta x^3f'''(\xi_2)$

$a_2f(x+3\Delta x) = a_2f(x) + a_23\Delta xf(x) + a_2\frac{9}{4}\Delta x^2f''(x) + a_2\frac{9}{2}\Delta x^3f'''(\xi_3) $

this implies the augmented matrix:

$\left(\begin{array}{ccc|c} 1 & 1 & 1 & 0\\ 1 & 2 & 3 & 1 \\ \frac{1}{2} & 2 & \frac{9}{4} & 0 \end{array}\right)$

do you see why?