This section is more precisely about classical mechanics.

Mechanics before quantum mechanics and special relativity.

Basically the same as classical mechanics.

The idea tha taking the limit of the non-classical theories for certain parameters (relativity and quantum mechanics) should lead to the classical theory.

It appears that classical limit is only very strict for relativity. For quantum mechanics it is much more hand-wavy thing. See also: Subtle is the Lord by Abraham Pais (1982) page 55.

Basically the same as classical limit, but more for quantum mechanics.

Boooooring.

Originally it was likely created to study constrained mechanical systems where you want to use some "custom convenient" variables to parametrize things instead of global x, y, z. Classical examples that you must have in mind include:lagrangian mechanics lectures by Michel van Biezen (2017) is a good starting point.

- compound Atwood machine. Here, we can use the coordinates as the heights of masses relative to the axles rather than absolute heights relative to the ground
- double pendulum, using two angles. The Lagrangian approach is simpler than using Newton's laws
- pendulum, use angle instead of x/y

- two-body problem, use the distance between the bodies

When doing lagrangian mechanics, we just lump together all generalized coordinates into a single vector $q (t):R→R_{n}$ that maps time to the full state:
where each component can be anything, either the x/y/z coordinates relative to the ground of different particles, or angles, or nay other crazy thing we want.

$q (t)=[q_{1}(t),q_{2}(t),q_{3}(t),...,q_{n}(t)]$

Then, the stationary action principle says that the actual path taken obeys the Euler-Lagrange equation:
This produces a system of partial differential equations with:

$∂q_{i}∂L(q (t),q ˙ (t),t) −dtd ∂q_{i}˙ ∂L(q (t),q ˙ (t),t) =0$

- $n$ equations
- $n$ unknown functions $q_{i}$
- at most second order derivatives of $q_{i}$. Those appear because of the chain rule on the second term.

The mixture of so many derivatives is a bit mind mending, so we can clarify them a bit further. At:
the $q_{i}$ is just identifying which argument of the Lagrangian we are differentiating by: the i-th according to the order of our definition of the Lagrangian. It is not the actual function, just a mnemonic.

$∂q_{i}∂L(q (t),q ˙ (t),t) $

Then at:

$dtd ∂q_{i}˙ ∂L(q (t),q ˙ (t),t) $

- the $∂q_{i}˙ ∂ $ part is just like the previous term, $q_{i}˙ $ just identifies the argument with index $n+i$ ($n$ because we have the $n$ non derivative arguments)
- after the partial derivative is taken and returns a new function $∂q_{i}˙ ∂L(q (t),q ˙ (t),t) $, then the multivariable chain rule comes in and expands everything into $2n+1$ terms

However, people later noticed that the Lagrangian had some nice properties related to Lie group continuous symmetries.

Basically it seems that the easiest way to come up with new quantum field theory models is to first find the Lagrangian, and then derive the equations of motion from them.

For every continuous symmetry in the system (modelled by a Lie group), there is a corresponding conservation law: local symmetries of the Lagrangian imply conserved currents.
Genius: Richard Feynman and Modern Physics by James Gleick (1994) chapter "The Best Path" mentions that Richard Feynman didn't like the Lagrangian mechanics approach when he started university at MIT, because he felt it was too magical. The reason is that the Lagrangian approach basically starts from the principle that "nature minimizes the action across time globally". This implies that things that will happen in the future are also taken into consideration when deciding what has to happen before them! Much like the lifeguard in the lifegard problem making global decisions about the future. However, chapter "Least Action in Quantum Mechanics" comments that Feynman later notice that this was indeed necessary while developping Wheeler-Feynman absorber theory into quantum electrodynamics, because they felt that it would make more sense to consider things that way while playing with ideas such as positrons are electrons travelling back in time. This is in contrast with Hamiltonian mechanics, where the idea of time moving foward is more directly present, e.g. as in the Schrödinger equation.

Furthermore, given the symmetry, we can calculate the derived conservation law, and vice versa.

And partly due to the above observations, it was noticed that the easiest way to describe the fundamental laws of particle physics and make calculations with them is to first formulate their Lagrangian somehow: why do symmetries such as SU(3), SU(2) and U(1) matter in particle physics?s.

TODO advantages:

- physics.stackexchange.com/questions/254266/advantages-of-lagrangian-mechanics-over-newtonian-mechanics on Physics Stack Exchange, fucking closed question...
- www.quora.com/Why-was-Lagrangian-formalism-needed-in-the-presence-of-Newtonian-formalism
- www.researchgate.net/post/What_is_the_advantage_of_Lagrangian_formalism_over_Hamiltonian_formalism_in_QFT

Bibliography:

- www.physics.usu.edu/torre/6010_Fall_2010/Lectures.html Physics 6010 Classical Mechanics lecture notes by Charles Torre from Utah State University published on 2010,
- Classical physics only. The last lecture: www.physics.usu.edu/torre/6010_Fall_2010/Lectures/12.pdf mentions Lie algebra more or less briefly.

- www.damtp.cam.ac.uk/user/tong/dynamics/two.pdf by David Tong

Original playlist name: "PHYSICS 68 ADVANCED MECHANICS: LAGRANGIAN MECHANICS"

Author: Michel van Biezen.

High school classical mechanics material, no mention of the key continuous symmetry part.

But does have a few classic pendulum/pulley/spring worked out examples that would be really wise to get under your belt first.

As mentioned on the Wikipedia page en.wikipedia.org/w/index.php?title=Stationary_Action_Principle&oldid=1020413171, "principle of least action" is not accurate since it could not necessarily be a minima, we could just be in a saddle-point.

Calculus of variations is the field that searches for maxima and minima of Functionals, rather than the more elementary case of functions from $R$ to $R$.

A function that takes input function and outputs a real number.

Let's start with the one dimensional case. Let the $q:R→R$ and a Functional $I$ defined by a function of three variables $F:R_{3}→R$:

$I(q)=∫_{t_{0}}F(t,q(t),q˙ (t))dt$

Then, the Euler-Lagrange equation gives the maxima and minima of the that type of functional. Note that this type of functional is just one very specific type of functional amongst all possible functionals that one might come up with. However, it turns out to be enough to do most of physics, so we are happy with with it.

Given $F$, the Euler-Lagrange equations are a system of ordinary differential equations constructed from that $F$ such that the solutions to that system are the maxima/minima.

In the one dimensional case, the system has a single ordinary differential equation:

$∂q∂F(t,q(t),q˙ (t)) −dtd ∂q˙ ∂F(t,q(t),q˙ (t)) =0$

By $∂q∂F $ and $∂q˙ ∂F $ we simply mean "the partial derivative of $F$ with respect to its second and third arguments". The notation is a bit confusing at first, but that's all it means.

Therefore, that expression ends up being at most a second order ordinary differential equation where $q$ is the unknown, since:

- the term $∂q∂F(t,q(t),q˙ (t)) $ is a function of $t,q(t),q˙ (t)$
- the term $∂q˙ ∂F(t,q(t),q˙ (t)) $ is a function of $t,q(t),q˙ (t)$. And so it's derivative with respect to time will contain only up to $q¨ $

Now let's think about the multi-dimensional case. Instead of having $q:R→R$, we now have $q:R→R_{n}$. Think about the Lagrangian mechanics motivation of a double pendulum where for a given time we have two angles.

Let's do the 2-dimensional case then. In that case, $F$ is going to be a function of 5 variables $F:R_{5}→R$ rather than 3 as in the one dimensional case, and the functional looks like:

$I(q)=∫_{t_{0}}F(t,q_{1}(t),q_{2}(t),q_{1}˙ (t),q_{2}˙ )(t)dt$

This time, the Euler-Lagrange equations are going to be a system of two ordinary differential equations on two unknown functions $q_{1}$ and $q_{2}$ of order up to 2 in both variables:
At this point, notation is getting a bit clunky, so people will often condense the $q_{i}$ vector
or just omit the arguments of $F$ entirely:

$∂q_{1}∂F(t,q_{1}(t),q_{2}(t),q_{1}˙ (t),q_{2}˙ (t)) −dtd ∂q_{1}˙ ∂F(t,q_{1}(t),q_{2}(t),q_{1}˙ (t),q_{2}˙ (t) =0∂q_{2}∂F(t,q_{1}(t),q_{2}(t),q_{1}˙ (t),q_{2}˙ (t)) −dtd ∂q_{2}˙ ∂F(t,q_{1}(t),q_{2}(t),q_{1}˙ (t),q_{2}˙ (t) =0$

$∂q_{1}∂F(t,q(t),q˙ (t)) −dtd ∂q_{1}˙ ∂F(t,q(t),q˙ (t)) =0∂q_{2}∂F(t,q(t),q˙ (t)) −dtd ∂q_{2}˙ ∂F(t,q(t),q˙ (t)) =0$

$∂q_{i}∂F −dtd ∂q_{i}˙ ∂F =0$

These are the final equations that you derive from the Lagrangian via the Euler-Lagrange equation which specify how the system evolves with time.

The function that fully describes a physical system in Lagrangian mechanics.

When we particles particles, the action is obtained by integrating the Lagrangian over time:

$Action=∫_{t_{0}}L(x(t),∂t∂x(t) ,t)dt$

In the case of field however, we can expand the Lagrangian out further, to also integrate over the space coordinates and their derivatives.

Since we are now working with something that gets integrated over space to obtain the total action, much like density would be integrated over space to obtain a total mass, the name "Lagrangian density" is fitting.

E.g. for a 2-dimensional field $f(x,y,t)$:

$Action=∫_{t_{0}}L(f(x,y,t),∂x∂f(x,y,t) ,∂y∂f(x,y,t) ,∂t∂f(x,y,t) ,x,y,t)dxdydt$

Of course, if we were to write it like that all the time we would go mad, so we can just write a much more condensed vectorized version using the gradient with $x∈R_{2}$:

$Action=∫_{t_{0}}L(f(x,t),∇f(x,t),x,t)dxdt$

And in the context of special relativity, people condense that even further by adding $t$ to the spacetime Four-vector as well, so you don't even need to write that separate pesky $t$.

The main point of talking about the Lagrangian density instead of a Lagrangian for fields is likely that it treats space and time in a more uniform way, which is a basic requirement of special relativity: we have to be able to mix them up somehow to do Lorentz transformations. Notably, this is a key ingredient in a/the formulation of quantum field theory.

The variables of the Lagrangian, e.g. the angles of a double pendulum. From that example it is clear that these variables don't need to be simple things like cartesian coordinates or polar coordinates (although these tend to be the overwhelming majority of simple case encountered): any way to describe the system is perfectly valid.

In quantum field theory, those variables are actually fields.

For every continuous symmetry in the system (Lie group), there is a corresponding conservation law.

Furthermore, given the symmetry, we can calculate the derived conservation law, and vice versa.

As mentioned at buzzard.ups.edu/courses/2017spring/projects/schumann-lie-group-ups-434-2017.pdf, what the symmetry (Lie group) acts on (obviously?!) are the Lagrangian generalized coordinates. And from that, we immediately guess that manifolds are going to be important, because the generalized variables of the Lagrangian can trivially be Non-Euclidean geometry, e.g. the pendulum lives on an infinite cylinder.

physics.stackexchange.com/questions/614757/intuitive-explanation-for-why-time-symmetry-implies-conservation-of-energy on Physics Stack Exchange

Equivalent to Lagrangian mechanics but formulated in a different way.

Motivation: Lagrangian vs Hamiltonian.

TODO understand original historical motivation, www.youtube.com/watch?v=SZXHoWwBcDc says it is from optics.

Intuitively, the Hamiltonian is the total energy of the system in terms of arbitrary parameters, a bit like Lagrangian mechanics.

Bibliography:

The key difference from Lagrangian mechanics is that the Hamiltonian approach groups variables into pairs of coordinates called the phase space coordinates:This leads to having two times more unknown functions than in the Lagrangian. However, it also leads to a system of partial differential equations with only first order derivatives, which is nicer. Notably, it can be more clearly seen in phase space.

- generalized coordinates, generally positions or angles
- their corresponding conjugate momenta, generally velocities, or angular velocities

Bibliography:

Analogous to what the Euler-Lagrange equation is to Lagrangian mechanics, Hamilton's equations give the equations of motion from a given input Hamiltonian:
So once you have the Hamiltonian, you can write down this system of partial differential equations which can then be numerically solved.

$∂q_{j}∂H =−p˙ _{j}∂p_{j}∂H =q˙ _{j}$

This is how you transform the Lagrangian into the Hamiltonian.

The simplest harmonic oscillator system.

The period does depend on the initial height/angle, except for the very small angle approximation:

youtu.be/Ca7c5B7Js18?t=803 compares Lagrangian mechanics equation vs the direct x/y coordinate equation.

resonance in a mechanical system.

This idealization does not seems to be possible at all in the context of Maxwell's equations with pointlike particles.

The most minimal hello world with gnuplot visualization!!! stackoverflow.com/questions/11175694/bullet-physics-simplest-collision-example/36987063#36987063

Does not seem to support it unfortunately:

- 2015 thread: pybullet.org/Bullet/phpBB3/viewtopic.php?t=10783. On the reply pybullet.org/Bullet/phpBB3/viewtopic.php?p=36197&sid=5fbceed0c3a5ebcf233d328bb4ee1342#p36197 Erwin Coumans says there's no support, and no support planned.

Python library for Bullet Physics.

Became very popular as of result of people using Bullet Physics for reinforcement learning AI training robot simulations.

Website: pybullet.org/

Source code: somewhere inside the main Bullet Physics source tree. Yay.

Was a closed source project by "Roboti LLC", which was then acquired by DeepMind in October 2021 and open sourced March 2022: www.deepmind.com/blog/open-sourcing-mujoco

This library is quite cool. Feel very brutally lean and mean.

Tested on Ubuntu 23.10;

```
git clone https://github.com/google-deepmind/mujoco
cd mujoco
git checkout 5d46c39529819d1b31249e249ca399f306a108ac
mkdir -p build
cd build
cmake ..
make -j
```

Now let's play. Minimal interactive UI simulation of a simple MJCF scene with one falling cube:
Test soure code: github.com/google-deepmind/mujoco/blob/5d46c39529819d1b31249e249ca399f306a108ac/sample/basic.cc. The only thing you can do is rotate the scene with the computer mouse it seems. Mentioned at: mujoco.readthedocs.io/en/2.2.2/programming.html#sabasic

`bin/basic ../doc/_static/hello.xml`

Some more interesting models can be found under the

`model/`

directory: github.com/google-deepmind/mujoco/tree/5d46c39529819d1b31249e249ca399f306a108ac/model E.g. the imaginary humanoid robot DeepMind used in many demos can be seen with:
`bin/basic ../model/humanoid/humanoid.xml`

A more advanced UI with a few controls:
Test soure code: github.com/google-deepmind/mujoco/tree/5d46c39529819d1b31249e249ca399f306a108ac/simulate. Mentioned at: mujoco.readthedocs.io/en/2.2.2/programming.html#sasimulate

`bin/simulate ../doc/_static/hello.xml`

A very cool thing about that UI is that you can manually control joints. There are no joints in the hello.xml, but e.g. with the humanoid model:
under "Control" you move each joint of the robot separately which is quite cool.

`bin/simulate ../model/humanoid/humanoid.xml`

There's also a
Mentioned at: mujoco.readthedocs.io/en/2.2.2/programming.html#sarecord but TODO that produced a broken video, related issues:

`bin/record`

test executable that presumably renders the simulation directly to a file:
```
bin/record ../doc/_static/hello.xml 5 60 rgb.out
ffmpeg -f rawvideo -pixel_format rgb24 -video_size 800x800 -framerate 60 -i rgb.out -vf "vflip" video.mp4
```

Had hardware acceleration in mind from the very start, and for a long time that has meant GPU acceleration.