[Math] Second order one-sided finite difference approximation to a partial derivative

finite differencesnumerical methodspartial derivative

For the computational grid as in following image, given are values of a variable, let's call it "v", on grid points marked by blue dots:

Computational grid

I need to calculate the second order approximation of the derivative of v along x axis in points marked by green and red dots. For green dot, the derivative approximation could be calculated as average of corresponding central difference approximations (let's say the grid size along x axis is $\Delta x$):

$$\frac{1}{2}\cdot\left(\frac{v_{2,i}-v_{1,i}}{\Delta x}+\frac{v_{2,i+1}-v_{1,i+1}}{\Delta x}\right)$$

However, on the left we have a boundary of the grid, so the same approach cannot be used for the red dot. I know, of course, about one-sided formulas for second order derivative approximation, so for example if we would have to calculate the derivative approximation at bottom-left blue point, the approximation would be:

$$\frac{-3\cdot v_{1,i}+4\cdot v_{2,i}-v_{3,i}}{\Delta x}$$

But, how to derive the approximation for the red dot?

Best Answer

I would begin with the lower left corner of the rectangle. There, we need an approximation for $f'(x)$ in terms of $$f(x+\Delta x/2) = f(x)+(\Delta x/2)f'(x) + \frac12(\Delta x/2)^2 f''(x) + \dots $$ $$f(x+3\Delta x/2) = f(x)+(3\Delta x/2)f'(x) + \frac12(3\Delta x/2)^2 f''(x) + \dots $$ $$f(x+5\Delta x/2) = f(x)+(5\Delta x/2)f'(x) + \frac12(5\Delta x/2)^2 f''(x) + \dots $$ Solving this system for $f'(x)$ yields $$ f'(x) \approx \frac{1}{\Delta x} (-2f(x+\Delta x/2)+3 f(x+3\Delta x/2) - f(x+5\Delta x/2)) $$

Since we are looking for a point midway between $i$ and $i+1$, and the only available data is either at $i$ or $i+1$, the natural approximation for $x$-derivative at the red point is
$$ \frac{1}{2\Delta x} (-2u_{1,i} + 3 u_{2,i} - u_{3,i}) + \frac{1}{2\Delta x} (-2u_{1,i+1} + 3 u_{2,i+1} - u_{3,i+1}) $$ If you are not satisfied with the informal reasoning in the last paragraph, write down the multivariable Taylor expansion for $u$ about the red point, and plug it into the above formula.

Related Question