# Hamilton Function

### From bio-physics-wiki

We already derived the Hamilton function when we discussed the Invariance of Euler-Lagrange Equations and Conserved Quantities. We have seen, that for time homogeneous systems energy is conserved and equals the Hamiltionian.

Hamilton function \begin{align} H=\sum_i \dot{q_i} \frac{\partial L}{\partial \dot{q}_i} - L=\sum_i \dot{q_i} p_i - L \end{align}

However, if the Lagrangian is time dependent the change in the Lagrangian with time would be
\begin{align}
\frac{d L}{dt}=\sum_i \frac{\partial L}{\partial q_i}\dot{q_i}+\frac{\partial L}{\partial \dot{q}_i}\ddot{q}_i+\frac{\partial L}{\partial t}
\end{align}
The time dependence would give an additional term
\begin{align}
\frac{d L}{dt}=\sum_i\frac{d}{dt} \left( \dot{q_i} \frac{\partial L}{\partial \dot{q}_i} \right)+\frac{\partial L}{\partial t}
\end{align}
so that the result is the time derivative of the **Hamiltonian for a Dissipative System**
\begin{align}
\frac{dH}{dt}=\frac{d}{dt}\sum_i\ \left( \dot{q_i} \frac{\partial L}{\partial \dot{q}_i} -L\right)=-\frac{\partial L}{\partial t}
\end{align}
$L$ is time dependent and the Hamiltonian is not conserved, but rather a function of time.