Solving a physical problem involving electric circuits Well, I've a series RL circuit that is powered by a voltage source. The input voltage is given by:
$$\text{V}_{\text{in}}\left(t\right)=50+\frac{400}{\pi}\cdot\sum_{\text{n}=1}^\infty\frac{\sin\left(200\pi\cdot\text{n}\cdot t\right)}{\text{n}}\tag1$$
The resistor value is equal to $\text{R}=20\space\Omega$ and the inductor value is equal to $\text{L}
=25\cdot10^{-3}\space\text{H}$.

Question: I've to find the average power that is dissipated in the resistor.


My work:
First of all, you might say that this is a electrical engineering problem but that is not true, because I've a problem with finding out the math behind it.
We can write for the power dissipated in the resistor, using Ohm's law, that:
$$\text{P}_\text{R}\left(t\right)=\text{V}_\text{R}\left(t\right)\cdot\text{I}_\text{R}\left(t\right)=\text{I}_\text{R}^2\left(t\right)\cdot\text{R}\tag2$$
Where $\text{I}_\text{R}\left(t\right)$ is the current trough the resistor and $\text{V}_\text{R}\left(t\right)$ is the voltage across the resistor.
Because it is a series circuit, the input current, $\text{I}_\text{in}\left(t\right)$, delivered by the source is the same trough the resistor and the inductor, so $\text{I}_\text{R}\left(t\right)=\text{I}_\text{in}\left(t\right)=\text{I}_\text{L}\left(t\right)$. Using Faraday's law, we can find that input current:
$$-\text{V}_\text{in}\left(t\right)+\text{I}_\text{in}\left(t\right)\cdot\text{R}=-\text{I}_\text{in}'\left(t\right)\cdot\text{L}\tag3$$
The initial condition is equal to $0$, so we know that $\text{I}_\text{in}\left(0\right)=0$. Now we need to solve equation $(3)$ using the values that are given.
Solving equation $(3)$ gives:
$$\text{I}_\text{in}\left(t\right)=\frac{1}{\text{L}}\cdot\exp\left(-\frac{\text{R}}{\text{L}}\cdot t\right)\cdot\left\{\int_1^t\text{X}\left(\tau\right)\space\text{d}\tau-\int_1^0\text{X}\left(\tau\right)\space\text{d}\tau\right\}\tag4$$
Where $\text{X}\left(\tau\right)=\exp\left(\frac{\text{R}}{\text{L}}\cdot\tau\right)\cdot\text{V}_\text{in}\left(\tau\right)$.
The average power that is dissipated in the resistor is equal to:
$$\overline{\text{P}}_\text{R}=\lim_{\text{n}\to\infty}\frac{1}{\text{n}}\cdot\int_0^\text{n}\text{P}_\text{R}\left(t\right)\space\text{d}t=\lim_{\text{n}\to\infty}\frac{1}{\text{n}}\cdot\int_0^\text{n}\text{I}_\text{R}^2\left(t\right)\cdot\text{R}\space\text{d}t=$$
$$\text{R}\cdot\left\{\lim_{\text{n}\to\infty}\frac{1}{\text{n}}\cdot\int_0^\text{n}\text{I}_\text{in}^2\left(t\right)\space\text{d}t\right\}\tag5$$
Now, the input current $\text{I}_\text{in}\left(t\right)$ that is stated in the integral at the end of equation $(5)$ can be found using the solution to the DE given in equation $(4)$.

Question: How can I solve the integral given in equation $(5)$, that is the part where I do not get my head around?

EDIT:
I already found that, using the given values that:
$$\int_1^0\text{X}\left(t\right)\space\text{d}\tau=\frac{3}{8}\cdot\left(1-e^{800}\right)\tag6$$
And:
$$\frac{1}{\text{L}}\cdot\exp\left(-\frac{\text{R}}{\text{L}}\cdot t\right)=40e^{-800t}\tag7$$
And:
$$\int_1^t\text{X}\left(\tau\right)\space\text{d}\tau=\int_1^t\exp\left(\frac{\text{R}}{\text{L}}\cdot\tau\right)\cdot\left\{50+\frac{400}{\pi}\cdot\sum_{\text{n}=1}^\infty\frac{\sin\left(200\pi\cdot\text{n}\cdot\tau\right)}{\text{n}}\right\}\space\text{d}\tau=$$
$$\int_1^t\exp\left(\frac{\text{R}}{\text{L}}\cdot\tau\right)\cdot50\space\text{d}\tau+\int_1^t\exp\left(\frac{\text{R}}{\text{L}}\cdot\tau\right)\cdot\frac{400}{\pi}\cdot\sum_{\text{n}=1}^\infty\frac{\sin\left(200\pi\cdot\text{n}\cdot\tau\right)}{\text{n}}\space\text{d}\tau=$$
$$\frac{e^{800t}-e^{800}}{16}+\frac{400}{\pi}\cdot\sum_{\text{n}=1}^\infty\frac{1}{\text{n}}\cdot\left\{\int_1^t\exp\left(800\cdot\tau\right)\cdot\sin\left(200\pi\cdot\text{n}\cdot\tau\right)\space\text{d}\tau\right\}\tag8$$
 A: Well, "engineering"-wise the problem is quite simple.
Once you have demonstrated that, in the steady-state (which should be the meaning of the question)
a sinusoidal current of whichever amplitude and phase does not dissipate energy in
an inductor (voltage and current are phased $90^\circ$ apart),
while a resistor dissipates a power equal to 
$$
P = R \cdot \bar I^{\,2}  = {R \over {\left| Z \right|^{\,2} }} \cdot \bar V^{\,2} 
$$
where the overbar indicates the rms value,
then you know that the above is all power dissipated.
You also know that the power of  a signal is the sum of the power of the single components, so ...
--  Solution --
Clearly I cannot expose here the full introduction to electrical engineering, I will just highlight
the basic steps for arriving to the solution.
It is much practical to use the concept of Impedance.
The impedance $Z$ of a series RL circuit is $R+j \omega L$.
$j=\sqrt(-1)$ is the engineering version of $i$ (just because $i$ is reserved to denote the istantaneous current).
$\omega = 2\pi f$ is the angular frequency (rad/sec), while $f$ is the frequency in Hertz = 1/sec.
Given a voltage $v(t)=V\sin(\omega t +\phi)$ let's associate it to the complex function
$$
{\cal V}(t) = Ve^{\,i\left( {\omega \,t + \phi } \right)}  = \left( {Ve^{\,i\phi } } \right)e^{\,i\left( {\omega \,t} \right)} 
$$
then the current will be
$$
\eqalign{
  & {\cal I}(t) = {{{\cal V}(t)} \over Z} = \left( {{{Ve^{\,i\phi } } \over Z}} \right)e^{\,i\left( {\omega \,t} \right)}
  = \left( {{{Ve^{\,i\left( {\phi  - \zeta } \right)} } \over {\left| Z \right|}}} \right)e^{\,i\left( {\omega \,t} \right)}  =   \cr 
  &  = \left( {Ie^{\,i\left( {\phi  - \zeta } \right)} } \right)e^{\,i\left( {\omega \,t} \right)}  \cr} 
$$
If you insert these expressions into your ODE you'll see that it is satisfied.
That means that they represent the solution in the steady state, because for the transient 
we shall introduce a Heaviside step function to multiply them.
So the current has the same frequency (but different phase) wrt the voltage.
The linearity of the system ensures that a linear combination of voltages will correspond to the same 
combination of the respective currents.
The average of $v(t)^2$ is $V^2/2$, being $V$ the amplitude.
The power dissipated across the resistance is
$$
P = {{RI^{\,2} } \over 2} = {{RV^{\,2} } \over {2\left| Z \right|^{\,2} }} = {{RV^{\,2} } \over {2\left( {R^{\,2}  + \omega^{\,2} L^{\,2} } \right)}}
$$
The average power of a signal is the sum of the power of its harmonics (components of the Fourier series):
see Plancherel' Theorem.
Note: the square of the continuous component ($\omega=0$), only that,  does not get divided by two.
Can you now proceed by yourself ?
A: As an alternative approach that builds upon the suggestion by G Cab above, starting from the Laplace domain, the voltage across the resistor is given by:
$$V_R(s)=\frac{R}{sL+R}V_{in}(s) \Rightarrow \frac{V_R(s)}{V_{in}(s)}=\frac{R}
{sL+R} = H(s)$$ It can be seen that, as expected, the RL circuit is a stable linear system, since the (real) pole is in the left half plane. 
Converting to the Fourier domain by substituting $s=j\omega$ (since we are only interested in the steady state response):
$$\Rightarrow H(j\omega)=\frac{R}{j\omega{L}+R}$$
Since $H(j\omega)$ represents the transfer function of a stable linear system, the response to a general input $x(t)=A\cos(\omega {t} + \phi)$ is given by:
$$y(t)=A\vert H(j\omega)\vert \cos[\omega {t} + \phi + \angle{H(j\omega)}]$$
Therefore, for an input voltage given by 
$$v_{in}(t)=50+\frac{400}{\pi}\cdot\sum_{\text{n}=1}^\infty\frac{\sin\left(200\pi\cdot\text{n}\cdot t\right)}{\text{n}}$$
and using the superposition principle, the voltage across the resistor is given by:
$$v_R(t)=50 + \sum_{n=1}^\infty {\frac{400}{n\pi} \frac{R}{\sqrt{R^2+\omega_n^2 L^2}} \sin \Big[200\pi {n} {t} - \tan^{-1}\left( \frac{\omega_n L}{R} \right)  \Big]}$$
where $$\vert H(j\omega)\vert = \frac{R}{\sqrt{R^2+\omega_n^2 L^2}}$$ 
Now, since the voltage and current across a resistor are in phase, the current through the resistor is $$i_R(t)= \frac{50}{R} + \sum_{n=1}^\infty {\frac{400}{n\pi} \frac{1}{\sqrt{R^2+\omega_n^2 L^2}} \sin \Big[200\pi {n} {t} - \tan^{-1}\left( \frac{\omega_n L}{R} \right)  \Big]}$$
The instantaneous power dissipated by the resistor is:
$$p(t)=i_R(t)\cdot v_R(t)$$
The average power dissipated by the resistor is $$ \Rightarrow P_{avg}=\frac{1}{T}\int_0^T{i_R(t)\cdot v_R(t)}\mathrm{d}t=\frac{1}{T}\int_0^T{\frac{v_R^2(t)}{R}}\mathrm{d}t = \frac{1}{R}\Big[ \frac{1}{T}\int_0^T{v_R^2(t)}\mathrm{d}t \Big]=\frac{V_{RMS}^2}{R}$$
Finally (with some careful algebra):
$$V_{RMS}^2= 50^2 + \frac{1}{2}\sum_{n=1}^\infty {\left(\frac{400}{n\pi} \frac{R}{\sqrt{R^2+\omega_n^2 L^2}}\right)^2} $$
Substituting $R=20\Omega$, $L=25m\mathrm{H}$ and $\omega_n = 200\pi {n}$, gives the average power as:
$$P_{avg} = \frac{V_{RMS}^2}{R} = \frac{50^2}{20} +\frac{1}{2}{\frac{1}{20}\sum_{n=1}^\infty \left(\frac{400}{n\pi} \frac{20}{\sqrt{20^2+{200^2\pi^2 {n^2}} \times \left(25\times 10^{-3}\right)^2}}\right)^2} $$
Simplifying gives:
$$P_{avg} = 125 + \sum_{n=1}^\infty {10\left( \frac{400}{n\pi \sqrt{400 + 25\pi^2 n^2} }  \right)^2} \approx 416.3W$$
A plot using Matlab is shown below. Note that the period, $T$, of the input voltage is $\mathrm{10ms}$.

