Skip to content

Simulating a die collision in a spinning cup using Euler-Lagrangian Equations

License

Notifications You must be signed in to change notification settings

KhachDavid/die-2d-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2D Dice in a box simulation


Explore this project on GitHub


Euler-Lagrange equations are used to simulate the motion of a dice in a box. The dice is placed in a box, and the box is rotated. The dice moves inside the box due to the rotation of the box. The equations of motion are derived using the Euler-Lagrange equations. The simulation is done using SymPy and Matplotlib.


Euler-Lagrange Equations

The equations of Euler-Lagrange are given by:

$\frac{d}{dt}(\frac{\partial L}{\partial \dot{q_{i}}}) - \frac{\partial L}{\partial q_{i}} = 0$

where:

  • $L$ is the Lagrangian
  • $q_{i}$ is the configuration variable
  • $\dot{q_{i}}$ are the generalized velocities of the configuration variables

For this simulation, the configuration variables are the angles, $x$, and $y$ coordinates of the box and the dice.

$q = [x_{box}, y_{box}, \theta_{box}, x_{dice}, y_{dice}, \theta_{dice}]$



Forces in this system

The forces acting on the system are defined as follows:

Restoring Force: A restoring force, $( F_{\theta_b} )$, arises due to the motion of the box, expressed as:

$F_{\theta_b} = k \cdot \sin\left(\frac{\pi t}{2.5}\right)$

where:

$k$ is the stiffness constant valued at 10000 in this simulation

Gravitational Force: The downward force, $F_{y_b}$, acting on the box:

$F_{y_b} = 4 \cdot m_{box} \cdot g$


Simulation

The simulation of the equations of motion gives the following configurations of the dice and the box:

About

Simulating a die collision in a spinning cup using Euler-Lagrangian Equations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published