Zephyr Scientific Library (zscilib)
Files | Functions
Dynamics

Dynamics functions. More...

Files

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

Functions

int zsl_phy_dyn_newton (zsl_real_t m, zsl_real_t accel, zsl_real_t *f)
 Calculates the force in newtons that experiences a body based on its mass (m) and acceleration (accel). More...
 
int zsl_phy_dyn_fric (zsl_real_t n, zsl_real_t mu, zsl_real_t *f)
 Calculates the friction force experienced by a body moving in a surface with a friction coefficient 'mu'. More...
 
int zsl_phy_dyn_normal (zsl_real_t m, zsl_real_t theta, zsl_real_t *n)
 Calculates the normal force in newtons exerted by plane inclined 'theta' radians on a body of mass 'm'. More...
 
int zsl_phy_dyn_pendul_period (zsl_real_t l, zsl_real_t *t)
 Calculates an approximation of the period of a simple pendulum with small oscilations, based on its length (l). More...
 
int zsl_phy_dyn_pendul_max_speed (zsl_real_t l, zsl_real_t oi, zsl_real_t *vmax)
 Calculates the maximum speed in meters per second of a simple pendulum based on its length (l) and initial angle (oi). More...
 
int zsl_phy_dyn_tension (zsl_real_t m, zsl_real_t a, zsl_real_t *t)
 Calculates the tension in newtons of a massless tensed rope with a moving object. More...
 
int zsl_phy_dyn_lever (zsl_real_t d1, zsl_real_t f1, zsl_real_t d2, zsl_real_t *f2)
 Calculates the force required to balance a lever, given the force applied to the other end of the lever and the distances between the end of the lever and its fulcrum. More...
 

Detailed Description

Dynamics functions.

Function Documentation

◆ zsl_phy_dyn_fric()

int zsl_phy_dyn_fric ( zsl_real_t  n,
zsl_real_t  mu,
zsl_real_t f 
)

Calculates the friction force experienced by a body moving in a surface with a friction coefficient 'mu'.

Parameters
nNormal force that the surface exerts to the body, in newtons.
muFriction coefficient, that ranges from zero to one.
fPointer to the output friction force in newtons. Will be set to NAN if 'mu' is less than zero or greater than 1.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_dyn_lever()

int zsl_phy_dyn_lever ( zsl_real_t  d1,
zsl_real_t  f1,
zsl_real_t  d2,
zsl_real_t f2 
)

Calculates the force required to balance a lever, given the force applied to the other end of the lever and the distances between the end of the lever and its fulcrum.

Parameters
d1Distance between the fulcrum and the first end of the lever.
f1Force applied to the firts end of the lever in newtons.
d2Distance between the fulcrum and the second end of the lever.
f2Pointer to the output force in newtons. Will be set to NAN if any of the distances are negative.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_dyn_newton()

int zsl_phy_dyn_newton ( zsl_real_t  m,
zsl_real_t  accel,
zsl_real_t f 
)

Calculates the force in newtons that experiences a body based on its mass (m) and acceleration (accel).

Parameters
mMass of the body in kilograms.
accelAcceleration in meters per second squared.
fPointer to the output force in newtons. Will be set to NAN if the mass of the body is negative.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_dyn_normal()

int zsl_phy_dyn_normal ( zsl_real_t  m,
zsl_real_t  theta,
zsl_real_t n 
)

Calculates the normal force in newtons exerted by plane inclined 'theta' radians on a body of mass 'm'.

Parameters
mMass of the body in kilograms.
thetaAngle of inclination in radians.
nPointer to the output normal force in newtons. Will be set to NAN if the value of the body's mass is negative.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_dyn_pendul_max_speed()

int zsl_phy_dyn_pendul_max_speed ( zsl_real_t  l,
zsl_real_t  oi,
zsl_real_t vmax 
)

Calculates the maximum speed in meters per second of a simple pendulum based on its length (l) and initial angle (oi).

Parameters
lLenght of the pendulum in meters.
oiInitial angle in radians.
vmaxPointer to the output maximum speed in meters per second. Will be set to NAN if the lenght is negative.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_dyn_pendul_period()

int zsl_phy_dyn_pendul_period ( zsl_real_t  l,
zsl_real_t t 
)

Calculates an approximation of the period of a simple pendulum with small oscilations, based on its length (l).

Parameters
lLenght of the pendulum in meters.
tPointer to the output period in seconds. Will be set to NAN if the lenght is negative.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_dyn_tension()

int zsl_phy_dyn_tension ( zsl_real_t  m,
zsl_real_t  a,
zsl_real_t t 
)

Calculates the tension in newtons of a massless tensed rope with a moving object.

Parameters
mMass of the object in kilograms.
aAcceleration of the object in the direction of the rope in meters per second squared.
tPointer to the output tension in newtons. Will be set to NAN if the mass of the object is negative.
Returns
0 if everything executed properly, error code on failure.