
Ask HN: Toolbox or library for simulating classical mechanics problems? - ducktective
I&#x27;m looking for a toolbox or library to simulate classical mechanics problems usually found in textbooks.<p>I want to for example see the oscillations of a usual double pendulum problem with ability to plot angles and forces at arbitrary positions. Or physical parameters of &quot;box on a cart with friction&quot; problem or real-time animation of a N-body problem. It&#x27;d be nice if it also supports 3d.<p>1- In summary, suppose someone wants to go through Landau-Lifshitz or Goldstein books and simulate the problems on his computer. What tools should he be looking for?<p>2- What is the keyword I should be searching for? Rigid Body Solver? Physics Engine? Numerical solvers of Lagrange (or Hamilton?) differential equations formulations? or should I be looking for Finite Element Methods?<p>3- It would be great if there is a MATLAB&#x2F;python&#x2F;C++ solution and not a full-blown software like COMSOL<p>Thanks<p>(x-post from &#x2F;r&#x2F;physics)
======
enriquto
It will certainly not satisfy all your needs, but you cannot avoid spending
some time with "Structure and Interpretation of Classical Mechanics" and its
companion scheme code.

There is also a neat appendix, slightly simpler and more modern, aimed at the
mathematical details, titled "Functional Differential Geometry", by the same
authors.

------
mathnmusic
Have you tried Algodoo ( [http://www.algodoo.com/](http://www.algodoo.com/) )?
It's very easy to use and at the same time, also lets you script things. I
think it's limited to 2D problems only though.

If you find any good tools, please do send a pull request to add them here:
[https://github.com/learn-awesome/learn-
awesome/blob/master/p...](https://github.com/learn-awesome/learn-
awesome/blob/master/physics.md)

------
vsskanth
Modelica is an object-oriented language specifically created for simulating
physical systems. It is used to formally describe and simulate complex
mechanical (or even electrical or thermal) systems with multiple interacting
parts (automobiles, flight control systems).

OpenModelica [[https://openmodelica.org/](https://openmodelica.org/)] is the
most popular free IDE for Modelica. You also have commercial IDEs like Dymola
(I use this), SimulationX etc.

------
occamschainsaw
If you want to gain a deeper understanding of classical mechanics, starting
with a good diff eq package and then implementing the physical phenomena in
terms of diff eq code would also be a good exercise.

Plots would be easy, but I don't think implementing animation from scratch
won't be worth the time and effort imo.

Python: [0]
[http://pundit.pratt.duke.edu/wiki/Python:Ordinary_Differenti...](http://pundit.pratt.duke.edu/wiki/Python:Ordinary_Differential_Equations)

[1]
[http://csc.ucdavis.edu/~cmg/Group/readings/pythonissue_3of4....](http://csc.ucdavis.edu/~cmg/Group/readings/pythonissue_3of4.pdf)

If you are familiar with Matlab or Mathematica, diff eqs are fairly easy to
play around with in those environments.

------
bsilvereagle
The MATLAB toolbox "Simscape Multibody" (formerly SimMechanics) does exactly
what you're asking. It comes free with student editions of MATLAB, but for
home use you need to buy Simulink & Simscape Mechanics.

An alternative that does not support animation as easily as Simscape, but will
generate 2D/3D plots, is OpenModelica.

[https://www.mathworks.com/products/simmechanics.html](https://www.mathworks.com/products/simmechanics.html)

[https://openmodelica.org/](https://openmodelica.org/)

------
quantumfitba
[https://www.myphysicslab.com/](https://www.myphysicslab.com/)

------
0db532a0
Classical Mechanics with Mathematica: [https://www.amazon.com/Classical-
Mathematica%C2%AE-Simulatio...](https://www.amazon.com/Classical-
Mathematica%C2%AE-Simulation-Engineering-Technology/dp/3319775944)

------
marmaduke
Have you looked at XPP AUT? It provides a mathematically oriented DSL which
also allows you to generated GIFs. IIRC one of the examples is a pendulum, but
there's no reason you couldn't do an N-body problem.

------
mhh__
You might need to just solve them then write MATLAB or Mathematica code to
plot the solutions.

