This project visualizes the motion of particles in one Cartesian axis and the center of mass in both Cartesian axes.
🔹 masses of the particles,
🔹 constant forces that interact with particles,
🔹 initial positions of the particles,
🔹 initial velocity,
🔹 number of iterations,
🔹 time of the process.
Initial data is stored in init_data.txt. Output can be found in output.txt file.
The problem is to find final coordinates of the center of the mass after some seconds.
If we want to find coordinates of the center of the mass we would use this equation:
source: http://hyperphysics.phy-astr.gsu.edu/hbase/cm.html
In the book I gave as a source, you can find an analytical solution to this problem, but I wanted to do it numerically. So I used Newton's second law of motion.
The acceleration is the second derivative of the position, so I changed a to the second derivative.
Force is the force that acts on the selected particle in the plane.
The solution is the function x(t).
This is the answer to how my program works. It solves this second derivative, calculates the positions of the particles based on the calculated function, and from this it calculates the position of the center of mass.
The program is a simulation, not a library, so you can download it right away and use it.
🔹 enable the executable file
🔹 view the visualization,
🔹 run output.txt. There you can see the final position of the particles and the center of mass.
🔹 boot up init_data.txt,
🔹 read the rules,
🔹 stick to the rules!
🔹 add/remove particles,
🔹 save init_data.txt,
🔹 run executable file and after visualization output.txt.