An algebraic procedure for the spectral corrections using the miss-distance functions in regular and singular Sturm-Liouville problems