|
1 | 1 | """ |
2 | | -Finding the type of collision and calculating final velocities after collisions are fundamental concepts in physics. |
3 | | -This module provides functions to compute the final velocities of two masses after both inelastic and elastic collisions, |
4 | | -as well as a function to determine the type of collision based on initial and final velocities. |
5 | | -
|
6 | | -Description: Collisions in physics refers to the interaction between two masses when they collide head-on. There are 2 types of |
7 | | -collisions: inelastic and elastic. In an inelastic collision, the two masses stick together and move with a common velocity |
8 | | -after the collision. In an elastic collision, both momentum and kinetic energy are conserved, and the masses bounce off each other without sticking together. |
9 | | -Momentum is the product of mass and velocity, while kinetic energy is given by the formula (1/2) * mass * velocity^2. |
10 | | -The type of collision can be determined by comparing the initial and final momentum and kinetic energy of the system. |
| 2 | +Finding collision types and final velocities is key in physics. |
| 3 | +This module computes final velocities for inelastic and elastic collisions. |
| 4 | +It also identifies the collision type from initial and final velocities. |
| 5 | +
|
| 6 | +Description: Collisions happen when two masses interact head-on. |
| 7 | +There are two types: inelastic and elastic. In inelastic collisions, the |
| 8 | +masses stick together and share one final velocity. In elastic collisions, |
| 9 | +momentum and kinetic energy stay conserved, and the masses rebound. |
| 10 | +Momentum is mass times velocity, and kinetic energy is 1/2 mv^2. |
| 11 | +The type of collision can be found by comparing the system's initial and |
| 12 | +final momentum and kinetic energy. |
11 | 13 |
|
12 | 14 | Reference: https://en.wikipedia.org/wiki/Collision |
13 | 15 | """ |
@@ -50,7 +52,7 @@ def elastic_collisions(mass1 :float, |
50 | 52 | ) -> str : |
51 | 53 | """Calculate final velocities after a perfectly elastic collision. |
52 | 54 |
|
53 | | - This assumes the collision is head-on and conserves both momentum and kinetic energy. |
| 55 | + The collision is head-on and conserves both momentum and kinetic energy. |
54 | 56 |
|
55 | 57 | Parameters: |
56 | 58 | mass1: Mass of the first object. |
@@ -115,11 +117,11 @@ def type_collision(mass1 :float, |
115 | 117 | kinetic_final = 0.5 * ((mass1 * velocity_final1**2) + (mass2 * velocity_final2**2)) |
116 | 118 |
|
117 | 119 | if kinetic_final == kinetic_initial and momentum_initial == momentum_final: |
118 | | - return f'Perfectly Elastic Collision' |
| 120 | + return 'Perfectly Elastic Collision' |
119 | 121 | elif not(kinetic_final == kinetic_initial) and momentum_initial == momentum_final: |
120 | | - return f'Perfectly Inelastic Collision' |
| 122 | + return 'Perfectly Inelastic Collision' |
121 | 123 | else: |
122 | | - return f'Inelastic Collision' |
| 124 | + return 'Inelastic Collision' |
123 | 125 |
|
124 | 126 |
|
125 | 127 | if __name__ == "__main__": |
|
0 commit comments