Quote Originally Posted by SilverWarior View Post
Based on the code it seems you are only applying force to [j] particle and not to [i] particle at the same time.
Haven't you been calculating force between two particle once and then applying that force to both of your particles at once?
If i set NUM_TOTAL = 2; and 2 opposite particles, they start pushing eachother away in opposite direction, as should. Same code as before, i just commented Z-related lines. "with star[i] do" on second quoted line refers to "i" particle.

I didn't do the math before, i was thinking it might still be relatively same effect.

sqrt(4)*sqrt(4)*sqrt(4)
= 2*2*2 = 8

= sqrt(4*4*4)
= sqrt(64) = 8

X/Sqrt(Y)
= (X*X)/Y , if Y>=0