%------------------------------------------------------------------------------------------------------------------------------------%
\typeout{<----------- PREAMBLE OG EKSTRA KOMMANDOER ----------->}
\input{preamble.tex}
%\usepackage[notref,notcite]{showkeys}   %Hvis aktiv vises labels i margin - bør kun anvendes i draft
\newcommand{\theaflnr}{3}                %Definition af afleveringsnummer, til sektionsnummerering, forside og sidehoved
\linespread{1.2}
\hyphenation{spænd-ings-for-sy-ning-en}  % Orddelingsregler
%------------------------------------------------------------------------------------------------------------------------------------%
\typeout{<----------- START PÅ DOKUMENT MED FORSIDE ----------->}
\begin{document}                         % Starter dokumentet efter preamble
\pagestyle{empty}                        % Sidehoved og sidefod for forsiden
\input{forside.tex}                      % Input af forsiden, der ligger i forside.tex
%------------------------------------------------------------------------------------------------------------------------------------%
\typeout{<---------- START PÅ AFLEVERINGSOPGAVEN SELV ---------->}
\newpage                                 % Ny side efter forsiden er indsat
\pagestyle{fancy}                        % Sidehoved og sidefod for resten af dokumentet
\setcounter{page}{2}                     % Resten af afleveringen har sidenummer 2 og frem
\setcounter{section}{\theaflnr}          % reset tælleren til at nummerere sections (ugeopgavenummer)

%------------------------------------------------------------------------------------------------------------------------------------%
\setcounter{subsection}{1}
\subsection*{Problem 1}
\ramme{ {\bfseries\sffamily Notes chapter 3, exercise 7} \\
        We will in this exercise consider the function
        \begin{equation}
         f(t) = \left\{ \begin{array}{cl}
                         0& \text{if } 0 + nT \leq t < \frac{T}{2} + n T , \quad n = 0, \pm 1, \pm 2 , \ldots \\
                         1& \text{if } \frac{T}{2} + nT \leq t < T + nT , \quad n = 0, \pm 1, \pm 2 , \ldots
                        \end{array} \right.
         \label{eq:ftdefined}
        \end{equation}
        which is shown in the figure below. }

\begin{center}
\psset{unit=8mm}
\begin{pspicture}(-5,-0.5)(5,5.5) %\psgrid[subgriddiv=1,griddots=10]
 %Koordinatsystem:
 \psline{->}(0,0)(0,5)       \uput[r](0,5){$f(t)$}   
 \psline(0,4.5)(-0.15,4.5)   \uput[l](0,4.5){\footnotesize 1}
 \psline{->}(-5,0)(5,0)      \uput[r](5,0){$t$}
 %\psline(5,0)(5,-0.15)      \uput[-90](5,0){\footnotesize $5T/2$}
 \psline(4,0)(4,-0.15)       \uput[-90](4,0){\footnotesize $2T$}
 %\psline(3,0)(3,-0.15)      \uput[-90](3,0){\footnotesize $3T/2$}
 \psline(2,0)(2,-0.15)       \uput[-90](2,0){\footnotesize $T$}
 %\psline(1,0)(1,-0.15)      \uput[-90](1,0){\footnotesize $T/2$}
 \psline(0,0)(0,-0.15)       \uput[-90](0,0){\footnotesize 0}
 %\psline(-1,0)(-1,-0.15)    \uput[-90](-1,0){\footnotesize $-T/2$}
 \psline(-2,0)(-2,-0.15)     \uput[-90](-2,0){\footnotesize $-T$}
 %\psline(-3,0)(-3,-0.15)    \uput[-90](-3,0){\footnotesize $-3T/2$}
 \psline(-4,0)(-4,-0.15)     \uput[-90](-4,0){\footnotesize $-2T$}
 %\psline(-5,0)(-5,-0.15)    \uput[-90](-5,0){\footnotesize $-5T/2$}
 %Kurver:
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(-5,4.5)(-4,4.5) 
 \psline[linewidth=1.5pt,linecolor=Periwinkle,linestyle=dashed]{c-c}(-4,0)(-4,4.5)
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(-4,0)(-3,0)
 \psline[linewidth=1.5pt,linecolor=Periwinkle,linestyle=dashed]{c-c}(-3,4.5)(-3,0)
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(-3,4.5)(-2,4.5) 
 \psline[linewidth=1.5pt,linecolor=Periwinkle,linestyle=dashed]{c-c}(-2,0)(-2,4.5)
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(-2,0)(-1,0)
 \psline[linewidth=1.5pt,linecolor=Periwinkle,linestyle=dashed]{c-c}(-1,4.5)(-1,0)
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(-1,4.5)(0,4.5)  
 \psline[linewidth=1.5pt,linecolor=Periwinkle,linestyle=dashed]{c-c}(0,0)(0,4.5)
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(0,0)(1,0)
 \psline[linewidth=1.5pt,linecolor=Periwinkle,linestyle=dashed]{c-c}(1,4.5)(1,0)
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(1,4.5)(2,4.5)   
 \psline[linewidth=1.5pt,linecolor=Periwinkle,linestyle=dashed]{c-c}(2,0)(2,4.5)
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(2,0)(3,0)
 \psline[linewidth=1.5pt,linecolor=Periwinkle,linestyle=dashed]{c-c}(3,4.5)(3,0)
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(3,4.5)(4,4.5)   
 \psline[linewidth=1.5pt,linecolor=Periwinkle,linestyle=dashed]{c-c}(4,0)(4,4.5)
 \psline[linewidth=1.5pt,linecolor=Periwinkle]{c-c}(4,0)(5,0)
\end{pspicture}
\hspace{1cm}
\psset{unit=8mm}
\begin{pspicture}(0,0.5)(6,6.5) %\psgrid[subgriddiv=1,griddots=10]
 %Nodes:
 \pnode(1,1){A}
 \pnode(5.5,1){B}
 \pnode(5.5,5.5){C}
 \pnode(1,5.5){D}
 %Components:
 \circledipole[labeloffset=0](A)(D){$\Ep(t)$}
 \capacitor(B)(C){$C$}
 \resistor(D)(C){$R$}
 %Wires:
 \wire(A)(B)
\end{pspicture}
\end{center}



\subsubsection*{Question a}
\ramme{ Find the Fourier series for $f(t)$. }
To find the Fourier series for $f(t)$ in \eqref{eq:ftdefined} on the form
\begin{equation*}
 f(t) = \sum_{n=-\infty}^{\infty} \tilde c_n e^{-i \omega_n t}
\end{equation*}
from equation (3.4) in the notes, I first have to find the complex coefficients $\tilde c_n$, which I do with the expression in equation (3.5) in the notes, which says that
\begin{equation*}
 \tilde c_n = \frac{1}{T} \int_0^T f(t) e^{i \omega_n t} \,\di t  .
\end{equation*}
So by splitting up the integral over two intervals and inserting $f(t)$ from the expression in \eqref{eq:ftdefined}, I simply get that
\begin{align*}
 \tilde c_n &= \frac{1}{T} \left( \int_0^{T/2} f(t) e^{i \omega_n t} \,\di t + \int_{T/2}^T f(t) e^{i \omega_n t} \,\di t \right) \\
            &= \frac{1}{T} \int_{T/2}^T f(t) e^{i \omega_n t} \,\di t \\
            &= \frac{1}{i \omega_n T} \left[ e^{i \omega_n t} \right]_{T/2}^T \\
            &= \frac{1}{i \omega_n T} \left( e^{i \omega_n T} - e^{i \omega_n T / 2} \right) .
\end{align*}
By inserting the angular frequency, given in equation (3.6) in the notes, $\omega_n = 2 \pi n /T$, I can simplify this expression to
\begin{equation*}
 \tilde c_n = \frac{T}{2 i \pi n T} \left( e^{2 \pi i n T / T} - e^{2 \pi i n T / 2T} \right) 
            = \frac{1}{2 i \pi n} \left( e^{i 2 \pi n} - e^{i \pi n} \right) 
            = \frac{1}{2 i \pi n} \left( 1 - e^{i \pi n} \right) . 
\end{equation*}
This expression takes two values dependent on whether $n$ is odd or even (because $e^{i\pi n}=-1$ if $n$ is odd and $e^{i\pi n}=1$ if $n$ is even). This derivation assumed that $n \neq 0$ (because I divided by $\omega_n$ earlyer, which is proportional to $n$), so I have to find $\tilde c_0$ by direct calculation. Here I see that
\begin{equation*}
 \tilde c_0 = \frac{1}{T} \int_0^T f(t) e^{0} \,\di t 
            = \frac{1}{T} \int_0^T f(t) \,\di t 
            = \frac{1}{T} \int_{T/2}^T 1 \,\di t 
            = \frac{1}{T} \left( T - \frac{T}{2} \right)
            = \frac{1}{2} ,
\end{equation*}
so I finally have that the complex coefficients for the Fourier series expansion of $f(t)$ is
\begin{equation*}
 \tilde c_n = \left\{ \begin{array}{cl}
                       \dfrac{1}{2}& \text{if } n = 0 \\
                       0& \text{if } n \text{ is even and } n \neq 0 \\
                       \dfrac{1}{i \pi n}& \text{if } n \text{ is odd and } n \neq 0  .
                      \end{array} \right.
\end{equation*}
Hence the Fourier series expansion of $f(t)$ is simply
\begin{equation*}
 f(t) = \sum_{n=-\infty, n \text{ odd}}^{-1} \dfrac{1}{i \pi n} e^{-i \omega_n t} + \frac{1}{2} 
        + \sum_{n=1, n \text{ odd}}^{\infty} \dfrac{1}{i \pi n} e^{-i \omega_n t} ,
      %= -\sum_{n=-\infty, n \text{ odd}}^{-1} \dfrac{1}{i \pi n} e^{-2 \pi i n t / T} + \frac{1}{2} 
      %  - \sum_{n=1, n \text{ odd}}^{\infty} \dfrac{1}{i \pi n} e^{-2 \pi i n t / T} .
\end{equation*}
where the angular frequency was given as $\omega_n = 2\pi n/T$.



\subsubsection*{Question b}
\ramme{ Write the series in terms of sines and cosines and simplify as much as possible. }
To do this I use a little trick. I only want to sum over positive $n$, so I simply add all the terms where $n$ is negative into the sum where I sum over positive $n$, with a minus in front of all the $n$'s. I get
\begin{equation*}
 f(t) = \sum_{n=1, n \text{ odd}}^{\infty} \dfrac{1}{i \pi n} \left( e^{-i \omega_n t} - e^{i \omega_n t} \right) + \frac{1}{2} .
\end{equation*}
By Eulers identity $2i\sin{\theta} = e^{i\theta}-e^{-i\theta}$ I then simplify the expression to
\begin{align*}
 f(t) = - \sum_{n=1, n \text{ odd}}^{\infty} \dfrac{1}{i \pi n} 2i\sin{\omega_n t} + \frac{1}{2} 
      = - \sum_{n=1, n \text{ odd}}^{\infty} \dfrac{2}{\pi n} \sin{\omega_n t} + \frac{1}{2} .
\end{align*}




\subsubsection*{Question c}
\ramme{ The circuit in the figure above is now driven by an electromotive force $\Ep(t) = \Ep_0 f(t)$, where $\Ep_0$ is a constant. Find an 
        expression for the current in the circuit. }
The electromotive force can, because of the superposition principle, be seen as two individual components, one with an alternating electromotive force and one with a direct electromotive force. The alternating part can then be written as the imaginary part of a complex electromotive force $\tilde\Ep (t)$, so that I have
\begin{equation*}
 \Ep(t) = \underbrace{-\sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} \sin{\omega_n t}}_{\text{alternating part}} 
          + \frac{\Ep_0}{2}
        = \Im{\big[ \tilde\Ep (t) \big]} + \frac{\Ep_0}{2} ,
\end{equation*} 
where
\begin{equation}
 \tilde\Ep (t) = \sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} e^{-i \omega_n t} .
 \label{eq:qc:complexemf}
\end{equation} 
From equation (2.37) in the notes I know that the charge $Q(t)$ on the capacitor in an RC-circuit with a direct electromotive force $\Ep$ is given by $Q(t) = \Ep C ( 1 - \exp{(-t/RC)} )$, so the current in my circuit corresponding to the electromotive force $\Ep = \Ep_0/2$ is
\begin{equation}
 I_{DC}(t) = \dd{Q}{t} 
           = \dd{}{t} \left( \frac{\Ep_0 C}{2} \big( 1 - e^{-t/RC} \big) \right)
           = \frac{\Ep_0}{2R} e^{-t/RC} .
 \label{eq:qc:IDC}
\end{equation}
To find the current $I_{AC}$ corresponding to the alternating electromotive force, given by the complex electromotive force in \eqref{eq:qc:complexemf}, I'll have to use Kirchhoff's second law in complex form. I'll find the complex current given in the form
\begin{equation*}
 \tilde I_{AC}(t) = \sum_{n=1,n \text{ odd}}^{\infty} \tilde I_{0,n} e^{-i \omega_n t} ,
\end{equation*}
so that $I_{AC}(t) = \Im{[\tilde I_{AC}(t)]}$. Kirchhoff's second law for this, from equation (2.59) in the notes, is
\begin{equation*}
 \tilde \Ep_{0,n} = \frac{1}{-i \omega_n C} \tilde I_{0,n} + R \tilde I_{0,n} ,
\end{equation*}
where I have defined $\tilde \Ep_{0,n} = 2 \Ep_0 / \pi n$. Now I solve for $\tilde I_{0,n}$, where I get that
\begin{multline*}
 \tilde I_{0,n} = \frac{\tilde\Ep_{0,n}}{\frac{1}{-i\omega_n C} + R}
                = \frac{i\omega_n C}{i\omega_n CR - 1} \tilde\Ep_{0,n}
                = \frac{i\omega_n C (- i\omega_n CR - 1)}{\omega_n^2 C^2 R^2 + 1} \tilde \Ep_{0,n}  \\
                = \frac{\omega_n^2 C^2 R - i \omega_n C}{\omega_n^2 C^2 R^2 + 1} \tilde \Ep_{0,n}
                = \big| \tilde I_{0,n} \big| e^{i \phi} ,
\end{multline*}
where (note that $\tilde\Ep_{0,n}$ is real, hence it only shows up in the length of $\tilde I_{0,n}$)
\begin{equation}
 \big| \tilde I_{0,n} \big| %= \sqrt{\frac{\omega_n^4 C^4 R^4 + \omega_n^2 C^2}{\omega_n^4 C^4 R^4 + 2 \omega_n^2 C^2 R^2 + 1}} \tilde \Ep_{0,n}
                            = \tilde \Ep_{0,n} \frac{\omega_n C}{\sqrt{\omega_n^2 C^2 R^4 + 1}} 
   \qquad\text{and}\qquad
 \tan\phi = -\frac{1}{\omega_n C R} .
 \label{eq:qc:phioglenght}
\end{equation}
%\begin{equation}
% \big| \tilde I_{0,n} \big| %= \sqrt{\frac{\omega_n^4 C^4 R^4 + \omega_n^2 C^2}{\omega_n^4 C^4 R^4 + 2 \omega_n^2 C^2 R^2 + 1}} \tilde \Ep_{0,n}
%                            = \tilde \Ep_{0,n} \omega_n C \frac{\sqrt{\omega_n^2 C^2 R^4 + 1}}{\omega_n^2 C^2 R^2 + 1} 
%   \qquad\text{and}\qquad
% \tan\phi = -\frac{1}{\omega_n C R} .
% \label{eq:qc:phioglenght}
%\end{equation}
So the real current corresponding to the alternating electromotive force is
\begin{equation*}
 I_{AC}(t) = \Im{\big[ \tilde I_{AC}(t) \big]} 
           = \Im{\bigg[ \sum_{n=1,n \text{ odd}}^{\infty} \big| \tilde I_{0,n} \big| e^{i\phi} e^{-i \omega_n t} \bigg]} 
           = - \sum_{n=1,n \text{ odd}}^{\infty} \big| \tilde I_{0,n} \big| \sin{( \omega_n t - \phi )} , 
\end{equation*}
where I defined $|\tilde I_{0,n}|$ and $\phi$ in \eqref{eq:qc:phioglenght}. So, in conclusion, since the current running through the RC-circuit is the sum of $I_{AC}(t)$ and $I_{DC}(t)$, I have that
\begin{align*}
 I(t) &= I_{AC}(t) + I_{DC}(t) \\
      &= -\sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} \frac{\omega_n C}{\sqrt{\omega_n^2 C^2 R^4 + 1}} 
                                            \sin{\left( \omega_n t - \arctan{\left( -\frac{1}{\omega_n C R} \right)} \right)} 
         + \frac{\Ep_0}{2R} e^{-t/RC} \\
      &= \frac{\Ep_0}{2R} e^{-t/RC}
         - \sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} \frac{\omega_n C}{\sqrt{\omega_n^2 C^2 R^4 + 1}} 
                                             \sin{\left( \omega_n t + \arctan{\left( \frac{1}{\omega_n C R} \right)} \right)}  .
\end{align*}
%\begin{align*}
% I(t) &= I_{AC}(t) + I_{DC}(t) \\
%      &= -\sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} \omega_n C \frac{\sqrt{\omega_n^2 C^2 R^4 + 1}}{\omega_n^2 C^2 R^2 + 1} 
%                                            \sin{\left( \omega_n t + \arctan{\left( -\frac{1}{\omega_n C R} \right)} \right)} 
%         + \frac{\Ep_0}{2R} e^{-t/RC} \\
%      &= \frac{\Ep_0}{2R} e^{-t/RC}
%         - \sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} \omega_n C \frac{\sqrt{\omega_n^2 C^2 R^4 + 1}}{\omega_n^2 C^2 R^2 + 1} 
%                                             \sin{\left( \omega_n t - \arctan{\left( \frac{1}{\omega_n C R} \right)} \right)}  .
%\end{align*}






\label{lastpage}
\end{document}






%Den gamle version af spørgsmål c:

\subsubsection*{Question c}
\ramme{ The circuit in the figure above is now driven by an electromotive force $\Ep(t) = \Ep_0 f(t)$, where $\Ep_0$ is a constant. Find an 
        expression for the current in the circuit. }
The electromotive force can, because of the superposition principle, be seen as two individual components, one with an alternating electromotive force and one with a direct electromotive force. The alternating part can then be written as the negative imaginary part of a complex electromotive force $\tilde\Ep (t)$, so that I have
\begin{equation*}
 \Ep(t) = \underbrace{\sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} \sin{\omega_n t}}_{\text{alternating part}} 
          + \frac{\Ep_0}{2}
        = - \Im{\big[ \tilde\Ep (t) \big]} + \frac{\Ep_0}{2} ,
\end{equation*} 
where
\begin{equation}
 \tilde\Ep (t) = \sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} e^{-i \omega_n t} .
 \label{eq:qc:complexemf}
\end{equation} 
From equation (2.37) in the notes I know that the charge $Q(t)$ on the capacitor in an RC-circuit with a direct electromotive force $\Ep$ is given by $Q(t) = \Ep C ( 1 - \exp{(-t/RC)} )$, so the current in my circuit corresponding to the electromotive force $\Ep = \Ep_0/2$ is
\begin{equation}
 I_{DC}(t) = \dd{Q}{t} 
           = \dd{}{t} \left( \frac{\Ep_0 C}{2} \big( 1 - e^{-t/RC} \big) \right)
           = \frac{\Ep_0}{2R} e^{-t/RC} .
 \label{eq:qc:IDC}
\end{equation}
To find the current $I_{AC}$ corresponding to the alternating electromotive force, given by the complex electromotive force in \eqref{eq:qc:complexemf}, I'll have to use Kirchhoff's second law in complex form. I'll find the complex current given in the form
\begin{equation*}
 \tilde I_{AC}(t) = \sum_{n=1,n \text{ odd}}^{\infty} \tilde I_{0,n} e^{-i \omega_n t} ,
\end{equation*}
so that $I_{AC}(t) = - \Im{[\tilde I_{AC}(t)]}$. Kirchhoff's second law for this, from equation (2.59) in the notes, is
\begin{equation*}
 \tilde \Ep_{0,n} = \frac{1}{-i \omega_n C} \tilde I_{0,n} + R \tilde I_{0,n} ,
\end{equation*}
where I have defined $\tilde \Ep_{0,n} = 2 \Ep_0 / \pi n$. Now I solve for $\tilde I_{0,n}$, where I get that
\begin{multline*}
 \tilde I_{0,n} = \frac{\tilde\Ep_{0,n}}{\frac{1}{-i\omega_n C} + R}
                = \frac{i\omega_n C}{i\omega_n CR - 1} \tilde\Ep_{0,n}
                = \frac{i\omega_n C (- i\omega_n CR - 1)}{\omega_n^2 C^2 R^2 + 1} \tilde \Ep_{0,n}  \\
                = \frac{\omega_n^2 C^2 R - i \omega_n C}{\omega_n^2 C^2 R^2 + 1} \tilde \Ep_{0,n}
                = \big| \tilde I_{0,n} \big| e^{-i \phi} ,
\end{multline*}
where (note that $\tilde\Ep_{0,n}$ is real, hence it only shows up in the length of $\tilde I_{0,n}$)
\begin{equation}
 \big| \tilde I_{0,n} \big| %= \sqrt{\frac{\omega_n^4 C^4 R^4 + \omega_n^2 C^2}{\omega_n^4 C^4 R^4 + 2 \omega_n^2 C^2 R^2 + 1}} \tilde \Ep_{0,n}
                            = \tilde \Ep_{0,n} \omega_n C \frac{\sqrt{\omega_n^2 C^2 R^4 + 1}}{\omega_n^2 C^2 R^2 + 1} 
   \qquad\text{and}\qquad
 \tan\phi = \frac{1}{\omega_n C R} .
 \label{eq:qc:phioglenght}
\end{equation}
So the real current corresponding to the alternating electromotive force is
\begin{equation*}
 I_{AC}(t) = - \Im{\big[ \tilde I_{AC}(t) \big]} 
           = - \Im{\bigg[ \sum_{n=1,n \text{ odd}}^{\infty} \big| \tilde I_{0,n} \big| e^{-i\phi} e^{-i \omega_n t} \bigg]} 
           = \sum_{n=1,n \text{ odd}}^{\infty} \big| \tilde I_{0,n} \big| \sin{( \omega_n t + \phi )} , 
\end{equation*}
where I defined $|\tilde I_{0,n}|$ and $\phi$ in \eqref{eq:qc:phioglenght}. So, in conclusion, the current running through the RC-circuit is the sum of $I_{AC}(t)$ and $I_{DC}(t)$, so
\begin{align*}
 I(t) &= I_{AC}(t) + I_{DC}(t) \\
      &= \sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} \omega_n C \frac{\sqrt{\omega_n^2 C^2 R^4 + 1}}{\omega_n^2 C^2 R^2 + 1} 
                                           \sin{\left( \omega_n t + \arctan{\left( \frac{1}{\omega_n C R} \right)} \right)} 
         + \frac{\Ep_0}{2R} e^{-t/RC}
\end{align*}

















\subsubsection*{Question c}
\ramme{ The circuit in the figure above is now driven by an electromotive force $\Ep(t) = \Ep_0 f(t)$, where $\Ep_0$ is a constant. Find an 
        expression for the current in the circuit. }
The electromotive force can, because of the superposition principle, be seen as two individual components, one with an alternating electromotive force and one with a direct electromotive force. The alternating part can then be written as the negative imaginary part of a complex electromotive force $\tilde\Ep (t)$, so that I have
\begin{equation*}
 \Ep(t) = \underbrace{\sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} \sin{\omega_n t}}_{\text{alternating part}} 
          + \frac{\Ep_0}{2}
        = - \Im{\big[ \tilde\Ep (t) \big]} + \frac{\Ep_0}{2} ,
\end{equation*} 
where
\begin{equation}
 \tilde\Ep (t) = \sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} e^{-i \omega_n t} .
 \label{eq:qc:complexemf}
\end{equation} 
From equation (2.37) in the notes I know that the charge $Q(t)$ on the capacitor in an RC-circuit with a direct electromotive force $\Ep$ is given by $Q(t) = \Ep C ( 1 - \exp{(-t/RC)} )$, so the current in my circuit corresponding to the electromotive force $\Ep = \Ep_0/2$ is
\begin{equation}
 I_{DC}(t) = \dd{Q}{t} 
           = \dd{}{t} \left( \frac{\Ep_0 C}{2} \big( 1 - e^{-t/RC} \big) \right)
           = \frac{\Ep_0}{2R} e^{-t/RC} .
 \label{eq:qc:IDC}
\end{equation}
To find the current $I_{AC}$ corresponding to the alternating electromotive force, given by the complex electromotive force in \eqref{eq:qc:complexemf}, I'll have to use Kirchhoff's second law in complex form. I'll find the complex current given in the form
\begin{equation*}
 \tilde I_{AC}(t) = \sum_{n=1,n \text{ odd}}^{\infty} \tilde I_{0,n} e^{-i \omega_n t} ,
\end{equation*}
so that $I_{AC}(t) = - \Im{[\tilde I_{AC}(t)]}$. Kirchhoff's second law for this, from equation (2.59) in the notes, is
\begin{equation*}
 \tilde \Ep_{0,n} = \frac{1}{-i \omega_n C} \tilde I_{0,n} + R \tilde I_{0,n} ,
\end{equation*}
where I have defined $\tilde \Ep_{0,n} = 2 \Ep_0 / \pi n$. Now I solve for $\tilde I_{0,n}$, where I get that
\begin{multline*}
 \tilde I_{0,n} = \frac{\tilde\Ep_{0,n}}{\frac{1}{-i\omega_n C} + R}
                = \frac{i\omega_n C}{i\omega_n CR - 1} \tilde\Ep_{0,n}
                = \frac{i\omega_n C (- i\omega_n CR - 1)}{\omega_n^2 C^2 R^2 + 1} \tilde \Ep_{0,n}  \\
                = \frac{\omega_n^2 C^2 R - i \omega_n C}{\omega_n^2 C^2 R^2 + 1} \tilde \Ep_{0,n}
                = \big| \tilde I_{0,n} \big| e^{-i \phi} ,
\end{multline*}
where (note that $\tilde\Ep_{0,n}$ is real, hence it only shows up in the length of $\tilde I_{0,n}$)
\begin{equation}
 \big| \tilde I_{0,n} \big| %= \sqrt{\frac{\omega_n^4 C^4 R^4 + \omega_n^2 C^2}{\omega_n^4 C^4 R^4 + 2 \omega_n^2 C^2 R^2 + 1}} \tilde \Ep_{0,n}
                            = \tilde \Ep_{0,n} \omega_n C \frac{\sqrt{\omega_n^2 C^2 R^4 + 1}}{\omega_n^2 C^2 R^2 + 1} 
   \qquad\text{and}\qquad
 \tan\phi = \frac{1}{\omega_n C R} .
 \label{eq:qc:phioglenght}
\end{equation}
So the real current corresponding to the alternating electromotive force is
\begin{equation*}
 I_{AC}(t) = - \Im{\big[ \tilde I_{AC}(t) \big]} 
           = - \Im{\bigg[ \sum_{n=1,n \text{ odd}}^{\infty} \big| \tilde I_{0,n} \big| e^{-i\phi} e^{-i \omega_n t} \bigg]} 
           = \sum_{n=1,n \text{ odd}}^{\infty} \big| \tilde I_{0,n} \big| \sin{( \omega_n t + \phi )} , 
\end{equation*}
where I defined $|\tilde I_{0,n}|$ and $\phi$ in \eqref{eq:qc:phioglenght}. So, in conclusion, the current running through the RC-circuit is the sum of $I_{AC}(t)$ and $I_{DC}(t)$, so
\begin{align*}
 I(t) &= I_{AC}(t) + I_{DC}(t) \\
      &= \sum_{n=1,n \text{ odd}}^{\infty} \frac{2\Ep_0}{\pi n} \omega_n C \frac{\sqrt{\omega_n^2 C^2 R^4 + 1}}{\omega_n^2 C^2 R^2 + 1} 
                                           \sin{\left( \omega_n t + \arctan{\left( \frac{1}{\omega_n C R} \right)} \right)} 
         + \frac{\Ep_0}{2R} e^{-t/RC}
\end{align*}