The peak-end rule and its dynamic realization through differential equations with maxima