\chapter{Advanced Analytical Mechanics} Newtonian mechanics, Lagrangian mechanics, and Hamiltonian mechanics each reformulate the same physics in progressively more abstract language. Newton\normalsize{}'s laws write second-order differential equations for particle positions. The Lagrangian principle of least action recasts this as a variational problem, automatically accommodating constraints and generalized coordinates. Hamilton\normalsize{}'s canonical equations split the second-order problem into $2n$ coupled first-order equations on phase space, revealing the underlying symplectic structure of mechanics. Each of these formulations is fundamentally \textbf{trajectory-based}: you solve for a particle\normalsize{}'s specific path through space and time. The Hamilton--Jacobi framework changes the question entirely. Instead of solving for a single trajectory, it asks: \textit{what is the global structure of all possible trajectories?} The answer is encoded in a single scalar function $S(q_1,\dots,q_n,t)$, called Hamilton\normalsize{}'s principal function, whose spatial gradient equals the canonical momentum: \[ p_i = \frac{\partial S}{\partial q_i}. \] This relation elevates momentum from a dynamical variable to a property of a \textbf{field} defined over configuration space. Solving mechanics becomes a matter of finding the field $S$ that satisfies the Hamilton--Jacobi equation, a single first-order nonlinear partial differential equation. The Hamilton--Jacobi formulation is the most abstract of the four classical frameworks, but that abstraction is precisely what makes it useful: by shifting from trajectories to fields, it exposes structure that is invisible at the level of individual paths. The field perspective of the Hamilton--Jacobi formalism is not an accident. It reflects a deep analogy with geometric optics, first noticed by Maupertuis and made explicit by Hamilton himself. In geometrical optics, light propagates as rays, each orthogonal to surfaces of constant phase called \textbf{wavefronts}. The wavefronts are level sets of a scalar function called the \textbf{eikonal}, and the local direction of each ray is determined by the gradient of the eikonal. Hamilton recognized that mechanics has the exact same structure. Particle trajectories play the role of light rays, surfaces of constant action $S$ play the role of optical wavefronts, and the gradient relation $p_i = \partial S/\partial q_i$ mirrors the optical relation between wavefront normals and ray directions. In this view, the Hamilton--Jacobi equation is the mechanical analog of the \textbf{eikonal equation} of optics: \[ \left|\nabla S\right|^2 = 2m\bigl(E - V(\vec{r})\bigr). \] Just as light rays bend when the refractive index changes, particle trajectories curve when the potential energy varies in space. The analogy runs even deeper: in both cases, the dynamics of rays is completely determined by the level-geometry of a single scalar field. This analogy is not merely poetic. It makes concrete the three most powerful features of the Hamilton--Jacobi approach. \textbf{First}, separation of variables for the Hamilton--Jacobi PDE reveals conserved quantities that are often obscured in the Newtonian or even Hamiltonian formulation. When the equation separates in a particular coordinate system, each additive separation constant corresponds to a constant of motion, and the choice of coordinates that enables separation is itself a signature of the system\normalsize{}'s hidden symmetry. Spherical coordinates separate for central potentials; parabolic coordinates separate for the Kepler problem and expose the Runge--Lenz vector\normalsize{}'s associated conservation law. \textbf{Second}, for periodic or bound systems, the \textbf{action-angle variables} $(J,w)$ provide a direct route to the system\normalsize{}'s frequencies without solving any differential equation. The action variable \[ J = \frac{1}{2\pi} \oint p \, \mathrm{d}q \] is the area enclosed by the orbit in phase space, divided by $2\pi$. The frequency follows immediately as a partial derivative of the Hamiltonian with respect to the action: \[ \omega = \frac{\partial H}{\partial J}. \] The angle variable $w$ advances uniformly in time, acting as a clock that tracks the system\normalsize{}'s progress through one period. Systems with commensurate frequencies close their trajectories, while incommensurate frequencies fill out invariant tori in phase space --- the geometric origin of resonant and chaotic behavior. \textbf{Third}, the Hamilton--Jacobi equation is the classical limit of quantum mechanics. In the Wentzel--Kramers--Brillouin (WKB) approximation, the quantum wave function is written as \[ \psi(\vec{r},t) = A(\vec{r},t)\, \mathrm{e}^{iS(\vec{r},t)/\hbar}. \] Substituting this ansatz into the Schrödinger equation and collecting the leading order in $\hbar \to 0$ reproduces the Hamilton--Jacobi equation exactly. The older Bohr--Sommerfeld quantization rule, \[ J = n h \qquad (n = 0,1,2,\dots), \] was the first successful attempt to quantize classical action, emerging naturally from the action-angle formalism nearly a decade before the modern theory of quantum mechanics. The Hamilton--Jacobi framework is the conceptual bridge that connects the orbit picture of classical physics to the wave picture of quantum physics. Everything in this chapter rests on the mechanics and electromagnetism you already know. The mechanics problems --- free particle, projectile motion, the simple harmonic oscillator, the Kepler two-body problem, and the rigid rotator --- draw on your work with kinematics, energy conservation, momentum, rotation, and central forces from the earlier mechanics units. The electromagnetism problems --- charged particles in uniform electric fields, cyclotron motion in magnetic fields, and $\vec{E} \times \vec{B}$ drift --- build on your treatment of Lorentz forces, equipotentials, and magnetic particle motion. The Hamilton--Jacobi formalism unifies all of these results under one method. For problems you have already solved by elementary means, it provides a deeper structural understanding. For problems that resist elementary approaches, it supplies a systematic technique grounded in the same variational principles you used to derive Lagrange\normalsize{}'s equations. This chapter is organized in three parts. Section 3.1 develops the HJ equation from Hamiltonian mechanics and introduces separation of variables, action-angle variables, and electromagnetic minimal coupling. Section 3.2 applies the HJ formalism to classical mechanics problems: the free particle, projectile motion, the simple harmonic oscillator, the Kepler (two-body) problem, and the rigid rotator on a sphere. Section 3.3 treats problems from electromagnetism, including charged particles in uniform $\vec{E}$-fields, cyclotron motion, and $\vec{E}\times\vec{B}$ drift, showing that the HJ approach recovers all standard results with a unified method. \section{Hamilton-Jacobi Fundamentals} \input{concepts/advanced/hj-equation} \input{concepts/advanced/separation} \input{concepts/advanced/action-angle} \input{concepts/advanced/hj-em-coupling} \section{Mechanics Problems via HJ} \input{concepts/advanced/free-particle-hj} \input{concepts/advanced/projectile-hj} \input{concepts/advanced/sho-hj} \input{concepts/advanced/kepler-hj} \input{concepts/advanced/rigid-rotator-hj} \section{Electromagnetism Problems via HJ} \input{concepts/advanced/uniform-e-field-hj} \input{concepts/advanced/cyclotron-hj} \input{concepts/advanced/crossed-fields-hj} \input{concepts/advanced/kepler-coulomb-hj}