1
$\begingroup$

I'm working with central finite difference formulations, whose coefficients can be found here. I want to approximate the following

$\displaystyle \frac{\partial^3 f}{\partial x^3}$

Assume that I want to solve this using the following approach

$\displaystyle \frac{\partial}{\partial x} \left(\frac{\partial^2 f}{\partial x^2}\right)$

If I choose the following orders of accuracy for each approximation

$\displaystyle \frac{\partial}{\partial x} \rightarrow O(\Delta^4)$

$\displaystyle \frac{\partial^2}{\partial x^2} \rightarrow O(\Delta^2)$

What would be the resulting accuracy of the difference approximation after applying $\displaystyle \frac{\partial}{\partial x} \left(\frac{\partial^2 f}{\partial x^2}\right)$? In other words

$\displaystyle \frac{\partial}{\partial x} \left(\frac{\partial^2 f}{\partial x^2}\right)\rightarrow O(\Delta^?)$

$\endgroup$
  • $\begingroup$ What is the definition of the order of accuracy you are using? Kind of difficult to answer without that definition. $\endgroup$ – mathreadler Feb 14 '17 at 5:14
  • $\begingroup$ I'm not sure I follow. I'm looking at the coefficients given on Wikipedia (link in question "here"). In the left column, it says "accuracy". If I use a stencil of size 5 for the 1st derivative, it gives "accuracy" = 4. If I use a stencil of size 3 for the 2nd derivative, it gives "accuracy" = 2. If I perform a "recursive" operation to get the 3rd derivative, what is the resultant "accuracy"? Hope that helps clear up the question? $\endgroup$ – ThatsRightJack Feb 14 '17 at 5:37
  • $\begingroup$ No it doesn't. Without a definition "accuracy" could mean just about anything. $\endgroup$ – mathreadler Feb 14 '17 at 5:45
  • $\begingroup$ Did you look at the Wikipedia page? I'm not trying to get all technical, I'm just trying to apply the central difference method. Maybe there is more information about "accuracy" to address the issue. en.wikipedia.org/wiki/Finite_difference_coefficient $\endgroup$ – ThatsRightJack Feb 14 '17 at 6:10
  • $\begingroup$ Not trying to get all technical? But your question is impossible to answer without a definition of accuracy. You will need to get technical to be able to answer it. $\endgroup$ – mathreadler Feb 14 '17 at 6:16
1
$\begingroup$

Assuming "accuracy" refers to the order of $\Delta x$ as it appears in the leading term of the truncation error (like in the Wikipedia article), the resulting scheme is second order accurate. Indeed, applying the approximations in the order indicated in the question, we obtain a stencil with coefficients $$ \left( \frac{1}{12}, -\frac{5}{6}, \frac{17}{12}, 0, -\frac{17}{12}, \frac{5}{6}, -\frac{1}{12} \right). $$ A Taylor expansion reveals that the leading term of the truncation error is given by $$ \frac{1}{12} f^{(5)}(x) \Delta x^2, $$ where $f^{(5)}(x)$ denoted the fifth derivative of $f$ (assuming that it exists).

Update: Let's say that we have a grid $\mathbf{x}^T = (x_0, x_1, \dots, x_{n-1}, x_n)$ where $x_k = x_0 + k \Delta x$. We project the function $f(x)$ onto this grid in the form of a vector $\mathbf{f}^T = (f_0, f_1, \dots, f_{n-1}, f_n)$, where $f_k = f(x_k)$. To find the order of accuracy of our stencil, we operate on $\mathbf{f}$ at the generic point $x_k$ to obtain $$ \frac{1}{\Delta x^3} \left[ \frac{1}{12}f_{k-3} - \frac{5}{6}f_{k-2} + \frac{17}{12}f_{k-1} + 0f_k - \frac{17}{12}f_{k+1} + \frac{5}{6}f_{k+2} - \frac{1}{12}f_{k+3} \right]. \qquad (1) $$ Now, a Taylor expansion of $f_{k+j}$ (where $j$ is a positive or negative integer) around the point $x_k$ gives $$ f_{k+j} = f_k + f^{(1)}_k \frac{j^1}{1!}\Delta x^1 + f^{(2)}_k \frac{j^2}{2!}\Delta x^2 + f^{(3)}_k \frac{j^3}{3!}\Delta x^3 + \dots $$ Inserting this expansion into (1), using $j = -3, -2, \dots, 2, 3$ where appropriate, we find that

  • All terms proportional to $f_k$, $f_k^{(1)}$ and $f_k^{(2)}$ vanish (this is expected since we are approximating, not a zeroth, first or second, but a third derivative)
  • The coefficient in front of $f_k^{(3)}$ is one (meaning that the stencil is a consistent approximation of the third derivative)
  • The coefficient in front of $f_k^{(4)}$ is zero (meaning that the truncation error is not proportional to $\Delta x^1$)
  • The coefficient in front of $f_k^{(5)}$ is non-zero (meaning that the truncation error is proportional to $\Delta x^2$).

What we have shown is thus that the expression in (1) is roughly equal to $$ f_k^{(3)} + C f_k^{(5)} \Delta x^2 $$ where $C$ is some non-zero constant (in this case 1/12 if I did my calculations properly). There are of course non-zero terms proportional to $\Delta x^3$, $\Delta x^4$ etc, however in using finite difference methods it is (usually) implicitly assumed that $\Delta x \ll 1$ such that higher order terms may safely be ignored.

$\endgroup$
  • $\begingroup$ OK...at least we're on the same page. I got the same coefficients, but how did you determine it's second order accurate? Also, you said "a Taylor expansion reveals...", can you elaborate more on this? What did you apply the Taylor expansion on? You've basically answered my question, but if you can show the details on how you got here, I'll accept your answer. $\endgroup$ – ThatsRightJack Feb 14 '17 at 22:38
  • $\begingroup$ @ThatsRightJack I have updated my answer. $\endgroup$ – ekkilop Feb 15 '17 at 9:11

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.