Please be lenient if this question has been asked before in a similar manner. My background is in CS, but I am working on the physics-based modeling of complex systems and I am studying physics as an undergraduate.

I am studying a dynamical system that is partially physical and partially complex (non-physical). For the purpose of this question, let us say that the system is described by three states: the spatial position $x$ and $y$, and money $m$, all measured at time $t$. You can think of a person who runs around and collects or throws money as he goes. This is not the real problem I am modeling, but it is a good enough approximation since the underlying mathematics is the same.

I have a set of differential equations that describes the evolution over time of these three states:

  1. $\dot{x} = f(x)$
  2. $\dot{y} = g(y)$
  3. $\dot{m} = h(m)$ caveat: this might be a non-linear function of $x,y,m \to \dot{m} = h(m,x,y)$

These three equations were modeled in application of [1] on the basis of some datasets (synthetic, if it matters).

Under a hypothesis that derives from the literature and that we can challenge if necessary (but please assume that this is true for a second), the evolution of the system is such that there exists an unknown Lagrangian $L(x,y,m,\dot{x},\dot{y},\dot{m},t)$ for which the associated action is stationary to first-order. The corresponding Euler-Lagrangian equations should therefore be:

  1. $\frac{\partial L}{\partial x} = \frac{d}{dt} \frac{\partial L}{\partial\dot{x}}$
  2. $\frac{\partial L}{\partial y} = \frac{d}{dt} \frac{\partial L}{\partial\dot{y}}$
  3. $\frac{\partial L}{\partial m} = \frac{d}{dt} \frac{\partial L}{\partial\dot{m}}$

Question 1: How can I derive the possible forms of $L$ that satisfy the constraints that derive from the known equations of motion? I am familiar with the method for deriving the equations of motion from a given Lagrangian in physical systems, as is commonly done in analytical mechanics, but I do not understand how to go the other way around. I understand that the Lagrangians that satisfy these constraints may be many, but it seems like not all possible functionals of these state variables will be Lagrangians: for me, it is sufficient to identify one, and ideally one with a few symbols, and discard some trivial cases. Since this is a problem that I will have to solve frequently in the future, I would like to have an idea on how to construct a Lagrangian given the equations of motion, in general, and not only in the application of this specific problem.

Question 2: This paper [2] estimates the polynomial representation of the Lagrangian that results in a minimised (not stationary) action given certain time series. If the Lagrangian can be approximated as a Taylor expansion, then this approach is reasonable. They do however make use of a control trajectory for which the action associated with the Lagrangian being approximated is not minimised, in order to avoid trivial trajectories (e.g. $\forall q,\dot{q}|L(q,\dot{q},t) = 1$). Does the knowledge of a control trajectory help in answering question 1? I have trajectories for which, by the same hypothesis deriving from the literature, the action should not be stationary, which means that those trajectories might provide further constraints on the shape of possible Lagrangians.

Please tell me if something is not clear or should be expressed better.

[1] Brunton, S. L., Proctor, J. L., & Kutz, J. N. (2016). Discovering governing equations from data by sparse identification of nonlinear dynamical systems. Proceedings of the national academy of sciences, 113(15), 3932-3937. https://doi.org/10.1073/pnas.1517384113

[2] Hills, D. J., Grütter, A. M., & Hudson, J. J. (2015). An algorithm for discovering Lagrangians automatically from data. PeerJ Computer Science, 1, e31. https://peerj.com/articles/cs-31.pdf

Edit: I had written $dt$ instead of $t$ in the first expression of $L$

  • 2
    $\begingroup$ My instinct is that it's not actually possible to get a first-order equation of motion from an action principle. Roughly, if $\partial L/\partial \dot{q}$ depends on $\dot{q}$, then the term $d/dt( \partial L/\partial \dot{q})$ will involve second derivatives of $q$. And if $\partial L/\partial \dot{q} = f(q)$ is independent of $\dot{q}$, then the Lagrangian must be of the form $\dot{q} f(q) + g(q)$; in that case, the first term is a total derivative $d/dt(F(q))$, with $F$ an antiderivative of $f$, and so that term does not contribute to the Euler-Lagrange equations at all. ... $\endgroup$ Commented May 10, 2022 at 13:01
  • 1
    $\begingroup$ ... All of which is to say that I'd be interested to see where in the literature your hypothesis derives from, since it goes against my instincts (which could be wrong!) $\endgroup$ Commented May 10, 2022 at 13:02
  • 2
  • 1
    $\begingroup$ Are we allowed to use auxiliary variables? Related: physics.stackexchange.com/q/20298/2451 and links therein. $\endgroup$
    – Qmechanic
    Commented May 10, 2022 at 13:19
  • 3
    $\begingroup$ The laziest way to do it is introduce new dynamical variables $u,\,v,\,w$ with $L$ equal up to total derivatives to $u(f-\dot{x})+v(g-\dot{y})+w(h-\dot{m})$, e.g. $L=uf+\dot{u}x+vg+\dot{v}y+wh+\dot{w}m$. $\endgroup$
    – J.G.
    Commented May 10, 2022 at 13:58

1 Answer 1


I am not sure if this is your problem ?.

with the non holonomic constraint equations

$$\left[ \begin {array}{c} {\dot x}-f \left( x \right) \\ {\dot y}-g \left( y \right) \\ {\dot m}-h \left( m,x,y \right) \end {array} \right] =\vec 0$$

and the kinetic energy

$$T=\frac 12\,(\dot x^2+\dot y^2+\dot m^2)$$

you can obtain with EL the equations of motion

$$\ddot x=\left( {\frac {d}{dx}}f \left( x \right) \right) {\dot x}\\ \ddot y=\left( {\frac {d}{dy}}g \left( y \right) \right) {\ddot y}\\ \ddot m=\left( {\frac {\partial }{\partial x}}h \left( m,x,y \right) \right) {\dot x}+ \left( {\frac {\partial }{\partial y}}h \left( m,x, y \right) \right) {\dot y}+ \left( {\frac {\partial }{\partial m}}h \left( m,x,y \right) \right) {\dot m} $$

  • 1
    $\begingroup$ it is not a physical system, so I cannot assume that the lagrangian corresponds to T-V. The problem is exactly that I do not know the analytical expression of the Lagrangian, though I know the equations of motion and I would like to learn the former on the basis of the latter. Previous comments indicate that this corresponds to the Inverse problem for Lagrangian mechanics, with which I'm trying to get familiar $\endgroup$
    – Daneel R.
    Commented May 10, 2022 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.