Creating Gravity
2018-03-25
There is a beauty of physics in the world of computers and mathematics in that you don’t have to ground yourself in the actual physical world. You can just make up the laws and watch events unfold. Here are the rules of my two dimensional world which has a slight resemblance to the real world. This is a pure experiment in modelling physics and a practice in programming for me so don’t take it too seriously.
Two particles can exist in the same location. There exists a gravitational field inside of a radius starting from the origin of each particle and reaching beyond its circumference. Each particle exerts a force proportional to its area on other particles within its gravitational field. The force acting on a particle is proportional to its distance to the particle which exerts the force. An objects acceleration equals the force asserted divided by the area of the particle. Oh, and they bounce of walls. This is a mouthful to explain in pure English, and it also lacks the precision which mathematical notation can provide. The behavior can be explained concisely and precisely with the three equations. Actually, only one equation is necessary, but we need to build up to it with the first two.(2) Second, the particle distance equation. As the name implies it measures the distance between two particles. Here we make use of Pythagoras theorem since the distance between two particles in a two-dimensional space is the hypothenuse connecting those points in a right-handed triangle.

(2) Second, the particle distance equation. As the name implies it measures the distance between two particles. Here we make use of Pythagoras theorem since the distance between two particles in a two-dimensional space is the hypothenuse connecting those points in a right-handed triangle.

(3) Finally, the equation which govern all behavior. Here we can solve for the acceleration of a particle (p1) as a result of a particle (p2) exerting its force within its gravitation field. The force is proportional to the distance between the two particles. ‘G’ represents the distance which a particle exerts its gravitational field. The distance of the gravitational field is defined as four times the radius plus a constant 'b' or '4r + b'. The force which it takes to accelerate a particle (p1) is proportional to its area, the bigger the area the more difficult the particle is to move.

And voila, solve this equation for each particle in relation to every other particle which exerts force through their gravitational field, update particle positions for every step in time and the rich particle behavior which you see above will emerge. It is interesting to experiment with the math behind the simulation and watch the different kinds of behavior emerge. Many decisions made were completely arbitrary, only ever coming into existence because of my aesthetic preference, but that is the beauty of it.