Fast Multipole Methods for Wave and Charge Source Interactions in Layered Media and Deep Neural Network Algorithms for High-Dimensional PDEs