Momentum functions.
More...
|
file | momentum.h |
| API header file for momentum in zscilib.
|
|
|
int | zsl_phy_mom_mom (zsl_real_t m, zsl_real_t v, zsl_real_t *p) |
| Calculates the linear momentum in kilograms and meters per second of an object based on its mass (m) and velocity (v). More...
|
|
int | zsl_phy_mom_imp (zsl_real_t f, zsl_real_t time, zsl_real_t *imp) |
| Calculates the impulse given by a constant force acting during a certain period of time. More...
|
|
int | zsl_phy_mom_change (zsl_real_t m, zsl_real_t vi, zsl_real_t vf, zsl_real_t *p) |
| Calculates the gain or loss in momentum of an object based on its mass (m) and its initial (vi) and final (vf) velocities. More...
|
|
int | zsl_phy_mom_elas (zsl_real_t m1, zsl_real_t vi1, zsl_real_t vf1, zsl_real_t m2, zsl_real_t vi2, zsl_real_t *vf2) |
| Calculates the final velocity of an object after an elastic collision with another object given the final velocity of the other object and the masses and initial velocities of both objects. More...
|
|
int | zsl_phy_mom_inelas (zsl_real_t m1, zsl_real_t vi1, zsl_real_t m2, zsl_real_t vi2, zsl_real_t *vf) |
| Calculates the final velocity of the merged object after a perfect inelastic collision between two objects occur, given the masses and initial velocities of both the initial objects. More...
|
|
Momentum functions.
◆ zsl_phy_mom_change()
Calculates the gain or loss in momentum of an object based on its mass (m) and its initial (vi) and final (vf) velocities.
- Parameters
-
m | Mass of the object in kilograms. |
vi | Inital velocity in meters per second. |
vf | Final velocity in meters per second. |
p | Pointer to the output difference in momentum in kilograms and meters per second. Will be set to NAN if the mass is negative. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_mom_elas()
Calculates the final velocity of an object after an elastic collision with another object given the final velocity of the other object and the masses and initial velocities of both objects.
- Parameters
-
m1 | Mass of the first object in kilograms. |
vi1 | Inital velocity of the first object in meters per second. |
vf1 | Final velocity of the first object in meters per second. |
m2 | Mass of the second object in kilograms. |
vi2 | Inital velocity of the second object in meters per second. |
vf2 | Pointer to the final velocity of the second object in meters per second. Will be set to NAN if any of the masses is negative or if the mass of the second object is zero. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_mom_imp()
Calculates the impulse given by a constant force acting during a certain period of time.
- Parameters
-
f | Force applied in newtons. |
time | Time in seconds. |
imp | Pointer to the output impulse in newtons and seconds. Will be set to NAN if the time is negative. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_mom_inelas()
Calculates the final velocity of the merged object after a perfect inelastic collision between two objects occur, given the masses and initial velocities of both the initial objects.
- Parameters
-
m1 | Mass of the first initial object in kilograms. |
vi1 | Inital velocity of the first object in meters per second. |
m2 | Mass of the second initial object in kilograms. |
vi2 | Inital velocity of the second object in meters per second. |
vf | Pointer to the final velocity of the merged object in meters per second. Will be set to NAN if any of the masses is negative or if the sum of both masses is zero. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_mom_mom()
Calculates the linear momentum in kilograms and meters per second of an object based on its mass (m) and velocity (v).
- Parameters
-
m | Mass of the object in kilograms. |
v | Velocity in meters per second. |
p | Pointer to the output linear momentum in kilograms and meters per second. Will be set to NAN if the mass of the object is negative. |
- Returns
- 0 if everything executed properly, error code on failure.