pub fn doppler_effect_kernel(
freq_source: &Frequency,
wave_speed: &Speed,
obs_speed: &Speed,
src_speed: &Speed,
) -> Result<Frequency, PhysicsError>Expand description
Calculates the observed frequency due to the Doppler effect for longitudinal motion.
This kernel assumes the “Approaching” scenario where source and observer move towards each other.
For receding motion, one might intuitively negate the speeds, but since Speed is non-negative,
a separate function or directional flag would be safer. This implementation strictly valid
for the Approaching case:
- Observer moving towards source (+vo)
- Source moving towards observer (-vs in denominator)
Formula: $f_{obs} = f_{src} \frac{v + v_o}{v - v_s}$
§Arguments
freq_source- Frequency emitted by the source.wave_speed- Speed of the wave in the medium ($v$).obs_speed- Speed of the observer relative to the medium ($v_o$).src_speed- Speed of the source relative to the medium ($v_s$).
§Errors
PhysicsError::MetricSingularity- If $v_s \ge v$, causing a sonic boom (denominator zero or negative).