# Derivation of equations of motion for a multi-body system using Mathematica

I want to learn how to work with finite-element models in Mathematica to derive the equation of motion for rigid bodies.

I can do this by compiling the Lagrangian of the system, then differentiating by generalized coordinates, as was done in the topics:

Lagrangian of three-mass system with Mathematica

Equations of motion for two-mass torsional oscillator with the gear train

This time I want to program all the relationships and types of motion, and the derivation of the equations of motion should be carried out automatically.

Several tools caught my eye, but I haven't worked with that yet:

https://www.wolfram.com/products/applications/mechsystems/screens.html

There is a tripod robot with one triangular fixed platform and one triangular movable platform. The position of the platform is changed by linear movement of the drive links:

Need to:

1.Build up kinematic scheme in Mahematica (by analogy with how it is done in SimMechanics or SimScape MultiBody);

1. Derive the Lagrangian $$L$$ automaticly;

2. Derive the equations of motion automaticly;

Is it possible in Mathematica?

• Wolfram SystemModeler creates equations of motion for connected components and simulates them. In Mathematica, you can use SystemModel to create such models. And access their equations, among other properties. Although those equations tend to involve lots of extra variables, so not easy to interpret.
Jul 1, 2021 at 22:11
• dtn, tagging a user that has not commented on the post yet will not notify them, just fyi. I it might help to mention it to them in chat if you’d like to get their attention. Jul 2, 2021 at 10:15
• Yes, you can get symbolic form of equations. See the "SystemEquations" property of a SystemModel. You can use these equations, e.g., with NDSolve. There will likely be many more equations and variables than you expect, due to many trivial equations equating connector variables. Human-friendly equations may require some string processing to simplify variable names & remove trivial cases.
Jul 7, 2021 at 17:15
• How about starting with simpler examples in SystemModel documentation to see how to extract equations. Creating the 3D mechanical model in the question is probably best to make use of the 3D mechanical components in the Modelica Standard Library. You can drag-and-drop those components if you have Wolfram SystemModeler (or other Modelica-based GUI). Otherwise, you can create 'by hand' using System Model functions in Mathematica, but that will be more work.
Jul 9, 2021 at 21:11
• Have a look at the video on "Automatically Generate Physical Properties from CAD Data" at wolfram.com/system-modeler/what-is-new