Electric functions.
More...
|
file | electric.h |
| API header file for electrics in zscilib.
|
|
|
int | zsl_phy_elec_charge_dens (zsl_real_t q, zsl_real_t v, zsl_real_t *d) |
| Calculates the uniform charge density of an charged body based on its charge and its volume. More...
|
|
int | zsl_phy_elec_force (zsl_real_t q1, zsl_real_t q2, zsl_real_t r, zsl_real_t *f) |
| Calculates the electric force in newtons between two charged bodies based on their charges and the distance between them. More...
|
|
int | zsl_phy_elec_force2 (zsl_real_t q, zsl_real_t e, zsl_real_t *f) |
| Calculates the electric force in newtons that a charged body experiences when it enters an electric field. More...
|
|
int | zsl_phy_elec_field (zsl_real_t q, zsl_real_t r, zsl_real_t *e) |
| Calculates the electric field created by a charged body anywhere in space. More...
|
|
int | zsl_phy_elec_pot_ener (zsl_real_t q1, zsl_real_t q2, zsl_real_t r, zsl_real_t *u) |
| Calculates the electric potential energy in joules of two charged bodies based on their charges and the distance between them. More...
|
|
int | zsl_phy_elec_potential (zsl_real_t q, zsl_real_t r, zsl_real_t *v) |
| Calculates the Coulomb's potential of a charged body anywhere in space. More...
|
|
int | zsl_phy_elec_flux (zsl_real_t e, zsl_real_t a, zsl_real_t theta, zsl_real_t *fl) |
| Calculates the electric flux that flows across a surface based on the area (a), the electric field (b) and the angle they form. More...
|
|
Electric functions.
◆ zsl_phy_elec_charge_dens()
Calculates the uniform charge density of an charged body based on its charge and its volume.
- Parameters
-
q | Charge of the body in coulombs. |
v | Volume of the body in meters cubed. |
d | Pointer to the output uniform charge density in coulombs per meter cubed. Will be set to NAN if the volume is negative or zero. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_elec_field()
Calculates the electric field created by a charged body anywhere in space.
- Parameters
-
q | Charge of the body in coulombs. |
r | Distance to the body in meters. |
e | Pointer to the output electric field in newtons per coulomb. Will be set to NAN if the distance is negative or zero. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_elec_flux()
Calculates the electric flux that flows across a surface based on the area (a), the electric field (b) and the angle they form.
- Parameters
-
e | Module of the electric field vector in newtons per coulomb. |
a | Surface in meters squared. |
theta | Angle between the vector normal to the surface and the electric field vector in radians. |
fl | Pointer to the output electric flux in newtons and meters squared per coulomb. Will be set to NAN if the area or the electric field are negative values. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_elec_force()
Calculates the electric force in newtons between two charged bodies based on their charges and the distance between them.
- Parameters
-
q1 | Charge of the first body in coulombs. |
q2 | Charge of the second body in coulombs. |
r | Distance between the two bodies. |
f | Pointer to the output electric force in newtons. Will be set to NAN if the distance is negative or zero. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_elec_force2()
Calculates the electric force in newtons that a charged body experiences when it enters an electric field.
- Parameters
-
q | Charge of the body in coulombs. |
e | Electric field in newtons per coulomb. |
f | Pointer to the output electric force in newtons. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_elec_pot_ener()
Calculates the electric potential energy in joules of two charged bodies based on their charges and the distance between them.
- Parameters
-
q1 | Charge of the first body in coulombs. |
q2 | Charge of the second body in coulombs. |
r | Distance between the two bodies. |
u | Pointer to the output potential energy in joules. Will be set to NAN if the distance is negative or zero. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_elec_potential()
Calculates the Coulomb's potential of a charged body anywhere in space.
- Parameters
-
q | Charge of the body in coulombs. |
r | Distance to the body in meters. |
v | Pointer to the output potential in volts. Will be set to NAN if the distance is negative or zero. |
- Returns
- 0 if everything executed properly, error code on failure.