Week 3.5 - Deriving 4th order approximation of a 2nd order derivative using Taylor Table method
OBJECTIVE:
We have to derive the following 4th order approximation of the second-order derivative using:-
1. Central difference
2. Skewed right-sided difference
3. Skewed left-sided difference
Also, we have to prove that our skewed schemes are fourth-order accurate.
Therefore we have to write a program in Matlab to evaluate the second-order derivative of the analytical function "exp(x)*cos(x)" and compare it with the 3 numerical approximations that you have derived.
a. We have to provide a plot that compares the absolute error between the above-mentioned schemes
b. Also we have to describe why a skewed scheme is useful? What can a skewed scheme do that a CD scheme cannot do?
Derivation of the 4th order approximation of the Second-Order Derivative
Using the Central Difference method:
Since we’re deriving using central difference; our numerical stencil will look like this,
--(i-2)------(i-1)-------(i)-------(i+1)-------(i-1)---
Here, we’re computing 4th order approximation at point (i), where we take information from the four-point surrounding (i); i.e. we’re going to take two points on the left of (i) and two points on the right of (i). Let those points be (i-2), (i-1), (i+1), and (i+2) and the distance between each of them is (∆x).">(dx) which is our step size. Our numerical stencil will look like as shown in the above figure.
Based on the above stencil our hypothesis equation will be:-
∂^2u/∂x^2=af(i-2)+bf(i-1)+cf(i)+df(i+1)+ef(i+2) ------------(1)
In order to find the values of coefficient(a,b,c,d,e),">(a,b,c,d,e),we’re going to use the Taylor table method. Writing Taylor series expansion for each term of equation above as:-
(a)f(i−2)=(a)f(i)−[(a)f′(i)(2dx)]/1! + [(a)f′'(i)(2dx)^2]/2! −[(a)f′''(i)(2dx)^3]/3! +[(a)f′'''(i)(2Δx)^4]4!
−[(a)f′''''(i)(2dx)^5]/5! +[(a)f′'''''(i)(2dx)^6]/6!+----------
(b)f(i−1)=(b)f(i) − [(b)f′(i)(dx)]/(1!) + [(b)f′'(i)(dx)^2]/(2!) − [(b)f′''(i)(dx)^3]/(3!)
+ [(b)f′'''(i)(dx)^4]/(4!) − [(b)f′''''(i)(dx)^5]/(5!) + [(b)f′'''''(i)(dx)^6]/(6!) + -----
(c)f(i)=(c)f(i)
(d)f(i+1) = (d)f(i) + [(d)f′(i)(dx)]/(1!) + [(d)f′'(i)(dx)^2]/(2!) + [(d)f′''(i)(dx)^3]/(3!) + [(d)f′'''(i)(dx)^4]/(4!) + [(d)f′''''(i)(dx)^5]/(5!)+ [(d)f′'''''(i)(dx)^6]/(6!)+⋯
(e)f(i+2) = (e)f(i) + [(e)f′(i)(2dx)]/(1!) + [(e)f′'(i)(2dx)^2]/(2!) + [(e)f′''(i)(2dx)^3]/(3!)
+ [(e)f′'''(i)(2dx)^4]/(4!) − [(e)f′''''(i)(2dx)^5]/(5!) + [(e)f′'''''(i)(2dx)^6]/(6!)+⋯
By arranging the above Taylor series expansions in Taylor table; we get:-
Note: Here ∆x=dx i.e Step Size

Note: Only for the first five terms we assume our hypothesis. That’s why we can’t say about the last two terms.
Here we have five unknowns, so, we have to solve five equations and get values of coefficients (a,b,c,d,e).">(a,b,c,d,e).(a,b,c,d,e). We are going to form these equations by adding terms for the individual columns. The summation of coefficients of `f''(i) is equal to 1, andf(i),f′(i),f′′(i),f′′′(i),f′′′′(i)">f(i),f′(i),f′'(i),f′''(i),f′'''(i)f(i),f′(i),f′′(i),f′′′(i),f′′′′(i) are equal to 0; because we want to calculate the second-order derivative, f′′(i).">f′'(i).f′′(i).
Therefore, the five equations are:
a+b+c+d+e=0">a+b+c+d+e=0a+b+c+d+e=0 ……….. (I)
-2a-b+0+d+2e=0">−2a−b+0+d+2e=0-2a-b+0+d+2e=0 ……….. (II)
2a+b2+0+d2+2e=1">2a+b2+0+d2+2e=12a+b2+0+d2+2e=1 ……….. (III)
-8a6-b6+0+d6+8e6=0">−8a6−b6+0+d6+8e6=0-8a6-b6+0+d6+8e6=0 ……….. (IV)
16a24+b24+0+d24+16e24=0">16a24+b24+0+d24+16e24=016a24+b24+0+d24+16e24=0 ……….. (V)
To get the solution of the above equations, we have to solve the above equations in matrix form; AX=B.

After solving the above matrix, we get the values of all the coefficients as:
a=-0.083333">a=−0.083333a=-0.083333
b=1.333333">b=1.333333b=1.333333
c=-2.500000">c=−2.500000c=-2.500000
d=1.333333">d=1.333333d=1.333333
e=-0.083333">e=−0.083333e=-0.083333
Here, we can easily notice that a=e and b=d.
Now, on dividing both side of my hypothesis equation (1) by (dx^2); we get:
(∂^2u)/(∂x^2) = [af(i-2)+bf(i-1)+cf(i)+df(i+1)+ef(i+2)]/(dx^2)
After putting the values of all the coefficients (a,b,c,d,e) in the above equation, we will get the fourth-order central difference approximation for the second-order derivative.
∂^2u/∂x^2 =[(−0.083333)f(i−2)+(1.333333)f(i−1)+(−2.500000)f(i)+(1.333333)f(i+1)+ (−0.083333)f(i+2)] / (Δx2)
Now, from our Taylor table
∂^2u/(∂x^2) = (a+b+c++d+e)f(i) + (−2a−b+0+d+2e) f′(i)dx + (2a+1/2b+0+1/2d+2e)f′'(i)dx^2
+ (−8/6a−1/6b+0+1/6d+8/6e)f′''(i)dx^3 + (16/24a+1/24b+0+1/24d+16/24e)f′'''(i)dx^4
+(−32/120a−1/120b+0+1/120d+32/120e)f′''''(i)dx^5
+(64/240a+1/240b+0+1/240d+64/240e)f′'''''(i)dx^6
To get second-order derivative the coefficient of f′′(i)">f''(i)f′′(i) has to be 1. And as we want approximation for the second-order derivative, so, the term f(i),f′(i),f′′′(i),f′′′′(i)">f(i),f′(i),f′''(i),f′'''(i)f(i),f′(i),f′′′(i),f′′′′(i) will have to ignore or set to ‘0’ in the above equation and dividing the above equation by (∆x2)">(Δx2)(∆x2), we get:
∂^2u/(∂x^2)=(2a+1/2b+0+1/2d+2e)f′'(i)+ [(64/240a+1/240b+0+1/240d+64/240e)f′'''''(i)]dx^4
In the above equation, the term dx^4 denotes the truncation error. Here, we can see that the order of the truncation error; (dx^4) is ‘4’. Since we know that the order of approximation is defined by the truncation error term. Therefore, we can say that our central difference scheme is 4th order accurate.
After putting the value of (a,b,c,d,e)">(a,b,c,d,e)(a,b,c,d,e) in the above equation, the final equation looks like this:
∂^2u/(∂x^2) = (2(−0.083333)+1.3333332+1.3333332+2(0.083333))f′'(i)+ (64/240(−0.083333)+ (1.333333/240)+(1.333333/240) + 64/240(0.083333))f′'''''(i)dx^4
2. Using Skewed Right-Sided Difference:
To derive 4th order skewed right-sided difference at point (i) of function. Since we’re using the skewed right-sided method, here we have to define five points on the right of (i). Let those points be (i+1), (i+2), (i+3), (i+4), and (i+5); with a spacing of dx each.
The numerical stencil will look like this:
(i)------(i+1)-------(i+2)-------(i+3)-------(i+4)-------(i+5)------(i+6)
According to the above stencil, our hypothesis equation will be:
∂^2u/(∂x)^2 = af(i)+bf(i+1)+cf(i+2)+df(i+3)+ef(i+4)+gf(i+5)---------(1)
In order to find the values of coefficients (a,b,c,d,e,g), we’re going to use the Taylor table method.
Writing Taylor series expansion for each term of equation (1) as:-
(a)f(i)=af(i)
(b)f(i+1)=(b)f(i)+(b)f′(i)(dx)/1!+[(b)f′'(i)(dx)^2]/2!+[(b)f′''(i)(dx)^3]/3!+[(b)f′'''(i)(dx)^4]/4! +
[(b)f′''''(i)(dx)^5]/5!+[(b)f′'''''(i)(dx)^6]/6! + .......
(c)f(i+2) = (c)f(i) + [(c)f′(i)(2dx)]/1!+[(c)f′'(i)(2dx)^2]/2!+[(c)f′''(i)(2dx)^3]/3!+[(c)f′'''(i)(2dx)^4]/4!
+[(c)f′''''(i)(2dx)^5]/5!+ [(c)f′'''''(i)(2dx)^6]/6!+⋯
d)f(i+3) = (d)f(i)+[(d)f′(i)(3dx)]/1!+[(d)f′'(i)(3dx)^2]/2! + [(d)f′''(i)(3dx)^3]/3! + [(d)f′'''(i)(3dx)^4]/4!
+[(d)f′''''(i)(3dx)^5]/5!+[(d)f′'''''(i)(3dx)^6]/6!+⋯
(e)f(i+4) = (e)f(i)+[(e)f′(i)(4dx)]/1!+[(e)f′'(i)(4dx)^2]/2!+[(e)f′''(i)(4dx)^3]/3!+[(e)f′'''(i)(4dx)^4]/4!+
[(e)f′''''(i)(4dx)^5]/5! + [(e)f′'''''(i)(4dx)^6]/6!+⋯
(g)f(i+5) = (g)f(i) + [(g)f′(i)(5dx)/1! + [(g)f′'(i)(5dx)^2]//2! + [(g)f′''(i)(5dx)^3]/3!+[(g)f′'''(i) (5dx)^4]/4!+[(g)f′''''(i)(5dx)^5]/5!+[(g)f′'''''(i)(5dx)^6]/6!+⋯
By arranging the above Taylor series expansions in Taylor table; we get:-
Note: Here ∆x=dx i.e Step Size

Only for the first six terms, we assume our hypothesis. That’s why we can’t say about the last term.
Here we have six unknowns, so, we have to solve six equations and get values of coefficients (a,b,c,d,e,g). We are going to form these equations by adding terms for the individual columns. The summation of coefficients of f′′(i) is equal to 1, and f(i),f′(i),f′′(i),f′′′(i),f′′′′(i),f′′′′′(i)" is equal to 0; because we want to calculate the second-order derivative, f′′(i).
Therefore, the six equations are:-
a+b+c+d+e+g=0 ……….. (I)
0+b+2c+3d+4e+5g=0……….. (II)
0+b2+2c+9d/2+8e+25g/2=1……….. (III)
0+b6+8c/6+27d/6+64e/6+125g/6=0……….. (IV)
0+b/24+16c/24+81d/24+256e/24+625g/24=0 ……….. (V)
0+b/120+32c/120+243d/120+1024e/120+3125g/120=0 ……….. (VI)
To get the solution of the above equations, we have to solve the above equations in matrix form; AX=B.

After solving the above matrix, we get the values of all the coefficients as:-
a=3.75000
b=-12.83333
c=17.83333
d=-13.00000
e=5.08333
g=-0.83333
Now, dividing both side of my hypothesis equation (1) by (dx^2) we get:
∂^2u/∂x^2 = af(i)+bf(i+1)+cf(i+2)+df(i+3)+ef(i+4)+gf(i+5)/(dx^2)
After putting the values of all the coefficients (a,b,c,d,e,g) in the above equation, we will get the fourth-order skewed right-sided difference approximation for second-order derivative.
∂^2u/(∂x^2) = [(3.75000)f(i)+(−12.83333)f(i+1)+(17.83333)f(i+2)+(−13.00000)f(i+3)+ (5.083333)f(i+4)+(−0.83333)f(i+5)]/(dx^2)
Now, from our Taylor table:-
∂^2u∂x^2 =
(a+b+c+d+e+g)f(i) + (0+b+2c+3d+4e+5g)f (i)dx + (0+b2+4c/2+9d/2+16e/2+25g/2)f′'(i)dx^2
+ (0+b6+8c/6+27d/6+64e/6+125g/6)f′''(i)dx^3+ (0+b2/4+16c/24+81d/24+256e/24+625g/24)f′'''(i)dx^4+ (0+b/120+32c/120+243d/120+1024e/120+3125g/120)f′''''(i)dx^5+(0+b/720+64c/720+729d/720+4096e/720+15625g/720)f′'''''(i)dx^6
To get second-order derivative the coefficient of f′′(i) has to be 1. And as we want approximation for the second-order derivative, so, the termf(i),f′(i),f′′′(i),f′′′′(i),f′′′′′(i)" will have to ignore or set to '0' in the above equation. On substituting the values of (I), (II), (IV), (V), and (VI) in the above equation and dividing the above equation by (dx^2) we’ll get:
∂^2u/∂x^2 =
(b/2+2c+9d/2+8e+25g/2)f′'(i)+ (b/720+64c/720+729d/720+4096e/720+15625g/720)f′'''''(i)dx^4
As we discussed earlier also, the dx^4 denotes the truncation error. Here we can see that order of the truncation error; (dx^4)] is '4'. Since, we know that the order of approximation is defined by the truncation error term. Therefore, we can say that our skewed right-sided difference scheme is of 4th order accurate.
3. Using Skewed Left-Sided Difference:
To derive 4th order skewed left-sided difference at point (i) of function. Since we’re using the skewed left-sided method, here we have to define five points on the left of (i). Let those points be (i-1), (i-2), (i-3), (i-4), and (i-5); with a spacing of ∆x">Δx∆x each.
The numerical stencil will look like this:
(i-5)------(i-4)-------(i-3)-------(i-2)-------(i-1)-------(i)
According to the above stencil and the steps used in the SKEWED RIGHT-SIDED DIFFERENCING, Similiarly using same steps to form the equation our hypothesis equation will be and the values of coefficients (a,b,c,d,e,g) are :
∂^2u/∂x^2 = af(i-5)+bf(i-4)+cf(i-3)+df(i-2)+ef(i-1)+gf(i)
Writing Taylor series expansion for each term of equation (1) as:-
(a)f(i−5) = (a)f(i)−[(a)f′(i)(5dx)/(1!)+[(a)f′'(i)(5dx)^2]/(2!)−
[ (a)f′''(i)(5dx)^3]/(3!)+[(a)f′'''(i)(5dx)^4]/(4!)−[(a)f′''''(i)(5dx)^5]/(5!)+[(a)f′'''''(i)(5dx)^6]/(6!)
(b)f(i−4) = (b)f(i)−[(b)f′(i)(4dx)]/(1!)+[(b)f′'(i)(4dx)^2]/(2!)−[(b)f′''(i)(4dx)^3]/(3!)+
[(b)f′'''(i)(4dx)^4]/(4!)−[(b)f′''''(i)(4dx)^5]/(5!)+[(b)f′'''''(i)(dx)^6]/(6!)+⋯
(c)f(i−3) = (c)f(i)−[(c)f′(i)(3dx)]/(1!)+[(c)f′'(i)(3dx)^2]/(2!)−[(c)f′''(i)(3dx)^3]/(3!)+
[(c)f′'''(i)(3dx)^4]/(4!)−[(c)f′''''(i)(3dx)^5]/(5!)+[(c)f′'''''(i)(3dx)^6]/(6!)+⋯
(d)f(i−2)=(d)f(i)−[(d)f′(i)(2dx)]/(1!)+[(d)f′'(i)(2dx)^2]/(2!)−[(d)f′''(i)(2dx)^3]/(3!)+[(d)f′'''(i)(2dx)^4]/(4!)− [(d)f′''''(i)(2dx)^5]/(5!)+[(d)f′'''''(i)(2dx)^6]/(6!)+⋯
(e)f(i−1)=(e)f(i)−[(e)f′(i)(dx)]/(1!)+[(e)f′'(i)(dx)^2](2!)−[(e)f′''(i)(dx)^3]/(3!)+[(e)f′'''(i)(dx)^4]/(4!)− [(e)f′''''(i)(dx)^5]/(5!)+[(e)f′'''''(i)(dx)^6]/(6!)+⋯
(g)f(i)=(g)f(i)(g)f(i)=(g)f(i)
By arranging the above Taylor series expansions in Taylor table; we get:-(a)f′'''''(i)(5dx)6(6!)

Only for the first six terms, we assume our hypothesis. That’s why we can’t say about the last term.
Here we have six unknowns, so, we have to solve six equations and get values of coefficients (a,b,c,d,e,g).">(a,b,c,d,e,g).(a,b,c,d,e,g). We are going to form these equations by adding terms for the individual columns. The summation of coefficients of f′′(i)">f′'(i)f′′(i) is equal to 1, and f(i),f′(i),f′′(i),f′′′(i),f′′′′(i),f′′′′′(i)">f(i),f′(i),f′'(i),f′''(i),f′'''(i),f'''''(i)f(i),f′(i),f′′(i),f′′′(i),f′′′′(i),f′′′′′(i) is equal to 0; because we want to calculate the second-order derivative, f′′(i).">f''(i).f′′(i).
Therefore, the six equations are:-
a+b+c+d+e+g=0 ……….. (I)
-5a-4b-3c-2d-e+0=0 ……….. (II)
25a/2+8b+9c/2+2d+e/2+0=1 ……….. (III)
625a/24+256b/24+81c/24+16c/4+e/24+0=0 ……….. (V)
-3125a/120-1024b/120-243c/120-32d/120-e/120+0=0 ……….. (VI)
To get the solution of the above equations, we have to solve the above equations in matrix form; AX=B.

After solving the above matrix, we get the values of all the coefficients as:-
a=-0.83333
b=5.08333
c=-13.00000
d=17.83333
e=-12.83333
g=3.75000
Now, Similiar to the the steps used in the SKEWED RIGHT-SIDED DIFFERENCING,the equation will be and to get second-order derivative the coefficient of f′′(i)">f''(i)f′′(i) has to be 1. And as we want approximation for the second-order derivative, so, the term f(i),f′(i),f′′′(i),f′′′′(i),f′′′′′(i) will have to ignore or set to 0
Therefore the final eqaution will be
∂^2u/∂x^2=(25a/2+8b+9c/2+2d+e/2+0)f′'(i)dx^2+ (15625a/720+4096b/720+729c/720+64d/720+e/720+0)f′'''''(i)dx^6
On dividing the above equation byΔx2,∆x2,; we get:-
∂^2u/∂x^2 = (25a/2+8b+9c/2+2d+e/2)f′'(i)+ (15625a/720+4096b/720+729c/720+64d/720+e/720)f′'''''(i)dx^4
As we discussed earlier also, the dx^4denotes the truncation error. Here we can see that order of the truncation error; [dx^4)] is ‘4’. Since, we know that the order of approximation is defined by the truncation error term. Therefore, we can say that our skewed left-sided difference scheme is of 4th order accurate.
Program in MATLAB to Evaluate the Second-Order Derivative of the analytical function exp(x)*cos(x) and compare it with the numerical approximation that we have derived above
Firstly we’re going to write functions programs for
(1)central differencing
(2)skewed right-sided differencing
(3) skewed left-sided differencing errors at a particular point (x, dx),
where dx=step size
These function files will be used directly in the main program for calculating errors
Function for central difference 4th order
% Creating function for the 4th order approximation of the second-order; derivative using central difference;
function error_central_differencing = central_differencing(x,dx)
% Analytical function f(x) = exp(x)*cos(x);
% f''(x) = -2*exp(x)*sin(x);
analytical_derivative = -2*exp(x)*sin(x);
% values of coefficients calculated from our Taylor table;
a=-0.083333;
b=1.333333;
c=-2.500000;
d=1.333333;
e=-0.083333;
% Now for numerical derivative; central differencing =((a*f(x-2*dx))+(b*f(x-dx))+(c*f(x))+(d*f(x+dx))+(e*f(x+2*dx)))/dx^2;
%Therefore the central difference fourth order approximation;
central_differencing_fourth_order_approx = ((a*exp(x-2*dx)*cos(x-2*dx))+(b*exp(x-dx)*cos(x-dx))+(c*exp(x)*cos(x))+(d*exp(x+dx)*cos(x+dx))+(e*exp(x+2*dx)*cos(x+2*dx)))/dx^2;
error_central_differencing = abs(central_differencing_fourth_order_approx-analytical_derivative);
end
Function for skewed right-sided difference 4th order
% Creating function for the 4th order approximation of the second-order derivative using skewed right-sided difference;
function error_skewed_right_sided=skewed_right_sided(x,dx)
% analytical function f(x)=exp(x)*cos(x);
%f''(x)=-2*exp(x)*sin(x);
analytical_derivative=-2*exp(x)*sin(x);
%values of coefficients calculated from our Taylor table;
a=3.75000;
b=-12.83333;
c=17.83333;
d=-13.00000;
e=5.08333;
g=-0.83333;
%numerical derivative FOR
%skewed right-sided differencing=((a*f(x))+(b*f(x+dx))+(c*f(x+2*dx))+(d*f(x+3*dx))+(e*f(x+4*dx))+(g*f(x+5*dx)))/dx^2;
%skewed right-sided fourth order approximation;
skewed_right_sided_fourth_order_approx=((a*exp(x)*cos(x))+(b*exp(x+dx)*cos(x+dx))+(c*exp(x+2*dx)*cos(x+2*dx))+(d*exp(x+3*dx)*cos(x+3*dx))+(e*exp(x+4*dx)*cos(x+4*dx))+(g*exp(x+5*dx)*cos(x+5*dx)))/dx^2;
error_skewed_right_sided=abs(skewed_right_sided_fourth_order_approx-analytical_derivative);
end
Function for skewed left-sided difference 4th order
% Creating function for the 4th order approximation of the second-order derivative using skewed left-sided difference;
function error_skewed_left_sided=skewed_left_sided(x,dx)
% analytical function f(x)=exp(x)*cos(x);
%f''(x)=-2*exp(x)*sin(x);
analytical_derivative=-2*exp(x)*sin(x);
%values of coefficients calculated from our Taylor table;
a=-0.83333;
b=5.08333;
c=-13.00000;
d=17.83333;
e=-12.83333;
g=3.75000;
%numerical derivative;
%skewed left-sided differencing=((a*f(x-5*dx))+(b*f(x-4*dx))+(c*f(x-3*dx))+(d*f(x-2*dx))+(e*f(x-dx))+(g*f(x)))/dx^2;
%skewed left-sided fourth order approximation;
skewed_left_sided_fourth_order_approx=((a*exp(x-5*dx)*cos(x-5*dx))+(b*exp(x-4*dx)*cos(x-4*dx))+(c*exp(x-3*dx)*cos(x-3*dx))+(d*exp(x-2*dx)*cos(x-2*dx))+(e*exp(x-dx)*cos(x-dx))+(g*exp(x)*cos(x)))/dx^2;
error_skewed_left_sided=abs(skewed_left_sided_fourth_order_approx-analytical_derivative);
end
Main Code for calculating 4th order error of second-order derivative using central, skewed right-sided, and skewed left-sided scheme using previously developed functions:
clear all;
close all;
clc
x=pi/3;
dx=linspace(pi/4,pi/4000,40);
for i=1:length(dx)
first_order_error(i)=first_order_approximation(x,dx(i));
second_order_error(i)=second_order_approximation(x,dx(i));
fourth_order_error(i)=fourth_order_approximation(x,dx(i));
end
%Slope of curves @ x,dx
m1=(first_order_error(1)-first_order_error(2))/(dx(1)-dx(2));
m2=(second_order_error(2)-second_order_error(1))/(dx(2)-dx(1));
m3=(fourth_order_error(2)-fourth_order_error(1))/(dx(2)-dx(1));
%Bar graph for the slope camparisio at a particular point
figure(1)
y=[m1,m2,m3];
m=categorical({'First order error','Second order error','Fourth order error'});
bar(m,y,'FaceColor',[0 .5 .5],'EdgeColor',[0 .9 .9],'LineWidth',1.5)
xlabel('order of approximation')
ylabel('slope of curve')
title('Comparision between slope of curves obtained using methods of approximation')
figure(2)
loglog(dx,first_order_error,'linewidth',1.5);
hold on
loglog(dx,second_order_error,'r','linewidth',1.5);
hold on
loglog(dx,fourth_order_error,'k','linewidth',1.5);
xlabel('Stepsize or dx');
ylabel('Absolute Value of Error')
title('Comparision between 1st/2nd/4th order of approximation of 1st order derivatives')
legend('1st order','2nd order','4th order')
Following are the plots obtained:
Figure (1) Error Vs Value of dx

Figure (2) Error Vs Value of dx Using Logarithmic Scale

After analyzing the graph between ‘error’ vs. ‘dx’ for central, skewed right-sided, and skewed left-sided difference 4th order error; we can say that central difference approximation produces more accurate solutions; hence produces lesser errors as compared to right-skewed and left-skewed difference schemes.
So now the question araises why a skewed scheme is useful? What can a skewed scheme do that a Central Diffreencing scheme cannot do?
Since we can see that the central differencing scheme gives us more immaculate solutions or lesser errors as compared to the skewed difference scheme. But it is not always viable to use the central differencing to evaluate solutions. Suppose, if we want to compute numerical approximations for a function at the boundary or corner node; we cannot use the central difference scheme at this particular situation because it requires data from both sides of the node or boundary. So, in this situation skewed difference method plays a major role; as in the skewed scheme data from one side can be used to compute numerical approximation at a point.