I have a problem with assesing the accuracy of my numerical calculation. I have a 2nd order ODE. It is an eigenvalue problem of the form:
$ y'' + ay' + \lambda^2y = 0 $
and the boundary condiations are:
$ y(0) = y(1) = 0 $
This equation describes a vibrating string, clamped at x=0 and x=1, with a certain mass distribution. I want to be able to calculate the eigenvalues of this equation numerically. I do this by using the Runge-Kutta method to find solutions to the equation with initial conditions:
$ y(0) = 0, y'(0) = 1 $
with different values of $\lambda$ and then looking for the ones that are zero at x=1.
I terminate my search for eigenvalues when I find a function that has
$y(1) < \delta$
where $\delta$ is a predefined constant.
Now the problem is that I'd like to know how accurate my calculations are, i.e. how do I choose the values of $\delta$ and the stepsize used in computing the values of the potential eigenfunction, so that the error in the eigenvalue is less than, say, $ 10^{-3}$?
The exact solution as well as the numerical solution for fixed stepsize $h$ depends analytically on $λ$, at simple eigenvalues there is locally a near linear relationship between $λ$ and the right boundary value. The numerical error is not exactly smooth in the step size $h$, but its leading term can be identified with the solution of a linear system with right side the local truncation error. In total this allows to say that $$ y_{λ,h}(1)=a(λ-λ_*)+bh^p+... $$ so that if $|y_{λ,h}(1)|<δ$ then $$|λ-λ_*|<\frac{δ+|b|h^p}{|a|}.$$
Thus for a method of order $p$, the numerical eigenvalue for a given stepsize $h$ will lead to a right boundary value of size $O(δ+h^p)$ in the exact solution and thus a distance of the same magnitude to the eigenvalue of the exact solution.
Now you can employ the error estimates of the Richardson extrapolation method or similar to verify the correctness of your numerical result.
Note that the higher oscillation for larger $λ$ leads to consider the requirements of the sampling theorem, i.e., the sampling density has to be high enough. Or in other words, for large $λ$ the problem becomes stiff, the error term could be modified to $O(e^{c|λ|}h^p)$ to reflect that.
This should be no problem for the lowest eigenvalue, thus find the solution within error $δ=O(h^{p+1})$ for $h=0.1$ and for $h=0.2$ and use the extrapolation formula to estimate the error $$ error = \frac{|λ_{0.2}-λ_{0.1}|}{2^p-1} $$ for $λ_{0.1}$.