In the Hamilton-Jacobi equation, we take the partial time derivative of the action. But the action comes from integrating the Lagrangian over time, so time seems to just be a dummy variable here and hence I do not understand how we can partial differentiate $S$ with respect to time? A simple example would also be helpful.
3 Answers
I) At least three different quantities in physics are customary called an action and denoted with the letter $S$.
The (off-shell) action $$S[q]~:=~ \int_{t_i}^{t_f}\! \mathrm{d}t \ L(q(t),\dot{q}(t),t) \tag{1}\label{eq:1}$$ is a functional of the full position curve/path $q^i:[t_i,t_f] \to \mathbb{R}$ for all times $t$ in the interval $[t_i,t_f]$. See also this question. (Here, the words on-shell and off-shell refer to whether the equations of motion (eom) are satisfied or not.)
If the variational problem $\eqref{eq:1}$ with well-posed boundary conditions, e.g. Dirichlet boundary conditions $$ q(t_i)~=~q_i\quad\text{and}\quad q(t_f)~=~q_i,\tag{2}\label{eq:2}$$ has a unique extremal/classical path $q_{\rm cl}^i:[t_i,t_f] \to \mathbb{R}$, it makes sense to define an on-shell action $$ S(q_f;t_f;q_i,t_i) ~:=~ S[q_{\rm cl}], \tag{3}\label{eq:3} $$ which is a function of the boundary values. See, e.g. MTW Section 21.1.
The Hamilton's principal function $S(q,\alpha, t)$ in Hamilton-Jacobi equation is a function of the position coordinates $q^i$, integration constants $\alpha_i$, and time $t$, see e.g. H. Goldstein, Classical Mechanics, chapter 10. The total time derivative $$ \frac{\mathrm{d}S}{\mathrm{d}t}~=~ \dot{q}^i \frac{\partial S}{\partial q^i}+ \frac{\partial S}{\partial t}\tag{4}$$ is equal to the Lagrangian $L$ on-shell, as explained here. As a consequence, the Hamilton's principal function $S(q,\alpha, t)$ can be interpreted as an action on-shell.
II) Example: A non-relativistic free particle in 1 dimension.
The off-shell action is $$ S[q]~=~ \frac{m}{2}\int_{t_i}^{t_f}\! \mathrm{d}t \ \dot{q}(t)^2.\tag{5} $$
If we assume Dirichlet boundary conditions $\eqref{eq:2}$, the unique classical trajectory $q_{\rm cl}$ has constant velocity $$\dot{q}_{\rm cl}~=~\frac{q_f-q_i}{t_f-t_i}.\tag{6}\label{eq:6}$$ The Dirichlet on-shell action $\eqref{eq:3}$ is $$ S(q_f,t_f;q_i,t_i) ~=~ \frac{m}{2} \cdot \frac{(q_f-q_i)^2}{t_f-t_i}. \tag{7}\label{eq:7} $$
The Hamilton's principal function, i.e. a solution to Hamilton-Jacobi equation, is $$ S(q,E,t)~=~\pm\sqrt{2m E} q - Et,\tag{8}\label{eq:8} $$ where $E$ is an integration constant (= the total energy). Due to the interpretation of Hamilton's principal function as a type 2 generator of canonical transformations, the partial derivative $$Q~:=~ \frac{\partial S}{ \partial E}~\stackrel{\eqref{eq:8}}{=}~\pm\sqrt{\frac{m}{2E}}q -t \tag{9}$$ must be a constant of motion. In other words, the position $q(t)$ is, as expected, an affine function of time $t$. This implies that the velocity is constant $$ \dot{q} ~\approx~\pm\sqrt{\frac{2E}{m}}, \tag{10}\label{eq:10}$$ where the "$\approx$" symbol means equality modulo eom. The total time derivative of the Hamilton's principal function $\eqref{eq:8}$ is equal to the Lagrangian (= the kinetic energy) on-shell $$ \frac{\mathrm{d}S}{\mathrm{d}t}~\stackrel{\eqref{eq:8}}{=}~ \pm\sqrt{2m E} \dot{q} -E ~\stackrel{\eqref{eq:10}}{\approx}~E.\tag{11}$$
Let us now compare points 2 and 3. With the Dirichlet boundary conditions $\eqref{eq:2}$, the energy becomes $$ E~=~ \frac{m}{2} \cdot \left(\frac{q_f-q_i}{t_f-t_i}\right)^2. \tag{12}\label{eq:12}$$ A comparison of eqs. $\eqref{eq:6}$ and $\eqref{eq:10}$ shows that we should use the plus (minus) branch of the solution $\eqref{eq:8}$ if $q_f\geq q_i$ ($q_f\leq q_i$), respectively. It is straightforward to check that the difference in the Hamilton's principal function becomes the on-shell action $\eqref{eq:7}$, $$ \begin{align} S(q_f,E,t_f)~-~& S(q_i,E,t_i)\cr ~\stackrel{\eqref{eq:8}+\eqref{eq:12}}{=}&~\frac{m}{2} \cdot \frac{(q_f-q_i)^2}{t_f-t_i}\cr ~\stackrel{\eqref{eq:7}}{=}~~& S(q_f,t_f;q_i,t_i).\end{align}\tag{13} $$
The action functional and Hamilton's principal function are two different mathematical objects related to the same physical quantity.
The action along a trajectory $\gamma:[t_1,t_2]\rightarrow Q$ is given by $$ S[\gamma] = \int_{t_1}^{t_2}L(\gamma(t'),\dot\gamma(t'),t')dt' $$ whereas the principal function is the solution of the Hamilton-Jacobi equation $$ H(q,\nabla S(q,t),t) + \frac{\partial S}{\partial t}(q,t) = 0 $$
If you denote by $\gamma_{q,t}$ the solution of the Euler-Lagrange equations with $$ \gamma_{q,t}(t_0)=q_0\\ \gamma_{q,t}(t)=q $$ then $$ S(q,t):=S[\gamma_{q,t}]=\int_{t_0}^{t}L(\gamma_{q,t}(t'),\dot\gamma_{q,t}(t'),t')dt' $$ will solve the Hamilton-Jacobi equation.
On the flip side, for the principal function we have the following $$ \frac{d}{dt}S(\gamma(t),t)=L(\gamma(t),\dot\gamma(t),t) $$ and thus $$ S[\gamma]=S(\gamma(t_2),t_2)-S(\gamma(t_1),t_1) $$
Note that the last two equations only hold for trajectories with $$ \frac{\partial L}{\partial\dot q}(\gamma(t),\dot\gamma(t),t) = \nabla S(\gamma(t),t) $$
Geometrically, the choice of integration constants of the principal function selects a leaf of a foliation of phase space, which corresponds to the choice of initial condition $\gamma_q(t_0)=q_0$ from above.
I think the other two answers are overkill. The simpler answer is that time $t$ is not a dummy variable. The integration of $L$ over time here is an indefinite integration, so if we have $L(q,\dot{q},t)$, and we want to integrate it over time $t$, the result is $$\int_{t_i}^tL(q,\dot{q},\tau)d\tau$$ here $\tau$ is the dummy variable but $t$ is not, and the result is a function of $t$.
-
1$\begingroup$ I always thought of it this way.Variation of the above immediately gives the Hamilton-Jacobi equations. $\endgroup$– TakodaCommented Jan 21, 2021 at 15:39