Method for finding approximate solutions to linear differential equations with spatially varying coefficients