Optimal Quantization and Approximation in Source Coding and Stochastic Control