In my n-body simulation I would like to color the particles in way which corresponds to the magnitude of the net force acting on them.
This is so that I can confirm visually that the particles closer to the center of a galaxy have higher accelerations (so for example particles near the rim of a galaxy are lighter colored, and the core is red).
Let P be a particle. If F is the magntitude of the net force acting on P, the idea is to calculate s=F/F_max where F_max is the maximum possible force between two particles (which exists since my simulation uses gravitational softening). Since s is a number between 0 and 1, I can associate to P an HSV color by fixing saturation and value, and setting hue=s.
The issue: because the gravitational force scales as 1/r^2 the mapping of F to s is not linear. The result is that, when their are few particles (N<50), the color of a particle seem to change only if it becomes locked in a binary (in a bound system of two particles which are very close to eachother). The binaries are easy to identify because they blink (default color when they are at maximal distance, another color when they are at minimal distance).
For N=10,000 the result is pretty at least, but I'm not sure how realistic it is.
So how should I map the force to a color in a realistic way? My goal would be to get something more like this: