Zephyr Scientific Library (zscilib)
Files | Functions
Momentum

Momentum functions. More...

Files

file  momentum.h
 API header file for momentum in zscilib.
 

Functions

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...
 

Detailed Description

Momentum functions.

Function Documentation

◆ zsl_phy_mom_change()

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.

Parameters
mMass of the object in kilograms.
viInital velocity in meters per second.
vfFinal velocity in meters per second.
pPointer 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()

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.

Parameters
m1Mass of the first object in kilograms.
vi1Inital velocity of the first object in meters per second.
vf1Final velocity of the first object in meters per second.
m2Mass of the second object in kilograms.
vi2Inital velocity of the second object in meters per second.
vf2Pointer 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()

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.

Parameters
fForce applied in newtons.
timeTime in seconds.
impPointer 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()

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.

Parameters
m1Mass of the first initial object in kilograms.
vi1Inital velocity of the first object in meters per second.
m2Mass of the second initial object in kilograms.
vi2Inital velocity of the second object in meters per second.
vfPointer 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()

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).

Parameters
mMass of the object in kilograms.
vVelocity in meters per second.
pPointer 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.