Consider the signal $ x(t)=cos(t) $ over the interval 0 to $ 4\pi $
Average Power
$ Avg. Power = {1\over(t2-t1)}\int_{t_1}^{t_2}\!|x(t)|^2 dt $
$ Avg. Power = {1\over(4\pi-0)}\int_{0}^{4\pi}\!|cos(t)|^2 dt $
$ Avg. Power = {1\over(4\pi)}{1\over2}\int_{0}^{4\pi}\!(1+cos(2t)) dt $
$ Avg. Power = {1\over8\pi}(4\pi+{1\over2}sin(8\pi)) $
$ Avg. Power = {1\over2} $
Energy
$ E = \int_{t_1}^{t_2}\!|x(t)|^2\ dt $
$ E = \int_{0}^{4\pi}\!|cos(t)|^2\ dt $
$ E = {1\over2}\int_{0}^{4\pi}\!(1+cos(2t)) dt $
$ E = {1\over2}(4\pi+{1\over2}sin(8\pi)) $
$ E = 2\pi $