Dynamics functions.
More...
|
| file | dynamics.h |
| | API header file for dynamics in zscilib.
|
| |
|
| 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...
|
| |
Dynamics functions.
◆ zsl_phy_dyn_fric()
Calculates the friction force experienced by a body moving in a surface with a friction coefficient 'mu'.
- Parameters
-
| n | Normal force that the surface exerts to the body, in newtons. |
| mu | Friction coefficient, that ranges from zero to one. |
| f | Pointer 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()
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
-
| d1 | Distance between the fulcrum and the first end of the lever. |
| f1 | Force applied to the firts end of the lever in newtons. |
| d2 | Distance between the fulcrum and the second end of the lever. |
| f2 | Pointer 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()
Calculates the force in newtons that experiences a body based on its mass (m) and acceleration (accel).
- Parameters
-
| m | Mass of the body in kilograms. |
| accel | Acceleration in meters per second squared. |
| f | Pointer 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()
Calculates the normal force in newtons exerted by plane inclined 'theta' radians on a body of mass 'm'.
- Parameters
-
| m | Mass of the body in kilograms. |
| theta | Angle of inclination in radians. |
| n | Pointer 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()
Calculates the maximum speed in meters per second of a simple pendulum based on its length (l) and initial angle (oi).
- Parameters
-
| l | Lenght of the pendulum in meters. |
| oi | Initial angle in radians. |
| vmax | Pointer 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()
Calculates an approximation of the period of a simple pendulum with small oscilations, based on its length (l).
- Parameters
-
| l | Lenght of the pendulum in meters. |
| t | Pointer 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()
Calculates the tension in newtons of a massless tensed rope with a moving object.
- Parameters
-
| m | Mass of the object in kilograms. |
| a | Acceleration of the object in the direction of the rope in meters per second squared. |
| t | Pointer 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.