In the interest of practicing Lagrangian mechanics, I've been trying to use Lagrangian mechanics to solve a set of mechanics problems that usually use Newtonian mechanics to solve. Of particular interest is this problem, with a box of mass $m$ sitting on the ground:
Using Newtonian mechanics, this is trivial:
$$ a(t) = \frac{F}{m} = \text{const.} $$
However, if we try to write out a Lagrangian, we end up with:
$$ \mathcal{L} = \frac{1}{2} m \dot x^2 - U(x) $$
Now since the box is at ground level, conventionally $U(x) = 0$ (if we define the ground level as the reference point to measure potential energy), thus:
$$ \mathcal{L} = \frac{1}{2} m \dot x^2 $$
Using the Euler-Lagrange equations:
$$ \frac{\partial \mathcal{L}}{\partial x} = 0 $$
$$ \frac{d}{dt} \frac{\partial \mathcal{L}}{\partial \dot x} = m \ddot x $$
Which results in:
$$ m \ddot x = 0 $$
Which is clearly not equivalent to the Newtonian case. Now, if we assume a nonzero unspecified potential energy function, then the result would be:
$$ -\frac{dU}{dx} = m \ddot x \Rightarrow \ddot x = \frac{F}{m} $$
But with the box at ground level, where $U = 0$, this seems to be a contradiction supposed to just make Lagrangian mechanics "work"? Am I differentiating incorrectly or what is wrong with my approach?