INNER CODE UNIT · Python
calculate_individual_source
MatthewFilipovich/pycharge · src/pycharge/potentials_and_fields.py:129
def calculate_individual_source(
r_src: Array, v_src: Array, a_src: Array, q: Array, r: Array
) -> Quantities:
R = jnp.linalg.norm(r - r_src) # Distance from source to observation point
n = (r - r_src) / R # Unit vector from source to observation
β = v_src / c # Velocity normalized to speed of light
β̇ = a_src / c # Acceleration normalized to speed of light
one_minus_β_dot_β = 1 - jnp.dot(β, β)
one_minus_n_dot_β = 1 - jnp.dot(n, β)
one_minus_n_dot_β_cubed = one_minus_n_dot_β**3
n_minus_β = n - β
coeff = q / (4 * pi * epsilon_0) # Common coefficient
# Potentials
φ = coeff / (one_minus_n_dot_β * R)
A = β * φ / c
# Fields