Physics Simulation
Python, Dynamic Systems, Simulation, Jupyter Notebook
Using Lagrangian dynamics, I was able to simulate a box bouncing around within a larger box. First, I calculated the potential and kinetic energies of the system to obtain its Lagrangian and later on, the Euler-Lagrange equations. These equations describe the dynamics of the system while not experiencing impact. To detect impact the following coordinate frames were used.
Using the transformation matrices between these frames, I am able to detect impact if any of the smaller box’s vertices intersect the larger box’s walls. Each vertex is checked against each wall for every time step of the simulation. If an impact is detected, the dynamic equations are updated and the simulation continues.