% =============================================================================
% ch06_mechanical_applications.tex
% Chapter 6: Mechanical Applications and RLC Circuits
% =============================================================================

\section{Mechanical Applications}
\label{ch:mechanical_applications}

Many real-world systems are modeled by second-order linear differential equations.
In this chapter, we apply the theory developed in \cref{ch:second_order_homogeneous,ch:second_order_nonhomogeneous}
to mechanical vibrations and the closely related RLC electrical circuits.
Every model follows the same pipeline: \textbf{real-world setup} $\to$ \textbf{force analysis} $\to$ \textbf{ODE} $\to$ \textbf{solution}.

\subsection{Spring-Mass Systems}
\label{sec:ch06_spring_mass}

We begin with the fundamental mechanical system: a mass attached to a spring, possibly with a damper and an external driving force.

\paragraph{Physical setup.}
Consider a mass $m$ attached to a vertical spring with spring constant $k$.
The spring is fixed at its top end. We define the \textbf{equilibrium position} as the point where the mass hangs at rest with no motion.
We measure the displacement $u(t)$ from this equilibrium position, with the \textbf{downward direction taken as positive}.

\begin{figure}[htbp]
\centering
\begin{tikzpicture}[scale=0.9]
  % Wall
  \draw[thick] (0,0) -- (2,0);
  \draw[thick] (0,0) -- (0,-0.3);
  \draw[thick] (2,0) -- (2,-0.3);
  % Hatching
  \foreach \x in {0,0.2,0.4,...,2} {
    \draw[thin] (\x,0) -- (\x-0.15,-0.15);
  }
  % Spring (coil representation)
  \draw[thick] (1,0) -- (1, -0.15);
  \draw[thick] (1, -0.15) -- (0.85, -0.25);
  \draw[thick] (0.85, -0.25) -- (1.15, -0.35);
  \draw[thick] (1.15, -0.35) -- (0.85, -0.45);
  \draw[thick] (0.85, -0.45) -- (1.15, -0.55);
  \draw[thick] (1.15, -0.55) -- (0.85, -0.65);
  \draw[thick] (0.85, -0.65) -- (1.15, -0.75);
  \draw[thick] (1.15, -0.75) -- (0.85, -0.85);
  \draw[thick] (0.85, -0.85) -- (1.15, -0.95);
  \draw[thick] (1.15, -0.95) -- (0.85, -1.05);
  \draw[thick] (0.85, -1.05) -- (1.15, -1.15);
  \draw[thick] (1.15, -1.15) -- (0.85, -1.25);
  \draw[thick] (0.85, -1.25) -- (1.15, -1.35);
  \draw[thick] (1.15, -1.35) -- (1, -1.5);
  % Mass
  \fill[gray!40] (0.65,-1.5) rectangle (1.35,-2.1);
  \node at (1,-1.8) {\small $m$};
  % Equilibrium line
  \draw[dashed] (0,-1.8) -- (2,-1.8);
  \node[right] at (2,-1.8) {\small equilibrium};
  % Displacement arrow
  \draw[->, red, thick] (1.6,-1.8) -- (1.6,-2.8);
  \node[right, red] at (1.6,-2.3) {\small $u(t)$};
  % Force arrows on mass
  \draw[->, blue, thick] (0.8,-1.5) -- (0.8,-0.5);
  \node[left, blue] at (0.8,-1) {\small $F_s$};
  \draw[->, blue, thick] (1.2,-2.1) -- (1.2,-3.1);
  \node[right, blue] at (1.2,-2.6) {\small $F_g$};
  \draw[->, orange, thick] (0.5,-1.8) -- (0.1,-1.8);
  \node[above, orange] at (0.3,-1.8) {\small $F_d$};
\end{tikzpicture}
\caption{Spring-mass-damper system. The mass $m$ is displaced by $u(t)$ from equilibrium. Downward is positive.}
\label{fig:spring_mass}
\end{figure}

\paragraph{Force analysis.}
We identify four forces acting on the mass (positive direction = downward):

\begin{enumerate}
  \item \textbf{Gravity:} $F_g = mg$.
  \item \textbf{Spring force (Hooke's law):} The spring exerts a restoring force proportional to its stretch from the natural length. If $L$ is the stretch at equilibrium, then the total stretch is $L + u(t)$. The spring force (upward) is $F_s = -k(L + u)$.
  \item \textbf{Damping force:} A dashpot/damper provides a force proportional to velocity, opposing motion: $F_d = -c\,u'$, where $c > 0$ is the damping coefficient.
  \item \textbf{External force:} An applied driving force $F(t)$.
\end{enumerate}

\paragraph{Newton's Second Law.}
Summing forces and applying $F_{\text{net}} = ma$:
\begin{equation}
  \label{eq:spring_mass_raw}
  m\,u'' = mg - k(L + u) - c\,u' + F(t).
\end{equation}

At equilibrium (the mass hangs at rest with $u = 0$ and $u' = u'' = 0$):
\begin{equation}
  \label{eq:equilibrium}
  0 = mg - kL \quad\Longrightarrow\quad mg = kL.
\end{equation}

Substituting $mg = kL$ into \cref{eq:spring_mass_raw}:
\begin{equation}
  \label{eq:spring_mass_ode}
  m\,u'' + c\,u' + k\,u = F(t).
\end{equation}

\begin{keyresult}
  \textbf{Spring-mass-damper equation.}
  The displacement $u(t)$ of a mass-spring-damper system from equilibrium satisfies
  \[
    m\,u''(t) + c\,u'(t) + k\,u(t) = F(t),
  \]
  where $m > 0$ is the mass, $c \ge 0$ is the damping coefficient, $k > 0$ is the spring constant, and $F(t)$ is the external force.
\end{keyresult}

When $F(t) \equiv 0$, the equation is homogeneous and describes \textbf{free vibrations}. When $F(t) \neq 0$, we have \textbf{forced vibrations}. Both cases are analyzed below. The ODE \cref{eq:spring_mass_ode} has the same mathematical form as the general second-order linear equation \cref{eq:nonhomogeneous_general} from \cref{ch:second_order_nonhomogeneous}, so all the solution methods from \cref{ch:second_order_homogeneous,ch:second_order_nonhomogeneous} apply directly.

\begin{hintbox}
  \textbf{Key insight.} The displacement $u(t)$ is measured from \emph{equilibrium}, not from the spring's natural length. This is what eliminates the $mg$ and $kL$ terms and gives us the clean equation \cref{eq:spring_mass_ode}. Always set up your coordinate system this way.
\end{hintbox}

\begin{workedexample}
  A spring stretches $0.3\,\text{m}$ when a $2\,\text{kg}$ mass is attached. The mass is then pulled down an additional $0.2\,\text{m}$ from equilibrium and released with an upward velocity of $1\,\text{m/s}$. There is no damping and no external force. Set up the initial value problem (IVP) and solve for $u(t)$.

  \textbf{Solution.} \textit{Step 1: Determine parameters.} The mass is $m = 2\,\text{kg}$. At equilibrium, $mg = kL$, so
  \[
    k = \frac{mg}{L} = \frac{2 \cdot 9.8}{0.3} = \frac{19.6}{0.3} = \frac{196}{3}\,\text{N/m}.
  \]
  There is no damping: $c = 0$. No external force: $F(t) = 0$.

  \textit{Step 2: Form the IVP.} The ODE is
  \[
    2\,u'' + \frac{196}{3}\,u = 0 \quad\Longrightarrow\quad u'' + \frac{98}{3}\,u = 0.
  \]
  Initial conditions: the mass is pulled down $0.2\,\text{m}$, so $u(0) = 0.2$. It is released with upward velocity $1\,\text{m/s}$; since downward is positive, $u'(0) = -1$.

  \textit{Step 3: Solve.} The characteristic equation is
  \[
    r^2 + \frac{98}{3} = 0 \quad\Longrightarrow\quad r = \pm i\sqrt{\frac{98}{3}} = \pm i\,\frac{7\sqrt{2}}{\sqrt{3}}.
  \]
  Let $\omega_0 = \sqrt{98/3} \approx 5.715$. The general solution is
  \[
    u(t) = c_1 \cos(\omega_0 t) + c_2 \sin(\omega_0 t).
  \]
  Differentiate:
  \[
    u'(t) = -\omega_0 c_1 \sin(\omega_0 t) + \omega_0 c_2 \cos(\omega_0 t).
  \]
  Apply initial conditions:
  \[
    \begin{cases}
      u(0) = c_1 = 0.2, \\
      u'(0) = \omega_0 c_2 = -1 \quad\Longrightarrow\quad c_2 = -\dfrac{1}{\omega_0} = -\dfrac{\sqrt{3}}{7\sqrt{2}} \approx -0.175.
    \end{cases}
  \]
  The solution is
  \[
    u(t) = 0.2\,\cos(\omega_0 t) - \frac{1}{\omega_0}\,\sin(\omega_0 t),
    \qquad \omega_0 = \sqrt{\frac{98}{3}}.
  \]
\end{workedexample}

\subsection{Free Vibrations: Damping Cases}
\label{sec:ch06_free_vibrations}

We now analyze the homogeneous equation
\begin{equation}
  \label{eq:free_vibration}
  m\,u'' + c\,u' + k\,u = 0,
\end{equation}
which models free vibrations (no external driving force). Dividing by $m$:
\begin{equation}
  \label{eq:free_normalized}
  u'' + \frac{c}{m}\,u' + \frac{k}{m}\,u = 0.
\end{equation}
The characteristic equation is
\begin{equation}
  \label{eq:mechanical_characteristic}
  m\,r^2 + c\,r + k = 0,
\end{equation}
with roots
\[
  r = \frac{-c \pm \sqrt{c^2 - 4mk}}{2m}.
\]
The behavior depends entirely on the sign of the discriminant $\Delta = c^2 - 4mk$. We define the \textbf{natural frequency}
\[
  \omega_0 = \sqrt{\frac{k}{m}}
\]
and the \textbf{critical damping coefficient}
\begin{equation}
  \label{eq:critical_damping}
  c_{\text{cr}} = 2\sqrt{mk} = 2m\omega_0.
\end{equation}
The three cases correspond to $c < c_{\text{cr}}$, $c = c_{\text{cr}}$, and $c > c_{\text{cr}}$.

\subsubsection{Underdamped Case ($c^2 < 4mk$)}
\label{sec:ch06_underdamped}

When $c^2 < 4mk$ (equivalently, $c < c_{\text{cr}}$), the discriminant is negative and the roots are complex conjugates:
\[
  r = -\frac{c}{2m} \pm i\,\omega_d,
  \qquad
  \omega_d = \frac{\sqrt{4mk - c^2}}{2m} = \sqrt{\omega_0^2 - \left(\frac{c}{2m}\right)^2}.
\]

\begin{keyresult}
  \textbf{Underdamped solution.}
  When $c^2 < 4mk$, the general solution is
  \[
    u(t) = e^{-ct/(2m)}\Bigl[c_1\cos(\omega_d t) + c_2\sin(\omega_d t)\Bigr],
  \]
  where $\omega_d = \sqrt{\omega_0^2 - (c/(2m))^2}$ is the \textbf{damped natural frequency}. Equivalently, in amplitude--phase form:
  \[
    u(t) = A\,e^{-ct/(2m)}\cos(\omega_d t - \phi),
  \]
  with $A = \sqrt{c_1^2 + c_2^2}$ and $\phi = \arctan(c_2/c_1)$.
\end{keyresult}

\paragraph{Physical interpretation.}
The mass oscillates at frequency $\omega_d$ (slightly lower than the natural frequency $\omega_0$), while the exponential envelope $e^{-ct/(2m)}$ causes the amplitude to decay over time. The system is ``underdamped'' because the damping is not strong enough to prevent oscillation.

\begin{hintbox}
  \textbf{Identifying the damping regime.} Compute the ratio $c/c_{\text{cr}}$. If $c/c_{\text{cr}} < 1$, the system is underdamped; if equal to 1, critically damped; if greater than 1, overdamped. The dimensionless ratio $\zeta = c/c_{\text{cr}}$ is called the \textbf{damping ratio}.
\end{hintbox}

\subsubsection{Critically Damped Case ($c^2 = 4mk$)}
\label{sec:ch06_critical}

When $c^2 = 4mk$ (equivalently, $c = c_{\text{cr}}$), the characteristic equation has a double root:
\[
  r = -\frac{c}{2m} = -\omega_0.
\]

\begin{keyresult}
  \textbf{Critically damped solution.}
  When $c^2 = 4mk$, the general solution is
  \[
    u(t) = c_1 e^{-ct/(2m)} + c_2\,t\,e^{-ct/(2m)}.
  \]
\end{keyresult}

\paragraph{Physical interpretation.}
The mass returns to equilibrium \textbf{as fast as possible without oscillating}. This is often the desired behavior in engineering systems such as door closers and shock absorbers: you want the system to settle quickly but without bouncing. The $t\,e^{-ct/(2m)}$ factor is a direct application of the repeated-root solution from \cref{sec:ch04_repeated_roots}.

\subsubsection{Overdamped Case ($c^2 > 4mk$)}
\label{sec:ch06_overdamped}

When $c^2 > 4mk$ (equivalently, $c > c_{\text{cr}}$), the discriminant is positive and the roots are two distinct real numbers:
\[
  r_1 = \frac{-c + \sqrt{c^2 - 4mk}}{2m}, \qquad
  r_2 = \frac{-c - \sqrt{c^2 - 4mk}}{2m}.
\]
Both roots are negative (since $\sqrt{c^2 - 4mk} < c$ when $k > 0$).

\begin{keyresult}
  \textbf{Overdamped solution.}
  When $c^2 > 4mk$, the general solution is
  \[
    u(t) = c_1 e^{r_1 t} + c_2 e^{r_2 t},
  \]
  with $r_1 < 0$ and $r_2 < 0$.
\end{keyresult}

\paragraph{Physical interpretation.}
The mass returns to equilibrium without oscillation, but more slowly than the critically damped case. The heavy damping ``overdamps'' the system, causing sluggish motion. The displacement is a sum of two decaying exponentials.

\subsubsection{Damping Cases Comparison}
\label{sec:ch06_damping_comparison}

\begin{figure}[htbp]
\centering
\begin{tikzpicture}[scale=0.85]
  % Three subplots
  \begin{scope}[shift={(0,0)}]
    \draw[->] (-0.2,0) -- (5.5,0);
    \draw[->] (0,-1.2) -- (0,1.2);
    \node[below] at (5.5,0) {\small $t$};
    \node[left] at (0,1.2) {\small $u(t)$};
    % Underdamped: oscillating decay
    \draw[thick, blue!70] plot[domain=0:5.2, samples=200, smooth]
      ({\x}, {exp(-0.3*\x)*cos(3*\x)});
    \draw[dashed, blue!30] plot[domain=0:5.2, samples=50, smooth]
      ({\x}, {exp(-0.3*\x)});
    \draw[dashed, blue!30] plot[domain=0:5.2, samples=50, smooth]
      ({\x}, {-exp(-0.3*\x)});
    \node[above, blue!70] at (2.5,0.7) {Underdamped};
    \node[above, blue!70, font=\small] at (2.5,0.55) {$c < c_{\text{cr}}$};
    \draw[dashed, gray!60] (-0.1,0) -- (5.3,0);
  \end{scope}

  \begin{scope}[shift={(6.5,0)}]
    \draw[->] (-0.2,0) -- (5.5,0);
    \draw[->] (0,-1.2) -- (0,1.2);
    \node[below] at (5.5,0) {\small $t$};
    \node[left] at (0,1.2) {\small $u(t)$};
    % Critically damped: fastest non-oscillatory
    \draw[thick, red!70] plot[domain=0:5.2, samples=100, smooth]
      ({\x}, {(1 + 1.2*\x)*exp(-1.2*\x)});
    \node[above, red!70] at (2.5,0.7) {Critically damped};
    \node[above, red!70, font=\small] at (2.5,0.55) {$c = c_{\text{cr}}$};
    \draw[dashed, gray!60] (-0.1,0) -- (5.3,0);
  \end{scope}

  \begin{scope}[shift={(13,0)}]
    \draw[->] (-0.2,0) -- (5.5,0);
    \draw[->] (0,-1.2) -- (0,1.2);
    \node[below] at (5.5,0) {\small $t$};
    \node[left] at (0,1.2) {\small $u(t)$};
    % Overdamped: slow decay, no oscillation
    \draw[thick, green!70] plot[domain=0:5.2, samples=100, smooth]
      ({\x}, {exp(-0.4*\x) - 0.2*exp(-2*\x)});
    \node[above, green!70] at (2.5,0.7) {Overdamped};
    \node[above, green!70, font=\small] at (2.5,0.55) {$c > c_{\text{cr}}$};
    \draw[dashed, gray!60] (-0.1,0) -- (5.3,0);
  \end{scope}
\end{tikzpicture}
\caption{Displacement vs.\ time for the three damping regimes (all with $u(0) > 0$, $u'(0) = 0$). Underdamped: oscillatory decay. Critically damped: fastest non-oscillatory return. Overdamped: slow non-oscillatory decay.}
\label{fig:damping_cases}
\end{figure}

\subsubsection{Worked Examples}
\label{sec:ch06_free_examples}

\begin{workedexample}
  (Underdamped IVP) A $4\,\text{kg}$ mass is attached to a spring with constant $k = 64\,\text{N/m}$. The damping coefficient is $c = 8\,\text{N}\cdot\text{s/m}$. The mass is pulled down $0.5\,\text{m}$ from equilibrium and released with zero initial velocity. Find $u(t)$.

  \textbf{Solution.} \textit{Step 1: Determine the damping regime.}
  \[
    c^2 = 64, \qquad 4mk = 4 \cdot 4 \cdot 64 = 1024.
  \]
  Since $c^2 = 64 < 1024 = 4mk$, the system is \textbf{underdamped}.

  \textit{Step 2: Compute parameters.}
  \[
    \frac{c}{2m} = \frac{8}{8} = 1, \qquad
    \omega_0 = \sqrt{\frac{k}{m}} = \sqrt{\frac{64}{4}} = 4,
  \]
  \[
    \omega_d = \sqrt{\omega_0^2 - \left(\frac{c}{2m}\right)^2}
             = \sqrt{16 - 1} = \sqrt{15}.
  \]

  \textit{Step 3: General solution.}
  \[
    u(t) = e^{-t}\Bigl[c_1\cos(\sqrt{15}\,t) + c_2\sin(\sqrt{15}\,t)\Bigr].
  \]

  \textit{Step 4: Apply initial conditions.} $u(0) = 0.5$ and $u'(0) = 0$.
  \[
    u(0) = c_1 = 0.5.
  \]
  Differentiate:
  \[
    u'(t) = -e^{-t}\bigl[c_1\cos(\sqrt{15}\,t) + c_2\sin(\sqrt{15}\,t)\bigr]
            + e^{-t}\bigl[-\sqrt{15}\,c_1\sin(\sqrt{15}\,t) + \sqrt{15}\,c_2\cos(\sqrt{15}\,t)\bigr].
  \]
  \[
    u'(0) = -c_1 + \sqrt{15}\,c_2 = 0 \quad\Longrightarrow\quad
    c_2 = \frac{c_1}{\sqrt{15}} = \frac{0.5}{\sqrt{15}} = \frac{1}{2\sqrt{15}}.
  \]

  The solution is
  \[
    u(t) = e^{-t}\left(\frac{1}{2}\cos(\sqrt{15}\,t) + \frac{1}{2\sqrt{15}}\sin(\sqrt{15}\,t)\right).
  \]
  The mass oscillates with damped frequency $\sqrt{15} \approx 3.87\,\text{rad/s}$ while the amplitude decays like $e^{-t}$.
\end{workedexample}

\begin{workedexample}
  (Overdamped IVP) A $2\,\text{kg}$ mass is attached to a spring with $k = 10\,\text{N/m}$ and a damper with $c = 14\,\text{N}\cdot\text{s/m}$. The mass is displaced $1\,\text{m}$ above equilibrium and released with downward velocity $3\,\text{m/s}$. Find $u(t)$.

  \textbf{Solution.} \textit{Step 1: Determine the damping regime.}
  \[
    c^2 = 196, \qquad 4mk = 4 \cdot 2 \cdot 10 = 80.
  \]
  Since $c^2 = 196 > 80 = 4mk$, the system is \textbf{overdamped}.

  \textit{Step 2: Compute roots.}
  \[
    r = \frac{-14 \pm \sqrt{196 - 80}}{4}
      = \frac{-14 \pm \sqrt{116}}{4}
      = \frac{-14 \pm 2\sqrt{29}}{4}
      = \frac{-7 \pm \sqrt{29}}{2}.
  \]
  So $r_1 = \dfrac{-7 + \sqrt{29}}{2} \approx -0.191$ and $r_2 = \dfrac{-7 - \sqrt{29}}{2} \approx -6.809$.

  \textit{Step 3: General solution.}
  \[
    u(t) = c_1 e^{r_1 t} + c_2 e^{r_2 t}.
  \]

  \textit{Step 4: Apply initial conditions.} $u(0) = -1$ (above equilibrium, so negative) and $u'(0) = 3$ (downward is positive).
  \[
    u(0) = c_1 + c_2 = -1.
  \]
  \[
    u'(0) = r_1 c_1 + r_2 c_2 = 3.
  \]
  From the first equation, $c_2 = -1 - c_1$. Substituting into the second:
  \[
    r_1 c_1 + r_2(-1 - c_1) = 3 \quad\Longrightarrow\quad
    (r_1 - r_2)c_1 = 3 + r_2.
  \]
  \[
    c_1 = \frac{3 + r_2}{r_1 - r_2}
        = \frac{3 + \frac{-7 - \sqrt{29}}{2}}{\sqrt{29}}
        = \frac{6 - 7 - \sqrt{29}}{2\sqrt{29}}
        = \frac{-1 - \sqrt{29}}{2\sqrt{29}},
  \]
  \[
    c_2 = -1 - c_1 = -1 + \frac{1 + \sqrt{29}}{2\sqrt{29}}
         = \frac{-2\sqrt{29} + 1 + \sqrt{29}}{2\sqrt{29}}
         = \frac{1 - \sqrt{29}}{2\sqrt{29}}.
  \]

  The solution is
  \[
    u(t) = \frac{-1 - \sqrt{29}}{2\sqrt{29}}\,e^{r_1 t}
           + \frac{1 - \sqrt{29}}{2\sqrt{29}}\,e^{r_2 t}.
  \]
  Both exponential terms decay to zero. The term with $r_2 \approx -6.809$ decays very rapidly, so for large $t$, the behavior is dominated by the slower-decaying $r_1 \approx -0.191$ term.
\end{workedexample}

\subsection{Forced Vibrations}
\label{sec:ch06_forced_vibrations}

We now consider the nonhomogeneous equation
\begin{equation}
  \label{eq:forced_vibration}
  m\,u'' + c\,u' + k\,u = F_0\cos(\omega t),
\end{equation}
where a periodic external force $F_0\cos(\omega t)$ drives the system. The forcing frequency $\omega$ may or may not coincide with the system's natural frequency $\omega_0$.

The general solution is $u(t) = u_h(t) + u_p(t)$, where $u_h(t)$ is the homogeneous solution (free vibration, from \cref{sec:ch06_free_vibrations}) and $u_p(t)$ is a particular solution forced by the driving term.

\paragraph{Finding the steady-state solution.}
Since $g(t) = F_0\cos(\omega t)$ is a trigonometric function, we can use the method of undetermined coefficients from \cref{sec:ch05_undetermined_coefficients}. The guess is
\[
  u_p(t) = A\cos(\omega t) + B\sin(\omega t).
\]
(Note: if $\omega = \omega_0$ and $c = 0$, this guess overlaps with the homogeneous solution and requires the modification rule; this is the pure resonance case discussed in \cref{sec:ch06_resonance}.)

Differentiating:
\begin{align*}
  u_p'(t) &= -\omega A\sin(\omega t) + \omega B\cos(\omega t), \\
  u_p''(t) &= -\omega^2 A\cos(\omega t) - \omega^2 B\sin(\omega t).
\end{align*}

Substitute into \cref{eq:forced_vibration}:
\[
  \bigl[-m\omega^2 A - c\omega\omega B + kA\bigr]\cos(\omega t)
  + \bigl[-m\omega^2 B + c\omega A + kB\bigr]\sin(\omega t)
  = F_0\cos(\omega t).
\]

Equating coefficients:
\[
  \begin{cases}
    (k - m\omega^2)A - c\omega B = F_0, \\
    c\omega A + (k - m\omega^2)B = 0.
  \end{cases}
\]

Solving this system (e.g., by Cramer's rule):
\[
  \det = (k - m\omega^2)^2 + (c\omega)^2,
\]
\[
  A = \frac{F_0(k - m\omega^2)}{(k - m\omega^2)^2 + (c\omega)^2}, \qquad
  B = \frac{F_0\,c\omega}{(k - m\omega^2)^2 + (c\omega)^2}.
\]

It is more illuminating to write the solution in amplitude--phase form. Define
\[
  C = \sqrt{A^2 + B^2}, \qquad
  \delta = \arctan\!\left(\frac{B}{A}\right) = \arctan\!\left(\frac{c\omega}{k - m\omega^2}\right).
\]
Then
\[
  A\cos(\omega t) + B\sin(\omega t) = C\cos(\omega t - \delta).
\]

\begin{keyresult}
  \textbf{Steady-state (particular) solution for forced vibrations.}
  For $m\,u'' + c\,u' + k\,u = F_0\cos(\omega t)$, the steady-state solution is
  \[
    u_p(t) = C\cos(\omega t - \delta),
  \]
  where
  \[
    C = \frac{F_0}{\sqrt{(k - m\omega^2)^2 + (c\omega)^2}}, \qquad
    \delta = \arctan\!\left(\frac{c\omega}{k - m\omega^2}\right).
  \]
  The amplitude $C$ and phase shift $\delta$ depend on the forcing frequency $\omega$, the system parameters, and the forcing strength $F_0$.
\end{keyresult}

\paragraph{Amplitude vs.\ frequency.}
The amplitude $C(\omega)$ as a function of the forcing frequency is called the \textbf{amplitude response} or \textbf{frequency response}. Its shape reveals the resonance behavior of the system.

\begin{figure}[htbp]
\centering
\begin{tikzpicture}[scale=0.9]
  \draw[->] (0,0) -- (6.5,0);
  \draw[->] (0,-0.3) -- (0,3.5);
  \node[below] at (6.5,0) {\small $\omega$};
  \node[left] at (0,3.5) {\small $C(\omega)$};
  \node[left] at (0,3.0) {\small $C_{\max}$};

  % Natural frequency marker
  \draw[dashed, gray!60] (3.5,0) -- (3.5,3.2);
  \node[below] at (3.5,-0.2) {\small $\omega_0$};

  % Resonance curve (moderate damping)
  \draw[thick, blue!70] plot[domain=0.1:6.2, samples=300, smooth]
    ({\x}, {2.0 / sqrt((1 - 0.0816*\x*\x)^2 + (0.15*\x)^2)});

  % Undamped curve (narrower, higher peak)
  \draw[thick, red!60, dashed] plot[domain=0.1:6.2, samples=300, smooth]
    ({\x}, {2.0 / abs(1 - 0.0816*\x*\x)});

  % Legend
  \node[right, blue!70] at (5.0,0.6) {damped ($c > 0$)};
  \node[right, red!60] at (5.0,1.3) {undamped ($c = 0$)};

  % Phase shift annotations
  \node[below, font=\small] at (1.5,-0.25) {0 $\le \delta < \pi/2$};
  \node[below, font=\small] at (4.8,-0.25) {$\pi/2 < \delta \le \pi$};

  % Peak
  \fill[blue!70] (3.4,3.0) circle (1.5pt);
\end{tikzpicture}
\caption{Amplitude response $C(\omega)$ for forced vibrations. The damped system (blue) has a finite peak near $\omega_0$. The undamped system (red dashed) has a vertical asymptote at $\omega = \omega_0$ (pure resonance).}
\label{fig:resonance_curve}
\end{figure}

Key observations:
\begin{itemize}
  \item When $\omega \ll \omega_0$, the amplitude is approximately $F_0/k$ (the static deflection).
  \item As $\omega$ approaches $\omega_0$, the amplitude grows significantly.
  \item When $\omega \gg \omega_0$, the amplitude decays like $1/\omega^2$ (the mass cannot keep up with the rapid forcing).
  \item With damping ($c > 0$), the peak is finite. Without damping ($c = 0$), the amplitude goes to infinity at $\omega = \omega_0$ (pure resonance).
\end{itemize}

\paragraph{Phase shift.}
The phase shift $\delta$ describes how much the response lags behind the forcing:
\begin{itemize}
  \item When $\omega \ll \omega_0$: $\delta \approx 0$ (response is in phase with forcing).
  \item When $\omega = \omega_0$: $\delta = \pi/2$ (response lags by $90^\circ$).
  \item When $\omega \gg \omega_0$: $\delta \approx \pi$ (response is nearly out of phase).
\end{itemize}

\begin{hintbox}
  \textbf{Two components of the full solution.} The complete solution is $u(t) = u_h(t) + u_p(t)$. The homogeneous part $u_h(t)$ (transient response) decays to zero when $c > 0$, leaving only the steady-state response $u_p(t)$ at large times. This is why engineers focus primarily on $u_p(t)$ for long-term behavior.
\end{hintbox}

\begin{workedexample}
  Consider a mass-spring-damper system with $m = 1\,\text{kg}$, $k = 4\,\text{N/m}$, and $c = 2\,\text{N}\cdot\text{s/m}$. The system is driven by $F(t) = 8\cos(2t)$. Find the steady-state solution.

  \textbf{Solution.} The forcing frequency is $\omega = 2$. The natural frequency is $\omega_0 = \sqrt{k/m} = \sqrt{4} = 2$. Since $\omega = \omega_0$, this is the resonant case (though damped, so no unbounded growth).

  The amplitude is
  \[
    C = \frac{F_0}{\sqrt{(k - m\omega^2)^2 + (c\omega)^2}}
      = \frac{8}{\sqrt{(4 - 1\cdot 4)^2 + (2\cdot 2)^2}}
      = \frac{8}{\sqrt{0 + 16}} = \frac{8}{4} = 2.
  \]

  The phase shift:
  \[
    \delta = \arctan\!\left(\frac{c\omega}{k - m\omega^2}\right)
           = \arctan\!\left(\frac{4}{0}\right)
           = \frac{\pi}{2}.
  \]

  The steady-state solution is
  \[
    u_p(t) = 2\cos\!\left(2t - \frac{\pi}{2}\right) = 2\sin(2t).
  \]
  (We used $\cos(\theta - \pi/2) = \sin(\theta)$.) The amplitude is $2\,\text{m}$ and the response is a pure sine wave, lagging the cosine forcing by $90^\circ$.
\end{workedexample}

\begin{workedexample}
  Using the same system ($m = 1$, $k = 4$, $c = 2$), suppose the forcing is instead $F(t) = 8\cos(t)$. Find the steady-state solution and compare the amplitude to the resonant case.

  \textbf{Solution.} Here $\omega = 1$, which is below resonance ($\omega_0 = 2$).

  \[
    C = \frac{8}{\sqrt{(4 - 1\cdot 1)^2 + (2\cdot 1)^2}}
      = \frac{8}{\sqrt{9 + 4}} = \frac{8}{\sqrt{13}} \approx 2.22.
  \]
  \[
    \delta = \arctan\!\left(\frac{2\cdot 1}{4 - 1\cdot 1}\right)
           = \arctan\!\left(\frac{2}{3}\right) \approx 0.588\,\text{rad} \approx 33.7^\circ.
  \]

  The steady-state solution is
  \[
    u_p(t) \approx 2.22\cos(t - 0.588).
  \]
  Interestingly, the amplitude at $\omega = 1$ is slightly larger than the amplitude at resonance $\omega = 2$ (where it was $2.0$). This is because the \textit{practical resonance} peak (see \cref{sec:ch06_resonance}) shifts slightly below $\omega_0$ when damping is present. Here $c^2 = 4$ and $2mk = 8$, so $c^2 < 2mk$ and practical resonance exists at $\omega_{\text{pr}} = \sqrt{4 - 4/2} = \sqrt{2} \approx 1.414$, between $\omega = 1$ and $\omega = 2$.
\end{workedexample}

\subsection{Resonance}
\label{sec:ch06_resonance}

Resonance is the phenomenon where a periodic driving force causes dramatically amplified oscillations. It is one of the most important concepts in mechanical engineering and has both beneficial applications and catastrophic failure modes.

\subsubsection{Pure Resonance (Undamped, $c = 0$)}
\label{sec:ch06_pure_resonance}

Consider the undamped forced equation
\[
  m\,u'' + k\,u = F_0\cos(\omega t).
\]
The natural frequency is $\omega_0 = \sqrt{k/m}$. When the forcing frequency $\omega$ differs from $\omega_0$, the method of undetermined coefficients gives the steady-state solution
\[
  u_p(t) = \frac{F_0}{k - m\omega^2}\cos(\omega t),
\]
which has a finite amplitude $F_0/|k - m\omega^2|$.

But when $\omega = \omega_0$, the coefficient $k - m\omega^2 = 0$ and the amplitude would be infinite --- the guess $A\cos(\omega_0 t)$ fails because it is a solution of the homogeneous equation. We must apply the \textbf{modification rule} from \cref{sec:ch05_modification_rule}: multiply the guess by $t$.

Try $u_p(t) = t\,[A\cos(\omega_0 t) + B\sin(\omega_0 t)]$. Differentiating:
\begin{align*}
  u_p' &= A\cos(\omega_0 t) + B\sin(\omega_0 t) + \omega_0 t[-A\sin(\omega_0 t) + B\cos(\omega_0 t)], \\
  u_p'' &= -2\omega_0 A\sin(\omega_0 t) + 2\omega_0 B\cos(\omega_0 t)
          - \omega_0^2 t[A\cos(\omega_0 t) + B\sin(\omega_0 t)].
\end{align*}

Substitute into $u'' + \omega_0^2 u = (F_0/m)\cos(\omega_0 t)$:
\[
  -2\omega_0 A\sin(\omega_0 t) + 2\omega_0 B\cos(\omega_0 t) = \frac{F_0}{m}\cos(\omega_0 t).
\]

Equating coefficients:
\[
  -2\omega_0 A = 0 \quad\Longrightarrow\quad A = 0,
  \qquad
  2\omega_0 B = \frac{F_0}{m} \quad\Longrightarrow\quad B = \frac{F_0}{2m\omega_0}.
\]

\begin{keyresult}
  \textbf{Pure resonance solution.}
  For $m\,u'' + k\,u = F_0\cos(\omega_0 t)$ (undamped, forcing at natural frequency), the particular solution is
  \[
    u_p(t) = \frac{F_0}{2m\omega_0}\,t\,\sin(\omega_0 t).
  \]
  The general solution is
  \[
    u(t) = c_1\cos(\omega_0 t) + c_2\sin(\omega_0 t)
           + \frac{F_0}{2m\omega_0}\,t\,\sin(\omega_0 t).
  \]
  The amplitude grows \textbf{linearly with time}, leading to unbounded oscillation.
\end{keyresult}

\paragraph{Physical interpretation.}
In pure resonance, energy is fed into the system at exactly the right rate to build oscillations without limit. The $t\,\sin(\omega_0 t)$ term represents oscillations whose envelope grows linearly. In reality, some damping is always present, so true pure resonance does not occur, but it provides a useful theoretical limit.

\paragraph{Catastrophic examples.}
\begin{itemize}
  \item \textbf{Tacoma Narrows Bridge collapse (1940):} Wind-induced oscillations excited the bridge's natural frequency, leading to destructive resonance and eventual collapse.
  \item \textbf{Operational military marching:} Soldiers are ordered to break step when crossing bridges to avoid exciting the bridge's natural frequency.
  \item \textbf{Breaking glass with sound:} An opera singer hitting the right note can shatter a wine glass through resonance.
\end{itemize}

\paragraph{Beneficial applications.}
\begin{itemize}
  \item \textbf{Tuning forks and musical instruments:} Resonance amplifies the sound at specific frequencies.
  \item \textbf{MRI machines:} Nuclear magnetic resonance exploits resonance at the atomic level.
  \item \textbf{Radio receivers:} Tuned circuits resonate at the frequency of the desired broadcast.
\end{itemize}

\begin{workedexample}
  (Pure resonance) A mass $m = 1\,\text{kg}$ is attached to a spring with $k = 4\,\text{N/m}$. There is no damping. The system is driven by $F(t) = 8\cos(2t)$. The mass starts at equilibrium with zero velocity: $u(0) = 0$, $u'(0) = 0$. Find $u(t)$.

  \textbf{Solution.} The natural frequency is $\omega_0 = \sqrt{k/m} = \sqrt{4} = 2$. The forcing frequency is $\omega = 2$, so $\omega = \omega_0$: this is \textbf{pure resonance}.

  The ODE is
  \[
    u'' + 4u = 8\cos(2t).
  \]

  The homogeneous solution is
  \[
    u_h(t) = c_1\cos(2t) + c_2\sin(2t).
  \]

  Using the pure resonance formula (or undetermined coefficients with modification), the particular solution is
  \[
    u_p(t) = \frac{F_0}{2m\omega_0}\,t\,\sin(\omega_0 t)
           = \frac{8}{2 \cdot 1 \cdot 2}\,t\,\sin(2t)
           = 2t\sin(2t).
  \]

  The general solution is
  \[
    u(t) = c_1\cos(2t) + c_2\sin(2t) + 2t\sin(2t).
  \]

  Apply initial conditions:
  \[
    u(0) = c_1 = 0.
  \]
  \[
    u'(t) = -2c_1\sin(2t) + 2c_2\cos(2t) + 2\sin(2t) + 4t\cos(2t),
  \]
  \[
    u'(0) = 2c_2 = 0 \quad\Longrightarrow\quad c_2 = 0.
  \]

  The solution is
  \[
    u(t) = 2t\sin(2t).
  \]
  The displacement grows without bound, with an oscillation frequency of $2\,\text{rad/s}$ and an amplitude that increases linearly as $2t$. After $10\,\text{s}$, the amplitude reaches $20\,\text{m}$.
\end{workedexample}

\subsubsection{Practical Resonance (Damped, $c > 0$)}
\label{sec:ch06_practical_resonance}

When damping is present, the amplitude $C(\omega)$ is always finite, but it still has a maximum. This maximum defines \textbf{practical resonance}.

Recall the amplitude formula:
\[
  C(\omega) = \frac{F_0}{\sqrt{(k - m\omega^2)^2 + (c\omega)^2}}.
\]

To find the frequency at which $C(\omega)$ is maximized, we minimize the denominator. Equivalently, we minimize the square of the denominator:
\[
  D(\omega) = (k - m\omega^2)^2 + (c\omega)^2.
\]
Differentiating with respect to $\omega$:
\[
  D'(\omega) = 2(k - m\omega^2)(-2m\omega) + 2c^2\omega
             = -4mk\omega + 4m^2\omega^3 + 2c^2\omega
             = 2\omega(2m^2\omega^2 - 2mk + c^2).
\]
Setting $D'(\omega) = 0$ (and discarding $\omega = 0$):
\[
  2m^2\omega^2 = 2mk - c^2 \quad\Longrightarrow\quad
  \omega^2 = \frac{2mk - c^2}{2m^2} = \frac{k}{m} - \frac{c^2}{2m^2}.
\]

\begin{keyresult}
  \textbf{Practical resonance frequency.}
  For the damped forced system $m\,u'' + c\,u' + k\,u = F_0\cos(\omega t)$, the amplitude $C(\omega)$ is maximized at
  \[
    \omega_{\text{pr}} = \sqrt{\omega_0^2 - \frac{c^2}{2m^2}}
                       = \sqrt{\frac{k}{m} - \frac{c^2}{2m^2}}.
  \]
  Practical resonance exists (i.e., $\omega_{\text{pr}}$ is real and positive) only when
  \[
    c^2 < 2mk.
  \]
  If $c^2 \ge 2mk$, the amplitude $C(\omega)$ is monotonically decreasing and no resonance peak exists.
\end{keyresult}

\begin{hintbox}
  \textbf{Key comparison.} The practical resonance frequency $\omega_{\text{pr}}$ is always \textit{below} the natural frequency $\omega_0$ (when damping is present). As damping increases, the peak shifts further below $\omega_0$ and becomes lower. When damping is strong enough ($c^2 \ge 2mk$), the peak disappears entirely.
\end{hintbox}

\subsection{Beats}
\label{sec:ch06_beats}

Beats occur when a system is forced at a frequency close to, but not exactly equal to, its natural frequency. This phenomenon is particularly clear in the undamped case.

Consider the undamped forced equation
\[
  u'' + \omega_0^2 u = \frac{F_0}{m}\cos(\omega t),
\]
with initial conditions $u(0) = 0$, $u'(0) = 0$, and $\omega \neq \omega_0$.

The general solution (from undetermined coefficients) is
\[
  u(t) = c_1\cos(\omega_0 t) + c_2\sin(\omega_0 t)
         + \frac{F_0}{m(\omega_0^2 - \omega^2)}\cos(\omega t).
\]

Applying the initial conditions:
\[
  u(0) = c_1 + \frac{F_0}{m(\omega_0^2 - \omega^2)} = 0
  \quad\Longrightarrow\quad
  c_1 = -\frac{F_0}{m(\omega_0^2 - \omega^2)}.
\]
\[
  u'(0) = \omega_0 c_2 = 0 \quad\Longrightarrow\quad c_2 = 0.
\]

So
\[
  u(t) = \frac{F_0}{m(\omega_0^2 - \omega^2)}\bigl[\cos(\omega t) - \cos(\omega_0 t)\bigr].
\]

Using the trigonometric identity
\[
  \cos(A) - \cos(B) = 2\sin\!\left(\frac{A + B}{2}\right)\sin\!\left(\frac{B - A}{2}\right),
\]
we rewrite:
\[
  u(t) = \frac{2F_0}{m(\omega_0^2 - \omega^2)}
         \sin\!\left(\frac{\omega_0 + \omega}{2}\,t\right)
         \sin\!\left(\frac{\omega_0 - \omega}{2}\,t\right).
\]

\begin{keyresult}
  \textbf{Beats formula.}
  For the undamped forced oscillator $u'' + \omega_0^2 u = (F_0/m)\cos(\omega t)$ with zero initial conditions and $\omega \neq \omega_0$,
  \[
    u(t) = \underbrace{\left(\frac{2F_0}{m(\omega_0^2 - \omega^2)}\right)}_{\text{constant}}
           \cdot \underbrace{\sin\!\left(\frac{\omega_0 + \omega}{2}\,t\right)}_{\text{fast oscillation}}
           \cdot \underbrace{\sin\!\left(\frac{\omega_0 - \omega}{2}\,t\right)}_{\text{slow envelope}}.
  \]
  The system oscillates at the \textbf{average frequency} $(\omega_0 + \omega)/2$ with an amplitude that varies at the \textbf{beat frequency} $|\omega_0 - \omega|/2$.
\end{keyresult}

\paragraph{Physical interpretation.}
The solution is the product of a fast oscillation (at approximately the natural frequency) and a slow envelope. When $\omega$ is close to $\omega_0$, the slow envelope varies very gradually, creating a pattern of rapid oscillations that periodically wax and wane in amplitude. This is the \textbf{beats} phenomenon.

The \textbf{beat frequency} is $f_{\text{beat}} = |\omega_0 - \omega|/(2\pi)$ (in Hz), or the angular beat frequency is $|\omega_0 - \omega|/2$ (in rad/s). One complete beat (from maximum to maximum amplitude) takes time $T_{\text{beat}} = 2\pi/|\omega_0 - \omega|$.

\begin{figure}[htbp]
\centering
\begin{tikzpicture}[scale=0.85]
  \draw[->] (-0.3,0) -- (8,0);
  \draw[->] (0,-1.5) -- (0,1.5);
  \node[below] at (8,0) {\small $t$};
  \node[left] at (0,1.5) {\small $u(t)$};

  % Beats: fast oscillation modulated by slow envelope
  \draw[thick, blue!70] plot[domain=0:7.5, samples=500, smooth]
    ({\x}, {2*sin(10*\x)*sin(0.5*\x)});

  % Envelope
  \draw[dashed, blue!30] plot[domain=0:7.5, samples=100, smooth]
    ({\x}, {2*sin(0.5*\x)});
  \draw[dashed, blue!30] plot[domain=0:7.5, samples=100, smooth]
    ({\x}, {-2*sin(0.5*\x)});

  % Annotations
  \node[above, font=\small, blue!50] at (3.9, 2.2) {envelope};
  \draw[<->, orange, thick] (0,0) -- (0,0.8);
  \node[left, orange, font=\small] at (0,0.4) {amplitude};
  \draw[<->, orange, thick] (6.28,0) -- (6.28,1.5);
  \node[right, orange, font=\small] at (6.28,0.75) {max amplitude};
  \draw[dotted, gray!50] (3.14, -0.1) -- (3.14, 0.1);
  \node[below, font=\small] at (3.14, -0.3) {node (min)};
\end{tikzpicture}
\caption{Beats pattern: rapid oscillations modulated by a slowly varying envelope. The amplitude reaches maxima and nodes (zeros) periodically.}
\label{fig:beats}
\end{figure}

\begin{workedexample}
  (Beats) An undamped mass-spring system with $m = 1\,\text{kg}$ and $k = 100\,\text{N/m}$ is driven by $F(t) = 10\cos(9t)$. The mass starts at equilibrium with zero velocity. Find $u(t)$ and describe the beats.

  \textbf{Solution.} The natural frequency is $\omega_0 = \sqrt{k/m} = \sqrt{100} = 10$. The forcing frequency is $\omega = 9$, which is close to but not equal to $\omega_0$.

  The ODE is
  \[
    u'' + 100u = 10\cos(9t).
  \]

  Using the beats formula with $F_0 = 10$, $m = 1$, $\omega_0 = 10$, $\omega = 9$:
  \[
    u(t) = \frac{2 \cdot 10}{1 \cdot (100 - 81)}
           \sin\!\left(\frac{10 + 9}{2}\,t\right)
           \sin\!\left(\frac{10 - 9}{2}\,t\right)
        = \frac{20}{19}\,\sin\!\left(\frac{19}{2}\,t\right)
                  \sin\!\left(\frac{1}{2}\,t\right).
  \]

  \textit{Description of beats:}
  \begin{itemize}
    \item Fast oscillation frequency: $(\omega_0 + \omega)/2 = 19/2 = 9.5\,\text{rad/s}$.
    \item Beat (envelope) frequency: $|\omega_0 - \omega|/2 = 1/2 = 0.5\,\text{rad/s}$.
    \item Maximum amplitude: $20/19 \approx 1.053\,\text{m}$.
    \item Time between successive beats (max to max): $T_{\text{beat}} = 2\pi / |\omega_0 - \omega| = 2\pi/1 = 2\pi \approx 6.28\,\text{s}$.
    \item Amplitude nodes (zeros): occur every $T_{\text{beat}}/2 = \pi \approx 3.14\,\text{s}$.
  \end{itemize}

  The mass oscillates rapidly at $9.5\,\text{rad/s}$, while the amplitude slowly waxes and wanes over a period of about $6.28\,\text{s}$.
\end{workedexample}

\subsection{RLC Circuits}
\label{sec:ch06_rlc_circuits}

Series RLC circuits (resistor, inductor, capacitor) are governed by the exact same mathematical equation as mechanical spring-mass-damper systems. This is not a coincidence --- it is an instance of a deep structural analogy between mechanical and electrical systems.

\paragraph{Kirchhoff's Voltage Law.}
Consider a series circuit with an inductor of inductance $L$, a resistor of resistance $R$, and a capacitor of capacitance $C$, driven by a time-varying voltage source $E(t)$. Let $q(t)$ denote the charge on the capacitor at time $t$. The current in the circuit is $i(t) = q'(t) = \diff q/\diff t$.

The voltage drops across each element are:
\begin{itemize}
  \item \textbf{Inductor:} $V_L = L\,i' = L\,q''$ (Faraday's law).
  \item \textbf{Resistor:} $V_R = R\,i = R\,q'$ (Ohm's law).
  \item \textbf{Capacitor:} $V_C = \dfrac{1}{C}\,q$ (definition of capacitance).
\end{itemize}

\textbf{Kirchhoff's Voltage Law (KVL)} states that the sum of voltage drops around a closed loop equals the applied voltage:
\[
  V_L + V_R + V_C = E(t).
\]

Substituting the expressions above:
\begin{equation}
  \label{eq:rlc_ode}
  L\,q'' + R\,q' + \frac{1}{C}\,q = E(t).
\end{equation}

\begin{keyresult}
  \textbf{RLC circuit equation.}
  The charge $q(t)$ on the capacitor in a series RLC circuit satisfies
  \[
    L\,q''(t) + R\,q'(t) + \frac{1}{C}\,q(t) = E(t).
  \]
  This is a second-order linear ODE, identical in form to the spring-mass-damper equation \cref{eq:spring_mass_ode}.
\end{keyresult}

\subsubsection{Mechanical--Electrical Analogy}
\label{sec:ch06_mech_elec_analogy}

The correspondence between mechanical and electrical quantities is exact:

\begin{table}[htbp]
\centering
\caption{Mechanical--electrical analogy}
\label{tab:mechanical_electrical}
\begin{tabular}{l l l}
  \toprule
  \textbf{Mechanical} & \textbf{Electrical} & \textbf{Quantity} \\
  \midrule
  $m$ (mass) & $L$ (inductance) & Inertia / storage of kinetic energy \\
  $c$ (damping coefficient) & $R$ (resistance) & Dissipation of energy \\
  $k$ (spring constant) & $1/C$ (inverse capacitance) & Restoring force / storage of potential energy \\
  $F(t)$ (external force) & $E(t)$ (voltage source) & External driving \\
  $u(t)$ (displacement) & $q(t)$ (charge) & State variable \\
  $u'(t)$ (velocity) & $i(t) = q'(t)$ (current) & Rate of change \\
  \bottomrule
\end{tabular}
\end{table}

The ODEs are identical under the mapping $m \leftrightarrow L$, $c \leftrightarrow R$, $k \leftrightarrow 1/C$, $F(t) \leftrightarrow E(t)$, and $u(t) \leftrightarrow q(t)$. Every result for the spring-mass system has a direct electrical counterpart.

\paragraph{Damping regimes in RLC circuits.}
The discriminant is $\Delta = R^2 - 4L/C$. The three regimes are:
\begin{itemize}
  \item \textbf{Underdamped} ($R^2 < 4L/C$): The charge oscillates with decaying amplitude. This corresponds to an LC circuit with small resistance.
  \item \textbf{Critically damped} ($R^2 = 4L/C$): The charge returns to equilibrium as fast as possible without oscillation.
  \item \textbf{Overdamped} ($R^2 > 4L/C$): The charge decays monotonically and slowly to equilibrium.
\end{itemize}

\begin{workedexample}
  A series RLC circuit has $L = 1\,\text{H}$, $R = 4\,\Omega$, and $C = \tfrac{1}{3}\,\text{F}$. The voltage source is $E(t) = 12\cos(2t)\,\text{V}$. At $t = 0$, the charge on the capacitor is $q(0) = 0$ and the current is $i(0) = 0$. Find $q(t)$.

  \textbf{Solution.} \textit{Step 1: Form the ODE.}
  \[
    q'' + 4q' + 3q = 12\cos(2t).
  \]

  \textit{Step 2: Homogeneous solution.} The characteristic equation is
  \[
    r^2 + 4r + 3 = 0 \quad\Longrightarrow\quad (r + 1)(r + 3) = 0.
  \]
  Roots: $r_1 = -1$, $r_2 = -3$. This is the \textbf{overdamped} case ($R^2 = 16 > 4L/C = 12$).
  \[
    q_h(t) = c_1 e^{-t} + c_2 e^{-3t}.
  \]

  \textit{Step 3: Particular solution.} The forcing is $12\cos(2t)$. Guess:
  \[
    q_p(t) = A\cos(2t) + B\sin(2t).
  \]
  Differentiating:
  \[
    q_p' = -2A\sin(2t) + 2B\cos(2t), \qquad
    q_p'' = -4A\cos(2t) - 4B\sin(2t).
  \]
  Substitute into $q'' + 4q' + 3q = 12\cos(2t)$:
  \[
    \bigl[-4A\cos(2t) - 4B\sin(2t)\bigr]
    + 4\bigl[-2A\sin(2t) + 2B\cos(2t)\bigr]
    + 3\bigl[A\cos(2t) + B\sin(2t)\bigr]
    = 12\cos(2t).
  \]
  Collect coefficients:
  \[
    (-4A + 8B + 3A)\cos(2t) + (-4B - 8A + 3B)\sin(2t) = 12\cos(2t).
  \]
  \[
    \begin{cases}
      -A + 8B = 12, \\
      -8A - B = 0 \quad\Longrightarrow\quad B = -8A.
    \end{cases}
  \]
  Substituting: $-A + 8(-8A) = 12 \Rightarrow -65A = 12 \Rightarrow A = -\dfrac{12}{65}$.
  Then $B = -8\left(-\dfrac{12}{65}\right) = \dfrac{96}{65}$.
  \[
    q_p(t) = -\frac{12}{65}\cos(2t) + \frac{96}{65}\sin(2t).
  \]

  \textit{Step 4: General solution.}
  \[
    q(t) = c_1 e^{-t} + c_2 e^{-3t} - \frac{12}{65}\cos(2t) + \frac{96}{65}\sin(2t).
  \]

  \textit{Step 5: Apply initial conditions.} $q(0) = 0$ and $q'(0) = i(0) = 0$.
  \[
    q(0) = c_1 + c_2 - \frac{12}{65} = 0 \quad\Longrightarrow\quad c_1 + c_2 = \frac{12}{65}.
  \]
  \[
    q'(t) = -c_1 e^{-t} - 3c_2 e^{-3t} + \frac{24}{65}\sin(2t) + \frac{192}{65}\cos(2t),
  \]
  \[
    q'(0) = -c_1 - 3c_2 + \frac{192}{65} = 0 \quad\Longrightarrow\quad c_1 + 3c_2 = \frac{192}{65}.
  \]
  Subtracting the first from the second: $2c_2 = \dfrac{180}{65} = \dfrac{36}{13}$, so $c_2 = \dfrac{18}{13} = \dfrac{90}{65}$.
  Then $c_1 = \dfrac{12}{65} - \dfrac{90}{65} = -\dfrac{78}{65} = -\dfrac{6}{5}$.

  The solution is
  \[
    q(t) = -\frac{6}{5}\,e^{-t} + \frac{90}{65}\,e^{-3t} - \frac{12}{65}\cos(2t) + \frac{96}{65}\sin(2t).
  \]
  The exponential terms (transient response) decay, leaving the steady-state sinusoidal response:
  \[
    q_{\text{ss}}(t) = -\frac{12}{65}\cos(2t) + \frac{96}{65}\sin(2t)
                     = \frac{12}{65}\sqrt{1 + 64}\,\cos(2t - \delta)
                     = \frac{12\sqrt{65}}{65}\cos(2t - \delta),
  \]
  where $\delta = \arctan(-8) \approx -1.446\,\text{rad}$.
\end{workedexample}

\subsection{Summary}
\label{sec:ch06_summary}

\begin{table}[htbp]
\centering
\caption{Damping cases for $m\,u'' + c\,u' + k\,u = 0$}
\label{tab:ch06_damping_summary}
\begin{tabular}{l l l l}
  \toprule
  \textbf{Case} & \textbf{Condition} & \textbf{Solution} & \textbf{Behavior} \\
  \midrule
  Underdamped & $c^2 < 4mk$ ($\zeta < 1$) & $e^{-ct/(2m)}[c_1\cos(\omega_d t) + c_2\sin(\omega_d t)]$ & Oscillatory decay \\
  Critically damped & $c^2 = 4mk$ ($\zeta = 1$) & $(c_1 + c_2 t)e^{-ct/(2m)}$ & Fastest non-oscillatory return \\
  Overdamped & $c^2 > 4mk$ ($\zeta > 1$) & $c_1 e^{r_1 t} + c_2 e^{r_2 t}$ & Slow non-oscillatory decay \\
  \bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Forced vibrations and resonance}
\label{tab:ch06_forced_summary}
\begin{tabular}{l p{8cm}}
  \toprule
  \textbf{Concept} & \textbf{Key formula} \\
  \midrule
  Natural frequency & $\omega_0 = \sqrt{k/m}$ \\
  Critical damping & $c_{\text{cr}} = 2\sqrt{mk} = 2m\omega_0$ \\
  Damping ratio & $\zeta = c/c_{\text{cr}} = c/(2\sqrt{mk})$ \\
  Damped frequency & $\omega_d = \sqrt{\omega_0^2 - (c/(2m))^2}$ \\
  Steady-state amplitude & $C = \dfrac{F_0}{\sqrt{(k - m\omega^2)^2 + (c\omega)^2}}$ \\
  Steady-state phase & $\delta = \arctan\!\left(\dfrac{c\omega}{k - m\omega^2}\right)$ \\
  Pure resonance ($c = 0$) & $u_p(t) = \dfrac{F_0}{2m\omega_0}\,t\,\sin(\omega_0 t)$ when $\omega = \omega_0$ \\
  Practical resonance frequency & $\omega_{\text{pr}} = \sqrt{\omega_0^2 - \dfrac{c^2}{2m^2}}$ (exists when $c^2 < 2mk$) \\
  Beats frequency & $f_{\text{beat}} = \dfrac{|\omega_0 - \omega|}{2\pi}$ (angular: $|\omega_0 - \omega|/2$) \\
  \bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Mechanical--electrical analogy}
\label{tab:ch06_mech_elec}
\begin{tabular}{l l}
  \toprule
  \textbf{Mechanical:} $m\,u'' + c\,u' + k\,u = F(t)$ & \textbf{Electrical:} $L\,q'' + R\,q' + \frac{1}{C}\,q = E(t)$ \\
  \midrule
  $m \leftrightarrow L$ & Mass $\leftrightarrow$ Inductance \\
  $c \leftrightarrow R$ & Damping $\leftrightarrow$ Resistance \\
  $k \leftrightarrow 1/C$ & Spring constant $\leftrightarrow$ Inverse capacitance \\
  $u \leftrightarrow q$ & Displacement $\leftrightarrow$ Charge \\
  $u' \leftrightarrow q' = i$ & Velocity $\leftrightarrow$ Current \\
  $F(t) \leftrightarrow E(t)$ & Force $\leftrightarrow$ Voltage \\
  \bottomrule
\end{tabular}
\end{table}

\begin{hintbox}
  \textbf{Problem-solving workflow for mechanical/electrical applications.}
  \begin{enumerate}
    \item \textbf{Model the system:} Draw a diagram, identify all forces (or voltage drops), and write the governing ODE.
    \item \textbf{Classify the system:} Compute the discriminant or damping ratio to determine whether it is underdamped, critically damped, or overdamped.
    \item \textbf{Solve the ODE:} Apply the methods from \cref{ch:second_order_homogeneous,ch:second_order_nonhomogeneous}.
    \item \textbf{Interpret the solution:} Relate the mathematical result back to the physical behavior (oscillation, decay, resonance, etc.).
    \item \textbf{Apply initial conditions:} Use given initial displacements/charges and velocities/currents to determine constants.
  \end{enumerate}
\end{hintbox}
