In this we are going to understand the difference in the error by numerical method for different order of approximations and at the same time for different values of grid space(dx).
The function is
The computation of the function was done at x=pi/3 and gridspace of dx ranging from pi/4 to pi/400.
I created fuctions of 1st, 2nd and 4th order of approximation and called them in the main code.
From the graph we can clearly see that as the grid spacing decreases, the error also reduces. It is lucid from a cursory glance that as the order of approximation increses the error falls significantly.