Here are examples of numerical schemes for finite differences that have second-order accuracy:
Forward differences:
To achieve second-order accuracy using forward differences, we can use the following formula:
{df \over dx}_{x=x_0} = {-3f(x_0) + 4f(x_0 + h) - f(x_0 + 2h) \over 2h}
This formula uses three function values to approximate the derivative, which results in a higher-order approximation.
For example, suppose we have the function $f(x) = x^2$ and we want to approximate the derivative of this function at $x_0 = 2$. We can use the forward difference formula with a step size of $h = 0.1$ to get the following approximation:
{df \over dx}_{x=2} = {-3f(2) + 4f(2 + 0.1) - f(2 + 0.2) \over 20.1} = (-32^2 + 4*(2 + 0.1)^2 - (2 + 0.2)^2)/(2*0.1) = (-12 + 16.04 - 16.04)/0.2 = -0.04/0.2 = -0.2
This means that the derivative of the function at $x_0 = 2$ is approximately $-0.2$.
Backward differences:
To achieve second-order accuracy using backward differences, we can use the following formula:
{df \over dx}_{x=x_0} = {3f(x_0) - 4f(x_0 - h) + f(x_0 - 2h) \over 2h}
This formula is similar to the forward differences formula, but uses the backward difference between the function values instead.
For example, suppose we have the same function $f(x) = x^2$ and we want to approximate the derivative of this function at $x_0 = 2$. We can use the backward difference formula with a step size of $h = 0.1$ to get the following approximation:
{df \over dx}_{x=2} = {3f(2) - 4f(2 - 0.1) + f(2 - 0.2) \over 20.1} = (32^2 - 4*(2 - 0.1)^2 + (2 - 0.2)^2)/(2*0.1) = (12 - 15.96 + 15.96)/0.2 = 3.92/0.2 = 19.6
This means that the derivative of the function at $x_0 = 2$ is approximately $19.6$.
Central differences:
To achieve second-order accuracy using central differences, we can use the following formula:
{df \over dx}_{x=x_0} = {f(x_0 + h) - f(x_0 - h) \over 2h} - {h^2 \over 6} {d^3f \over dx}_{x=x_0}
This formula uses a central difference to approximate the derivative, but also includes a correction term that takes into account the third derivative of the function. This results in a higher-order approximation.
For example, suppose we have the same function $f(x) = x^2$ and we want to approximate the derivative of this function at $x_0 = 2$. We can use the central difference formula with a step size of $h = 0.1$ to get the following approximation:
{df \over dx}_{x=2} = {f(2 + 0.1) - f(2 - 0.1) \over 2*0.1} =32
Leave a Reply