{"id":50701520,"url":"https://github.com/lorenzoliuzzo/lms","last_synced_at":"2026-06-09T09:30:28.743Z","repository":{"id":206306106,"uuid":"677831938","full_name":"lorenzoliuzzo/LMS","owner":"lorenzoliuzzo","description":"LMS - Lagrangian Mechanics Simulator","archived":false,"fork":false,"pushed_at":"2023-11-27T18:04:20.000Z","size":17063,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-01-27T05:35:43.068Z","etag":null,"topics":["lagrangian-mechanics","physics","physics-simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lorenzoliuzzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-08-12T19:31:57.000Z","updated_at":"2023-11-21T21:17:26.000Z","dependencies_parsed_at":"2024-01-15T07:05:11.628Z","dependency_job_id":null,"html_url":"https://github.com/lorenzoliuzzo/LMS","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.21052631578947367","last_synced_commit":"d5dbcdb2dfad6bfbe1491019c4bb6dde82464dc3"},"previous_names":["lorenzoliuzzo/mec","lorenzoliuzzo/lm4ml","lorenzoliuzzo/lms"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lorenzoliuzzo/LMS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzoliuzzo%2FLMS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzoliuzzo%2FLMS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzoliuzzo%2FLMS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzoliuzzo%2FLMS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lorenzoliuzzo","download_url":"https://codeload.github.com/lorenzoliuzzo/LMS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzoliuzzo%2FLMS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34101064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lagrangian-mechanics","physics","physics-simulation"],"created_at":"2026-06-09T09:30:27.521Z","updated_at":"2026-06-09T09:30:28.738Z","avatar_url":"https://github.com/lorenzoliuzzo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LMS - Lagrangian Mechanics Simulator\n\n## Overview\nThe Lagrangian Mechanics Simulator (LMS) is a Python library designed for the simulation of mechanical systems using Lagrangian mechanics. Lagrangian mechanics provides a powerful framework for describing the dynamics of complex systems by expressing them in terms of generalized coordinates, velocities, and potential energy functions.\n\n\n## Key features\n### Modular Constraint Definition\nThe library introduces a `parametrization` function that allows users to wrap constraint functions, facilitating the definition of constraints within a Lagrangian system. This modularity enables the easy incorporation of various constraints into mechanical simulations.\n\n### Flexible Potential Energy Definition\nThe library provides a `potential_energy` function that allows users to wrap potential energy functions, offering flexibility in defining energy contributions within a Lagrangian system. Users can easily incorporate gravitational and elastic potential energy functions into their simulations.\n\n### Dynamic System Evolution\nThe `evolve_lagrangian` function serves as a core component for dynamically evolving Lagrangian systems over specified time spans. This function integrates the equations of motion using the Euler-Lagrange equations, providing users with a predictive tool for simulating the behavior of mechanical systems.\n\n\n## Example: Simulating a double pendulum with gravitational potential energy\n```python\nimport jax\nfrom jax import numpy as jnp\nfrom src.surfaces import parametrization, double_pendulum\nfrom src.potentials import potential_energy, gravity\nfrom src.lagrangian import evolve_lagrangian\nfrom src.plotting import animate_3D_trajectory\n\n# Set initial conditions and parameters\nnbodies = ndim = 2\nmass = jax.random.uniform(key, (nbodies,))\nq = jax.random.uniform(key, (nbodies, ndim))\nq_t = jax.random.uniform(key, (nbodies, ndim))\n\n# Create a constraint with parametrization\nconstraint = parametrization(double_pendulum, l1=1.0, l2=2.0)\n\n# Create gravitational potential energy\ng_pot = potential_energy(gravity, g=9.81)   \n\n# Set time evolution parameters\ntmax = 20.\nnpoints = 500\ntspan = jnp.linspace(0., tmax, npoints)\n\n# Evolve the Lagrangian system\npositions, velocities = evolve_lagrangian(tspan, q, q_t, mass, potentials=[g_pot], constraint=constraint)\n\n# animate the trajectory\nanimate_3D_trajectory(tspan, positions, constraint)\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"media/double_pendulum.gif\" alt=\"Double Pendulum Animation\"\u003e\n\u003c/p\u003e\n\n## Installation\nTo use the Lagrangian Mechanics Simulator, you can clone the repository and install the required dependencies:\n\n```bash\ngit clone https://github.com/lorenzoliuzzo/LMS.git\ncd LMS\npip install -r requirements.txt\n```\n\n## Contributing\nIf you want to contribute to the project, you can open a [pull requests](https://github.com/lorenzoliuzzo/LMS/pulls) or use the [issue tracker](https://github.com/lorenzoliuzzo/LMS/issues/) to suggest any code implementations or report bugs. \nAny contributions are welcome! \n\n## License\nThe code is released under the terms of the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html), see the [LICENSE](https://github.com/lorenzoliuzzo/LMS/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florenzoliuzzo%2Flms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Florenzoliuzzo%2Flms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florenzoliuzzo%2Flms/lists"}