Why is the Hamiltonian zero in relativity? I'm trying to understand something with the lagrangian and the hamiltonian formalisms in relativity theory, and why the following result cannot be the same in classical (non-relativistic) mechanics.  There's something missing or badly defined in my reasoning, and I don't see what yet.
Consider a system of "particles", of generalized coordinates $q^i(t)$ in some reference frame.  The action of the system is defined as the following integral :
\begin{equation}\tag{1}
S = \int_{t_1}^{t_2} L(q^i, \dot{q}^i) \, dt.
\end{equation}
The hamiltonian of the system is defined as this (summation is implied on the repeated indices) :
\begin{equation}\tag{2}
H = \dot{q}^i \, \frac{\partial L}{\partial \dot{q}^i} - L.
\end{equation}
Now consider a change of parametrization in integral (1) ; $dt = \theta \, ds$, where $s$ is a new integration variable and $\theta(s)$ is an arbitrary function that could be considered as a new dynamical variable (there's something missing in my interpretation, and I need to find what is "wrong" here).  The action is now this (the prime is the derivative with respect to $s$.  Notice the change of limits, on this integral) :
\begin{equation}\tag{3}
S = \int_{s_1}^{s_2} L(q^i, \frac{q^{i \, \prime}}{\theta}) \; \theta \; ds.
\end{equation}
So the new lagrangian is
\begin{equation}\tag{4}
\tilde{L} = L(q^i, \frac{q^{i \, \prime}}{\theta}) \; \theta.
\end{equation}
Now, if $\theta$ is considered as a dynamical variable, we can apply the Euler-Lagrange to this new lagrangian:
\begin{equation}\tag{5}
\frac{d}{d s} \Big( \frac{\partial \tilde{L}}{\partial \, \theta^{\, \prime}} \Big) - \frac{\partial \tilde{L}}{\partial \, \theta} = 0.
\end{equation}
Since there is no $\theta^{\, \prime}$ in $\tilde{L}$, the first part is 0.  After some simple algebra, the second part implies that the hamiltonian (2) should be 0 !
\begin{equation}\tag{6}
H \equiv 0.
\end{equation}
So my questions are these:

  
*
  
*Is there something wrong in the previous reasoning?  Or what implicit assumptions am I missing?  Where is relativity in this?
  
*If the reasoning is valid, why can't we apply the result to any classical lagrangian, which would give non-sense?

Of course, I know that the hamiltonian of free relativistic particles isn't 0!  But I also know that $H = 0$ is a well known property of systems which have an action with parametrization independence.  I'm missing some parts related to this constraint and I don't see what yet.  I need help to disentangle this subject.
 A: *

*The correct argument for how reparametrization invariance implies vanishing Hamiltonian is as follows: Given a generic Hamiltonian action
$$ S = \int \left(\dot{q}^i p_i - u^\alpha \chi_\alpha - H\right)\mathrm{d}t,$$
where $q,p$ are the canonical phase space variables, $\chi_\alpha$ are Hamiltonian constraints with Lagrange multipliers $u^\alpha$ and $H(q,p)$ is the actual Hamiltonian on non-extended phase space, the action being time-reparametrization invariant forces the Hamiltonian to be zero only if the $q,p$ transform as scalars under the time-reparametrization $t\mapsto \tau(t)$ (since then $\dot{q}^i p_i \mapsto \frac{\mathrm{d}\tau}{\mathrm{d}t} q'^i p_i$ (the prime $'$ denotes the derivative w.r.t. $\tau$)) and if the constraint terms $u^\alpha\chi_\alpha$ also transform as scalar densities $u^\alpha \chi_\alpha \mapsto \frac{\mathrm{d}\tau}{\mathrm{d}t} u^\alpha \chi_\alpha$. Under these assumptions, $H=0$ follows because if $q,p$ are scalars then so is $H(q,p)$, and $H(q,p)$ therefore cannot transform as a scalar density to preserve invariance of the action, and must be zero.


Note that the derivative in $\mathrm{d}t = \frac{\mathrm{d}t}{\mathrm{d}\tau}\mathrm{d}\tau$ (which is called $\theta$ in the question) is not a dynamical variable from the viewpoint of the original system. Your Euler-Lagrange equation does not exist because it is not a function/coordinate on phase space.
Note also that, if $s_1 \neq t_1$ and $s_2\neq t_2$, the transformation $t\mapsto s$ you perform is not what is generally called a time-reparametrization in the context where we talk about reparametrization invariance and vanishing Hamiltonians. It is usually assumed that the start and end of the parameter stay fixed.


*Your new system $\bar{L}$ is not equivalent to the original one: You can, however, define a new Lagrangian system $\bar L(q,q',\theta,{\theta}') := L(q,q'/\theta)\theta$, with an additional variable $\theta$, if you so desire. Let's examine that new system a bit:
The equations of motion for $q$ are
$$ \frac{\mathrm{d}}{\mathrm{d}s}\left(\frac{\partial\bar{L}}{\partial q'}\right) - \frac{\partial\bar{L}}{\partial q} = \frac{\mathrm{d}}{\mathrm{d}s}\left(\frac{\partial(L\theta)}{\partial q'}\right) - \frac{\partial(L\theta)}{\partial q} = \frac{\mathrm{d}}{\mathrm{d}s}\left(\frac{\partial{L}}{\partial q'}\right)\theta + \frac{\partial L}{\partial q'}\theta' - \frac{\partial{L}}{\partial q}\theta = 0\tag{a}$$
and the equation of motion for $\theta$ is
$$ \frac{\partial \bar{L}}{\partial \theta} = \frac{\partial L}{\partial \theta} \theta + L = 0.\tag{b}$$
Here, crucially, $L$ has to be read as the $L(q,q'/\theta)$ it appears as in the $\bar{L}$, so we have 
$$ \frac{\partial L}{\partial q'} = \frac{1}{\theta} \frac{\partial L}{\partial \dot{q}}\quad\text{and}\quad \frac{\partial L}{\partial \theta} = \frac{\partial (q'/\theta)}{\partial \theta}\frac{\partial L}{\partial \dot{q}} = -\frac{q'}{\theta^2}\frac{\partial L}{\partial \dot{q}} \tag{c}$$
in terms of the $\partial L /\partial \dot{q}$ that appears in the original E-L equations. Notably, eq. (b) indeed implies that $\dot{q}\frac{\partial L}{\partial \dot{q}} - L = 0$ but only under the assumption that $q'/\theta = \dot{q}$. However, the moment we promoted $\theta$ to a dynamical variable, we lost that relation - the object $\dot{q}$ does not exist in this new world anymore, the $\partial L/\partial \dot{q}$ is a function of $q,q'$ and $\theta$, not one of $q$ and $\dot{q}$. From the viewpoint fo the new system it should be read simply as $\frac{\partial L}{\partial(q'/\theta)}$.
Let us now plug eq. (c) into eq. (a):
$$ \frac{\mathrm{d}}{\mathrm{d}s}\left(\frac{1}{\theta} \frac{\partial L}{\partial \dot{q}}\right)\theta + \frac{1}{\theta} \frac{\partial L}{\partial \dot{q}}\theta' - \frac{\partial{L}}{\partial q}\theta = -\frac{\theta'}{\theta}\frac{\partial L}{\partial \dot{q}} + \frac{\mathrm{d}}{\mathrm{d}s}\left(\frac{\partial{L}}{\partial \dot{q}}\right) + \frac{\theta'}{\theta}\frac{\partial{L}}{\partial \dot{q}}- \frac{\partial{L}}{\partial q}\theta = 0$$
$$ \implies \frac{\mathrm{d}}{\mathrm{d}s}\left(\frac{\partial{L}}{\partial \dot{q}}\right) - \frac{\partial{L}}{\partial q}\theta = \frac{1}{\theta}\frac{\mathrm{d}}{\mathrm{d}s}\left(\frac{\partial{L}}{\partial \dot{q}}\right) - \frac{\partial{L}}{\partial q} = 0\tag{d}$$
If the two Lagrangian systems $L(q,\dot{q})$ and $\bar{L}(q,q',\theta,\theta')$ were equivalent, the equations of motion of $\bar{L}$ should reduce to the equations of motion of $L$ upon use of the equation of motion for $\theta$. But eq. (b) does not make that possible - inserting it into eq. (d) does not lend itself to simplications by which we would obtain the original equations of motion. The relation we actually need would be, once again, $q'/\theta = \dot{q}$.

*Here is the Lagrangian argument for how reparametrization invariance implies vanishing Hamiltonian: If the original action was time-reparameterization invariant, we have that, under an infintesimal reparametrization $\delta t = \theta(t)$ with induced changes
$$\delta q = \dot{q}\theta \quad \delta \dot{q} = \dot{\delta q} = \ddot{q}\theta + \dot{q}\dot{\theta} \quad \theta(t_1) = \theta(t_2) = 0 $$
the change induced in the Lagrangian is zero, i.e.
$$ \delta L = \frac{\partial L}{\partial q}\delta q + \frac{\partial L}{\partial \dot{q}}\delta \dot{q} = 0.$$
But, due to a "trick" to derive the Noether current discussed, for example, in this question, we also know that 
$$ \delta S = \int j \frac{\partial \epsilon}{\partial t},$$
where $j$ is the Noether current associated to the symmetry with constant $\epsilon$, which is just time translation, and indeed a symmetry because we have implicitly assumed that the Lagrangian does not explicitly depend on time. Therefore, $j$ is the Hamiltonian, and reparametrization invariance obviously forces $j=0$.
