Gravity assigns an acceleration vector to every point in space around a mass. The direction points inward; its magnitude falls with distance squared.
Loading the interactive visual. The lesson text and model remain available while it starts.
The input is a displacement from source to probe, not an arbitrary screen coordinate. For a point source at the origin, compute (r^2=x^2+y^2+z^2), reject or explicitly soften the singular case, and return the vector:
\[\mathbf a(\mathbf r)=-\mu\frac{\mathbf r}{(r^2+\varepsilon^2)^{3/2}}.\]With (\varepsilon=0), this is the ideal inverse-square point-mass field away from the origin. A positive softening length is a numerical model change: it bounds close encounters and must be recorded with the result. Do not hide that policy only in a renderer’s arrow-length clamp.
Make the field function pure and use it in both a particle update and the vector sampler. The sampler has separate decisions: plane, extent, grid spacing, source location, arrow normalization, colour scale, and the mask around the singularity. A Three.js field can use the site’s main blue palette, but each probe should also expose direction and magnitude in text so the explanation survives disabled WebGL.
Use analytic fixtures: at ((r,0,0)) acceleration has only a negative x component; opposite points have opposite vectors; equal radii have equal magnitudes; doubling radius quarters the ideal magnitude; and superposing two sources equals the sum of their separate accelerations. Test the field first, then test an orbit with a known initial condition while logging energy and angular momentum at fixed physical times.
Keep units explicit: (\mu=GM) has units of length cubed per time squared, so the output must be acceleration. The field assumes a fixed point source and instantaneous Newtonian interaction. An extended, moving, relativistic, or many-source system needs a different source model and a stated integration/refinement study.
Prediction: Doubling radius reduces field magnitude to one quarter.
Compare two probe distances. Which part of the implementation prevents a division-by-zero crash at the center?Represent gravity as one reusable, singularity-aware inward vector function. Separate solver physics from blue visual sampling, verify symmetry and units analytically, then use fixed-time invariants and refinement for motion.
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 Gravitational Fields as Vector Fields, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Gravitation, 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 Gravitational Fields as Vector Fields 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.
Implement gravity as a reusable inverse-square acceleration vector field.