Algebraic Treatment of Nonrelativistic and Relativistic Quantum Equations and its Relation to the Theory of Differential Equations