Doubt with Relativistic Lagrangian Expression I'm trying to learn by myself some Lagrangian mechanics, and I found on Wikipedia this relativistic Lagrangian
$$L=\frac{1}{2}mu_{\alpha}u^{\alpha}, \tag{1}$$
where $$u^\alpha=\frac{dx^{\alpha}}{d\tau}\tag{2}$$ is the four-velocity and I don't know if $m>0$ is the rest or relativistic mass. And here is my problem. I used these Euler-Lagrange equations 
$$\frac{\partial L}{\partial x^{\beta}}-\frac{{\rm d}}{{\rm d}\tau}\left(\frac{\partial L}{\partial u^{\beta}}\right)=0, \tag{3}$$
which are in the article and I finish with this
$$\frac{{\rm d}}{{\rm d}\tau}\left(mu_{\beta}\right)=0.\tag{4}$$
What I think it's the conservation of four-momentum, if $m$ is the rest mass. Right? But a trouble came when I calculated the energy with this formula
$$E=\frac{\partial L}{\partial \dot{r}}\cdot\dot{r}-L\tag{5}$$
with $r$ the position vector. I did this, I don't know if it's correct
$$E=\frac{\partial L}{\partial u^{\beta}}u^{\beta}-L\tag{6}$$
$$E=mu_{\beta}u^{\beta}-\frac{1}{2}mu_{\alpha}u^{\alpha}\tag{7}$$
Now because $$u_{\beta}u^{\beta}=c^{2}\tag{8}$$ I get
$$E=mc^{2}-\frac{1}{2}mc^{2}=\frac{1}{2}mc^{2}.\tag{9}$$
This is not the relativistic energy of the particle of course, there is a missed gamma factor which can appear if $m$ is the relativistic mass. But it isn't still the energy because of the $\frac{1}{2}$ and confuse me of what is $m$.
Is something there correct? What am I doing wrong?
 A: For your second question, observe that your Hamiltonian is in fact
$$\mathcal{H}=\frac{p_{\alpha}p^{\alpha}}{2m}$$
because $\mathcal{H}=\mathcal{H}\left(x^{\alpha},p_{\alpha}\right)$ so you are not allowed to use $u_{\alpha}$. Lets test it by trying to set up Hamilton's equations
$$\begin{cases}\frac{{\rm d}p_{\alpha}}{{\rm d}\tau}=-\frac{\partial\mathcal{H}}{\partial x^{\alpha}}=0\\\frac{{\rm d}x^{\alpha}}{{\rm d}\tau}=\frac{\partial\mathcal{H}}{\partial p_{\alpha}}=\frac{p^{\alpha}}{m}\end{cases}$$
That's exactly identical to your equation using Lagrangian mechanics, so it seems like you've constructed the right Hamiltonian. Keep in mind that the Hamiltonian is not the total energy, it just happens to be so in some cases. The key point here is that you can't put $p_{\alpha}p^{\alpha}=m^{2}c^{2}$, because of the same reasons you didn't put $u_{\alpha}u^{\alpha}=c^{2}$ in the Lagrangian ending up with
$$\mathcal{L}=\frac{1}{2}mc^{2}$$
The fact that both $\mathcal{L}$ and $\mathcal{H}$ are constants if you substitute the intervals means that they are constants over trajectories.
EDIT 1: If you want your Hamiltonian to be the total energy, you should write your Lagrangian as
$$\mathcal{L}^{\prime}=-\frac{mc^{2}}{\gamma}=-mc^{2}\sqrt{1-\frac{v^{2}}{c^{2}}}$$
and use $t$ instead of $\tau$ to get
$$\boldsymbol{p}=\frac{\partial\mathcal{L}^{\prime}}{\partial\boldsymbol{v}}=\frac{m\boldsymbol{v}}{\sqrt{1-\frac{v^{2}}{c^{2}}}}$$
and so
$$\mathcal{H}^{\prime}=\frac{\partial\mathcal{L}^{\prime}}{\partial\boldsymbol{v}}\cdot\boldsymbol{v}-\mathcal{L}^{\prime}=\frac{mv^{2}}{\sqrt{1-\frac{v^{2}}{c^{2}}}}+mc^{2}\sqrt{1-\frac{v^{2}}{c^{2}}}=$$
$$=\frac{mc^{2}}{\sqrt{1-\frac{v^{2}}{c^{2}}}}=\gamma mc^{2}$$
EDIT 2: To get the Lagrangian $\mathcal{L}^{\prime}=-\frac{mc^{2}}{\gamma}$ from yours, you should look at the action
$$S\left[u_{\alpha}\right]=\int\mathcal{L}{\rm d}\tau$$
Our goal is to change variables to $\boldsymbol{x},\boldsymbol{v},t$ instead of $x^{\alpha},u_{\alpha},\tau$. Using $\frac{{\rm d}\tau}{{\rm d}t}=\frac{1}{\gamma}$ this gives 
$$S\left[\boldsymbol{x}\right]=\int\mathcal{L}\frac{{\rm d}\tau}{{\rm d}t}{\rm d}t=\int\frac{mc^{2}}{2\gamma}{\rm d}t$$
so we get our new Lagrangian to be
$$\mathcal{L}^{\prime\prime}=\frac{mc^{2}}{2\gamma}=-\frac{1}{2}\mathcal{L}^{\prime}$$
This is identical to $\mathcal{L}^{\prime}$ up to a constant, so the physics of $\mathcal{L}^{\prime}$ and $\mathcal{L}^{\prime\prime}$ is the same.
A: *

*OP's Lagrangian (1) is$^1$
$$\begin{align}L~=~&\frac{m\dot{x}^2}{2}-\frac{mc^2}{2}, \cr \dot{x}^2~:=~&g_{\mu\nu}(x)~ \dot{x}^{\mu}\dot{x}^{\nu}~<~0,  \cr \dot{x}^{\mu}~:=~& \frac{dx^{\mu}}{d\tau},\end{align}\tag{A} $$
(up to a constant term $-\frac{mc^2}{2}$, which won't change the EL eqs.). Here $m$ is the rest/invariant mass. The Lagrangian (A) is equal to the following Lagrangian
$$L~=~\frac{\dot{x}^2}{2e}-\frac{e(mc)^2}{2} \tag{B} $$
in the gauge
$$ e~=~\frac{1}{m}, \tag{C}$$
cf. e.g. this Phys.SE post. Here $e=e(\tau)$ is an einbein field, and $\tau$ is a world-line parameter (not necessarily proper time).


*The Hamiltonian that corresponds to the Lagrangian (B) is
$$\begin{align} H~=~& \frac{e}{2}(p^2+(mc)^2), \cr p^2~:=~&g^{\mu\nu}(x)~ p_{\mu}p_{\nu}~<~0, \cr p_{\mu}~=~& \frac{1}{e}g_{\mu\nu}(x)~\dot{x}^{\nu}, \end{align}\tag{D} $$
cf. e.g. this Phys.SE post. In the gauge (C), the Hamiltonian (D) becomes
$$\begin{align} H~=~& \frac{1}{2m}(p^2+(mc)^2)~=~\frac{p^2}{2m}+\frac{mc^2}{2}, \cr p_{\mu}~=~& mg_{\mu\nu}(x)~\dot{x}^{\nu},\end{align} \tag{E} $$
which is related to OP's eq. (7) up to before mentioned constant term $\frac{mc^2}{2}$.
For the Hamiltonian formulation in various gauges, see e.g. this Phys.SE post.
--
$^1$ We use the Minkowski sign convention $(−,+,+,+)$.
