# order of accuracy for numerically evaluating $u''(x) +u'(x) +u(x) = e^{-x^2}$ with regard to grid resolution

I was asked (an homework assignment) to apply FFT in order to approximate a solution for the ODE $$u''(x) + u'(x) + u(x) = e^{-x^2}$$ such that $$u(x)$$ satisfies the conditions: $$u(\pi) = u(-\pi) , u'(\pi) = u'(-\pi)$$.

Well this part wasn't the main problem, the conditions just says that $$u(x)$$ is a cosine series, and the rest was some technical work.

However in the second part of the question, we were asked to "Compute the order of accuracy of your code, by running it for various grid resolution, hand in convincing table/graph for the order of accuracy".

I just don't understand how does grid-resolution is related to accuracy, and what data am I suppose to extract from various-grid approximation in order to emphasis accuracy order?

An explanation for the questions' intentions, or a reference for some reading about the relation between accuracy and grid resolution, would be appreciated.

Your first conclusion of a cosine series is wrong, the ODE is not symmetric and the second boundary condition is not $$u'(π)=-u'(−π)$$ as an even symmetry would demand.
The quest for accuracy assumes that the error behaves dominantly as $$E(N)\simeq C\cdot N^{-p}$$. Taking the logarithm gives $$\log|E(N)|\simeq c-p⋅\log|N|$$ so that in a loglog plot you should get a straight line with slope $$-p$$. You can now read off the order visually or do a linear regression and round to the next integer.