Learning mechanical systems from real-world data using discrete forced Lagrangian dynamics

Martine Dyring Hansen, Elena Celledoni, Benjamin K. Tapley · DOI

Introduction

Most modern physics-informed machine learning models, such as Hamiltonian or Lagrangian Neural Networks (HNNs/LNNs), rely on observing both position and velocity to learn a system's dynamics. However, in real-world scenarios—like analyzing video frames or motion capture data—we often only have access to raw positions. While one could estimate velocity using finite differences, this approach is notoriously sensitive to noise and truncation errors. Furthermore, many existing models struggle with "non-conservative" systems where energy is lost to friction or added via external control.

To bridge this gap, researchers have introduced the Discrete Forced Lagrangian Neural Network (DFLNN). This model is "discrete by design," matching the sampled nature of real-world data while respecting the underlying geometric structure of mechanics. By leveraging discrete variational mechanics, the model can accurately separate conservative energy from non-conservative forces using only position data.

Overview of the DFLNN framework compared to continuous approaches, demonstrating its application to human motion capture data for long-term rollout predictions.

Methods: Discrete Forced Lagrangian Neural Networks

The core innovation of DFLNN is its foundation on the Discrete Lagrange-d’Alembert Principle. Instead of learning a continuous-time differential equation and then discretizing it (which introduces errors), the authors start with a discrete version of the principle of least action. This ensures the model naturally preserves the "symplectic" structure of the system when external forces are absent.

Dual-Network Architecture

The model utilizes two separate feed-forward neural networks to represent the system's components:

  1. Lagrangian Network ($L_\theta$): Learns the system's kinetic and potential energy.
  2. Force Network ($F_\theta$): Learns external forces such as dissipation, friction, or control inputs.
The DFLNN architecture detailing the dual-network approach for learning discrete Lagrangian and force components through the discrete forced Euler-Lagrange equations.

To prevent the model from finding trivial solutions, a logarithmic barrier term is incorporated as regularization to ensure the learned Lagrangian remains mathematically regular (invertible). For high-dimensional data like images, the DFLNN is trained simultaneously with an autoencoder that compresses inputs into a low-dimensional latent space where the physical laws are learned.

Experimental Results

The authors validated DFLNN on four distinct tasks, ranging from synthetic systems like a damped double pendulum and a dissipative charged particle to high-dimensional data like pixel-based pendulum sequences and real-world human motion capture.

Key Findings

  • Superior Accuracy: In the charged particle task, the DFLNN achieved an extrapolation error of 0.0072, significantly outperforming standard Neural ODEs (0.041).
  • Long-Term Stability: On human motion data, the DFLNN maintained plausible trajectories long after baseline models diverged into non-physical behavior.
  • Physical Interpretability: Because the model learns energy ($L$) and forces ($F$) separately, researchers can "turn off" the force network after training. This allows them to simulate how a system would behave in a frictionless environment, even if it was only ever observed in a dissipative one.
  • Pixel-to-Physics: When applied to images, the model discovered latent coordinates that follow physical laws, effectively "discovering" a pendulum's angle from raw light values.

Conclusion and Future Work

By training on discrete Euler-Lagrange equations, the DFLNN avoids the "discretization gap" that plagues continuous-time models when applied to sampled data. While the current training process is computationally expensive due to Hessian-based regularization, the model's ability to learn complex dynamics from position-only data makes it highly practical for sensor-limited environments. Future research will explore higher-order variational integrators and more complex robotic control tasks.

Summary updated

BibTeX
@misc{hansen2025learning,
  author = {Martine Dyring Hansen and Elena Celledoni and Benjamin K. Tapley},
  title = {{Learning mechanical systems from real-world data using discrete forced Lagrangian dynamics}},
  year = {2025},
  eprint = {2505.20370},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.20370},
}
Figure