From 4a31fc1a7dbc30124df55f84937826074ff23598 Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Sat, 7 Oct 2023 21:44:36 -0400 Subject: [PATCH] Clarify variable name --- physics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/physics.py b/physics.py index 232520c..a47e5cd 100644 --- a/physics.py +++ b/physics.py @@ -47,10 +47,10 @@ def n_body_matrix_constrained(pos: np.ndarray, vel: np.ndarray, mass: np.ndarray dist[i - 1] = pos2[i: i + len(pos)] - pos rot_mass[i - 1] = mass2[i: i + len(mass)] - a = np.linalg.norm(dist, axis=2) - a[a < close] = close + norms = np.linalg.norm(dist, axis=2) + norms[norms < close] = close vel += G * np.sum( - dist * rot_mass / (a ** 3)[:, :, np.newaxis], + dist * rot_mass / (norms ** 3)[:, :, np.newaxis], axis=0 )