A Sparse Optimization Framework For The Numerical Solution Of Pdes