Help understanding what the Hamiltonian signifies for the action compared with the Euler-Lagrange equations for the Lagrangian? Consider the Lagrangian for a simple harmonic oscillator
\begin{equation}
L (x,\dot{x}) = \frac{1}{2}m\dot{x}^2 - \frac{1}{2}kx^2
\end{equation} 
Obviously we have 
\begin{align}
\frac{\partial L}{\partial x} & = -kx\\ 
\frac{\partial L}{\partial \dot{x}} & = m\dot{x}\\
\frac{d}{dt} \left(\frac{\partial L}{\partial \dot{x}}\right) & = m\ddot{x}
\end{align}
So this satisfies the Euler-Lagrange in that we know a $F = ma$ and therefore the force of a spring should follow this law as well, giving us
\begin{align}
\frac{d}{dt} \left(\frac{\partial L}{\partial \dot{x}}\right) -\frac{\partial L}{\partial x}  & =0 \\
m\ddot{x} + kx &= 0
\end{align}
Now let's do the Hamiltonian version. Here's where I'm having a problem. We obtain the Hamiltonian via the Legendre transformation and get
\begin{equation}
H(x,p) = \frac{1}{2}\frac{p^2}{m} + \frac{1}{2}kx^2
\end{equation}
Now, according to what I understand, the equations of motion should be
\begin{align}
-\frac{\partial H}{\partial x} & = -kx = \dot{p}\\ 
\frac{\partial H}{\partial p} & = \frac{p}{m} = \dot{x}
\end{align}
But I don't see what this tells me about the relationship between Newton's law and Hooke's law. For the Lagrangian, when I plug in the relevant information, I get a relationship that explicitly shows for the action
\begin{equation}
S[x] = \int_a^bL(t,x,\dot{x})dt
\end{equation}
that it satisfies the EL equation as a necessary condition for $S[x]$ to have an extremum for the given function $x(t)$.

My Question: 
How do Hamilton's equations do this? When I look at the "equations of motion" for the Hamiltonian, I don't see how they tell me anything about the action. But they should! That's what their purpose is, just like their Lagrangian analogs do. 

The only way I see to do it is to do something like 
\begin{align}
\frac{d}{dt}\left(m\frac{\partial H}{\partial p}\right) & = m\frac{d}{dt}\dot{x}\\
&=m\ddot{x}\\
\end{align}
and then organize them something like 
\begin{align}
\frac{d}{dt} \left(m\frac{\partial H}{\partial p}\right) + \frac{\partial H}{\partial x} & =0 \\
m\ddot{x} + kx &= 0
\end{align}
But I've never seen anyone do this in the introductory books, so I feel like I must be misunderstanding what the Hamiltonian signifies relative to the action. 
 A: I know I'm late to the party, but let me show that Lagrangian and Hamiltonian mechanics are compatible by direct substitution of the Lagrangian into Hamilton's equations. 
The Hamiltonian is, in terms of the Lagrangian, 
$$H(p,q)=p\dot q(p,q)-L(q,\dot q(p,q))$$
Now we take the first Hamilton equation and plug in
$$\dot q=\frac{\partial H}{\partial p}=\dot q+p\frac{\partial\dot q}{\partial p}-\frac{\partial L}{\partial\dot q}\frac{\partial \dot q}{\partial p}$$
Which implies 
$$p=\frac{\partial L}{\partial \dot q}$$
Now we take the second Hamiltonian equation and plug in
$$-\dot p=\frac{\partial H}{\partial q}=p\frac{\partial \dot q}{\partial q}-\frac{\partial L}{\partial q}-\frac{\partial L}{\partial\dot q}\frac{\partial \dot q}{\partial q}$$
Using the first Hamiltonian equation, we see that the last term cancels the first one. We then get
$$\dot p=\frac{\partial L}{\partial q}$$
We can then combine the two equations and obtain
$$\frac{\partial L}{\partial q}-\frac{d}{dt}\frac{\partial L}{\partial \dot q}=0$$
which is just the Euler-Lagrange equation.
Thus Hamiltonian and Lagrangian mechanics are equivalent.
A: OP asks in the title (v1) for help understanding what the Hamiltonian signifies for the action compared with the Euler-Lagrange equations for the Lagrangian.
It seems relevant in this context to point out that there is an action principle for both the Lagrangian and Hamiltonian formalism.


*

*On one hand, the stationary action principle for the Lagrangian action 
$$\tag{L1} S[q]~:=~\int \! dt ~ L(q,\dot{q},t)$$
in the Lagrangian formalism leads to Lagrange's equations of motion (eom)$^1$
$$\tag{L2}  \frac{d}{dt}\frac{\partial L}{\partial \dot{q}^i} ~\approx~ \frac{\partial L}{\partial q^i}. $$

*On the other hand, the stationary action principle for the Hamiltonian action
$$ S_H[q,p] ~:=~ \int \! dt ~ L_H(q,\dot{q},p,t), $$
$$ \tag{H1} L_H(q,\dot{q},p,t) ~:=~ p_i \dot{q}^i - H(q,p,t), $$
in the Hamiltonian formalism leads to Hamilton's eom
$$\tag{H2}  \dot{q}^i ~\approx~ \frac{\partial H}{\partial p_i}, \qquad -\dot{p}_i ~\approx~ \frac{\partial H}{\partial q^i}. $$
--
$^1$ Here the $\approx$  symbol means equality modulo eom.
A: Beginning with
$\begin{align}
-\frac{\partial H}{\partial x} & = -kx = \dot{p}\\ 
\frac{\partial H}{\partial p} & = \frac{p}{m} = \dot{x}
\end{align}$
One takes the time derivative of both sides of the second equation 
$\frac{d}{dt}(\frac{p}{m}) = \frac{d}{dt}\dot{x}$
giving 
$\frac{\dot{p}}{m} = \ddot{x}$
Substituting from Hamilton's first equation
$\frac{-kx}{m} = \ddot{x}$
giving finally 
$-kx = m\ddot{x}$ 
A: Observe that from the second equation you get $p=m\dot x$, so that substituting into the first gives you $-kx=m\ddot x$.
