Fig.1. RC-circuit.
Problem 1.
Determine $I(t)$ for (a) a constant electromotive force,
(b) a periodic electromotive force,
if $I(0):=I_0$ is given.
we get
\[
RI(t)+\frac{1}{C}\int I(t)\,dt=E(t).
\]
Differentiating the equation with respect to $t$ we find
\[
RI'(t)+\frac{1}{C}I(t)=E'(t).
\]
If $E(t)$ is constant, then it follows simply \[ I(t)=I_0 e^{-t/(RC)}. \] Case (b). Periodic electromotive force $E(t)=E_0\sin(\omega t)$.
In this case $E'(t)=E_0\omega\cos(\omega t)$ and \[ \int_0^t e^{\tau/(RC)}E'(\tau)\,d\tau=E_0\omega \int_0^t e^{\tau/(RC)}\cos(\omega \tau)\,d\tau. \]
Hence \[ I(t)=\frac{E_0\,\omega\,C}{\sqrt{C^2R^2\omega^2\!+\!1}} \sin(\omega t+\delta)+e^{-t/(RC)}\left(I_0- \frac{E_0\,\omega\,C}{C^2R^2\omega^2\!+\!1} \right), \] where $\tan(\delta)=\frac{1}{CR\,\omega}$.
Using the general formula for solution
we obtain
\[
I(t)=e^{-t/(RC)}\left(\frac{1}{R}\int e^{t/(RC)}E'(t)\,dt+c \right).
\]
Since $I(0)=I_0$, we get $c=I_0$, and
\[
\bbox[lightblue,5px,border:2px solid red]{\color{#800000}{ \bf{I(t)=e^{-t/(RC)}\left(\frac{1}{R}\int_0^t e^{\tau/(RC)}E'(\tau)\,d\tau+I_0 \right).}}}
\]
Case (a). Constant electromotive force.If $E(t)$ is constant, then it follows simply \[ I(t)=I_0 e^{-t/(RC)}. \] Case (b). Periodic electromotive force $E(t)=E_0\sin(\omega t)$.
In this case $E'(t)=E_0\omega\cos(\omega t)$ and \[ \int_0^t e^{\tau/(RC)}E'(\tau)\,d\tau=E_0\omega \int_0^t e^{\tau/(RC)}\cos(\omega \tau)\,d\tau. \]
Applying integration by parts
we obtain
\begin{align*}
\frac{E_0\,\omega}{R}\! \int_0^t \! e^{\tau/(RC)}\cos(\omega\, \tau)\,d\tau\! &=
e^{t/(RC)} E_0\,\omega\,C \frac {CR\,\omega\sin ( \omega\,t) +\cos ( \omega\,t ) }{C^2R^2\omega^2\!+\!1} \\
&-\frac{E_0\,\omega\,C}{C^2R^2\omega^2\!+\!1}.
\end{align*}
It follows
\[
I(t) =E_0\,\omega\,C \frac {CR\,\omega\sin ( \omega\,t) +\cos ( \omega\,t ) }{C^2R^2\omega^2\!+\!1}
+e^{-t/(RC)}\left(I_0- \frac{E_0\,\omega\,C}{C^2R^2\omega^2\!+\!1} \right).
\]
Here we can transform the first term further if we use that
\[
\frac{a\sin(x)+b\cos(x)}{\sqrt{a^2+b^2}}=\sin(x+\delta),\qquad(a,b\gt 0),
\]
where $\tan(\delta)=\frac{b}{a} $.Hence \[ I(t)=\frac{E_0\,\omega\,C}{\sqrt{C^2R^2\omega^2\!+\!1}} \sin(\omega t+\delta)+e^{-t/(RC)}\left(I_0- \frac{E_0\,\omega\,C}{C^2R^2\omega^2\!+\!1} \right), \] where $\tan(\delta)=\frac{1}{CR\,\omega}$.