Physics simulation of a collision in 1D

AI Thread Summary
The discussion focuses on a physics simulation modeling the collision of two balls in a straight line, where parameters like the coefficient of restitution, masses, and initial velocities can be varied. The user has successfully implemented the simulation but faces feedback from the instructor regarding the interpretation of initial velocities affecting collision dynamics. The user clarifies that while the collision point changes with velocity adjustments, the final position calculations depend on the initial conditions set before the collision. After reviewing the code, the user concludes that there are no issues with it. The conversation highlights the complexities of simulating physical interactions and the importance of understanding initial conditions in collision physics.
stripes
Messages
262
Reaction score
0

Homework Statement



I am designing a physics simulation that models two balls colliding along a straight line path. I can change the coefficient of restitution, the initial velocities, and their masses. THe assignment asks that we vary at least three parameters, so in my case, the three are the coefficient of rest., the masses, and the velocities.

I have gotten the program working but my instructor keeps telling me that if the user changes the initial velocities of either ball, it only changes the point at which the collision occurs. I've made it so that the collision occurs at time zero, and yes, changing the initial velocity before time zero will change where the collision occurs, but I'm not worried about that. THe point is that I calculate the final position based on the initial velocity, initial mass, and the time. And this final position at any time will depend on whatever the initial velocity was.

I've attached my code. If someone could let me know if there is anything wrong with it, I would appreciate it.

Homework Equations



--

The Attempt at a Solution



See above
 

Attachments

Physics news on Phys.org
Never mind, the confusion has been settled. Nothing was wrong with the code.
 
Back
Top