Hamiltonian from Lagrangian defined as an integral I need to derive the Hamiltonian from the Lagrangian defined in the following way:
$$L[x, \dot{x}] = \int_{t_0}^{t_1} f(x(t), t) \sqrt{1 + \dot{x}^2} \mathrm{d}t.\tag{1}$$
The usual method is to compute the momentum $p$:
$$p = \frac{\partial L}{\partial \dot{x}} = \int_{t_0}^{t_1} f(x(t), t) \frac{\dot{x}}{\sqrt{1 + \dot{x}^2}} \mathrm{d}t,\tag{2}$$
invert the relation and write $\dot{x} = \dot{x}(x, p)$ and then compute the Hamiltonian:
$$H(x, p) = \dot{x}(x, p) p - L[x, \dot{x}(x, p)].\tag{3}$$
But in this case it is not possible to simply get the formula for $\dot{x}$. It is still possible to get the Hamiltonian?
 A: The $L(x,\dot{x},t)$ that you've written is actually the action $S[x(t)]$, the Lagrangian is the integrand. In other words
$$L=f(x,t)\sqrt{1+\dot{x}^2}$$
and so the conjugate momentum to $x$ is given by
$$p=f(x,t)\frac{\dot{x}}{\sqrt{1+\dot{x}^2}}$$
thus
$$\dot{x}=\pm\frac{p}{\sqrt{f(x,t)^2-p^2}}$$
and finally
$$H=\frac{\pm~ p^2 -f(x,t)^2}{\sqrt{f(x,t)^2-p^2}}$$
I'm not really sure which sign we're supposed to pick but if we pick the plus sign this simplifies nicely to
$$H=-\sqrt{f(x,t)^2-p^2}$$
A: In this answer, we take OP's integral (1) literal. There are 2 possibilities:

*

*If $\dot{x}$ is supposed to be the time derivative of $x$, then it does not make sense to list $\dot{x}$ as an independent argument of the action functional (1) [which we will call $S$], cf. e.g. this & this Phys.SE posts. It also renders OP's further manipulations meaningless.


*If $\dot{x}$ is supposed to be an independent variable [which we will call $v$], then it does make sense to define
$$p(t)~:=~\frac{\delta S[x,v]}{\delta v(t)}\tag{A}$$
as a functional derivative, and define a functional Legendre transformation/Hamiltonian functional via
$$\mathbb{H}[x,p]~:=~\sup_{v}\left( \int_{t_i}^{t_f}\! dt~ p(t) v(t) -  S[x,v] \right),\tag{B} $$
cf. e.g. this Phys.SE post.
It is straightforward to calculate eqs. (A) & (B) for OP's local functional (1). Eqs. (A) & (B) even make sense if $S[x,v]$ is a non-local functional.
