Large Deviations Applied to Classical and Quantum Field Theory