In studies like numerical simulations and numerical methods, orders of approximation refer to how accurate an approximation is. The higher the order of approximation, the more accurate the value is. For example, a fourth order approximation value is more accurate than a first order approximation value. In this project, we are going to derive fourth order approximation for a numerical derivative equation using two different schemes and check for the consistency.

The objective here is to derive the fourth order approximation of the Skewed right-hand side scheme and the central difference scheme using Taylors table and check for the consistency.

————————— Let this be equation (1)

To derive the value of a parameter at a particular point, there are several schemes available. One of them is the Skewed right-hand scheme.

Consider the graph below:

(illustrative purposes only)

Let’s say that you wish to find the velocity at length = 2.5 units. Using the values of velocity at 0.5,1 and 1.5 units, you can find the velocity at length = 2.5 units (this is assuming that Δx = 0.5). This method is called as skewed left-side scheme.

If you use the Skewed scheme, it means you are using the values before or after a data point to find the value of the particular point. You are essentially ‘skewing’ the values from the neighbouring points in the number line to determine what the value of your desired point will be.

In this project, we will be using the skewed right-hand scheme where you will be skewing the values present at the right-hand side of the data point to determine the value of the data point.

To determine the derivative of an unknown point i, we will skew the values of the 5 neighbouring points present to the right of i.

Based on the stencil the second order derivative can be written as

Using the Taylor’s Table method, we can find out the coefficients of a,b,c,d,e,h:

We have 6 unknows and therefore we need 6 equations. From the Taylors table, the equation formed from the f”(x) can be assumed to be one as we need the approximation for the 2nd order derivative. The other equations excepting the fVI(x) can be assumed to be zero.

Thus, the equations created are

a + b + c + d + e + h = 0;

b + 2*c + 3*d + 4*e + 5*h = 0

b/2 + 2*c + 32*d/2 + 42*e/2 + 52*h/2 = 1

b/6 + 23*c/6 + 33*d/6 + 43*e/6 + 53*h/6 = 0

b/24 + 24*c/24 + 34*d/24 + 44*e/24 + 54*h/24 = 0

b/120 + 25*c/120 + 35*d/120 + 45*e/120 + 55*h/120 = 0

Upon solving all the equations,

a = 3.75

b = -12.83

c = 17.83

d = -13

e = 5.083

h = -0.8333

Let this be equation 2.

This equation further gets reduced to:

Let this be equation 3.

Upon dividing equation 3 by we get,

The term denotes the truncation error and the order of approximation. Therefore, the derived equation is of 4th order for the 2nd derivative.

The 2nd derivative for ex is also ex. Now, we will write a code in MATLAB to solve the equation from different values of dx. Upon execution, we achieve the following plot. The snippet of the code loop is shown below.

This is the loop used to calculate the numerical derivative at different time steps

The result is plotted using a loglog plot. The result obtained via plotting shows that the scheme is consistent.

From the above chart, we can see that for lower value of dx the error value is also low, but when the value of dx becomes too small we start to face the round off error.

In this chart we can see that, for very low values of dx (>100) the system rounds off the value and this causes an error in the system. So as the value of dx goes lower after a particular minimum value, we can see that the error starts to increase.

Central difference scheme is another scheme we can use to derive the value of a parameter at a particular point. Consider the same graph we discussed above:

(illustrative purposes only)

To find the velocity at 2.5 units using the central difference scheme, you will be using the values of the velocity at 2 units and 3 units to find the average value of velocity at 2.5 units (assuming Δx=0.5). In other words, you will average the values of the points present before and after unknown point in the number line to determine what the value of your desired point will be.

To determine the value of the data point i, we will consider two set of data points before and after the point i to find the average value of i.

Based on the stencil the second order derivative can be written as

Using the Taylor’s Table method, we can find out the coefficients of a,b,c,d,e:

a + b + c + d + e = 0

2*a + b + d + 2*e = 0

22*a/2 + b/2 + d/2 + 22*e/2 = 1

23*a/6 + b/6 + d/6 + 23*e/6 = 0

24*a/24 + b/24 + d/24 + 24*e/24 = 0

-25*a/120 -b/120+d/120+25*e/120 =? —————————————-(I)

Upon finding the coefficients,

a = -0.0833

b = 1.33

c = -2.5

d = 1.33

e = -0.0833

substituting the values in (I) the equation become zero, so

Rewriting the order term and dividend the equation by we get

Now the truncation error term denotes that the order of the approximation is 4th order.

Solving the above scheme in MATLAB, we can see that the value of error decreases with decrease in dx. The plot appears like this:

On further decreasing the value of dx we can see that the roundoff error again starts to show like it did above:

You can see for the given function the roundoff error starts to show up as dx is reduced.

Thus, we have successfully derived the 4th order approximation for the 2nd derivative and checked for its consistency.

This procedure of deriving the fourth order approximation is however not followed by commercial or industrial sectors but rather only by researchers. Commercial software discretizes up to third order differentiation for approximate results in reasonable time.

Get a 1-on-1 demo to understand what is included in the CAE course and how it can benefit you from an experienced career consultant.

Request a Demo Session