Solving Differential Equations with Constrained Learning