Learning Partial Differential Equations by Spectral Approximates of General Sobolev Spaces