A many-body model stores one state record per body and derives system-level quantities by reducing across the collection. The important question is which bodies and forces belong inside the boundary.
Change the right-hand mass. The center moves toward it, but always remains between the two bodies.
Left mass 1 kg at 0 m; right mass 3 kg at 8 m; center of mass 6.00 m.
Give every body an immutable record such as mass, position, velocity, force accumulator, and optional radius or identity. An update starts by zeroing fresh force accumulators, visits each unordered pair once, adds equal and opposite internal forces, then advances every body from the completed force array. Do not move body A before calculating A–B and then calculate B–A from mixed old and new states.
The centre of mass is a reduction:
\[\mathbf R_{\mathrm{cm}}=\frac{\sum_i m_i\mathbf r_i}{\sum_i m_i}, \qquad \mathbf P=\sum_i m_i\mathbf v_i.\]It is a derived result, not another particle that receives pair forces. The same separation applies to total momentum, kinetic energy, potential energy, and angular momentum. State the system boundary before reducing: a thermostat, a wall, a rocket exhaust, or an external field can legitimately change a total.
For pairwise interactions, loop over each unordered pair once. Accumulate the force on both bodies in that single visit and retain enough information to inspect the pair distance, cutoff decision, and any softening policy. The work grows with the square of body count, so record body count, pair count, step time, and the approximation used when scaling beyond a teaching-sized system.
Test an isolated two-body fixture: pair forces cancel, total momentum stays constant within tolerance, and centre of mass moves at constant velocity. A translation of every initial position should translate the centre of mass without changing relative motion. Reordering input records should not change the physical result beyond documented floating-point summation differences. Compare a fixed physical duration at smaller time steps, and distinguish a bounded physical oscillation from a growing numerical invariant residual.
For collisions, decide whether they are resolved as impulses, soft potentials, or excluded. For long-range gravity or electrostatics, document singularity handling and whether the visualizer clamps arrows independently of the solver. A blue Three.js view can help expose spatial structure, but it should consume saved solver state and expose a text fallback; it is not the evidence for conservation.
Prediction: Increasing one body's mass shifts the system center without moving either input position.
Change the right mass. Then describe which additional array field you would need before calculating total momentum.Keep many-body state in a clear array structure. Compute each unordered pair from one time level, derive global totals in separate reductions, and use isolated fixtures, invariant logs, and refinement before interpreting conservation.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Many-Body Systems, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Momentum and Collisions, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Many-Body Systems as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Model a collection of bodies with shared totals such as momentum and center of mass, then define the system boundary clearly.