Skip to main content

magnetic_force_on_charge

Function magnetic_force_on_charge 

Source
pub fn magnetic_force_on_charge(
    charge: f64,
    velocity: f64,
    magnetic_flux_density: f64,
    angle_radians: f64,
) -> Option<f64>
Expand description

Computes magnetic force on a moving charge.

Formula: F = q * v * B * sin(theta)

The sign is preserved from the scalar inputs and angle convention.

ยงExamples

use std::f64::consts::FRAC_PI_2;

use use_magnetism::magnetic_force_on_charge;

assert_eq!(magnetic_force_on_charge(1.0, 2.0, 3.0, FRAC_PI_2), Some(6.0));