Gravity and how the Heliocentric Model works

Wednesday, September 5, 2018 - 01:30 | Author: wabis | Topics: Simulation, Interactive, Space, Physics | Comments(6)
In the coordinate system of the sun, the moon tracks a weird path, sometimes speeding up, sometimes slowing down. At the nearer side to the sun the moon gets attracted more by the sun than at the further side. The sun is much bigger than the earth and its attracting force is bigger than that of the earth. So why is it that the moon does not left earth's orbit and crash into the sun? I give the detailed explanation in this article, which includes an interactive simulation.

Link to here: walter.bislins.ch/Helio

Simulation of the Solar System

The model is a scaled down numerical simulation of 3 bodies (sun, earth, moon), obeying only Newton's law of universal gravitation and Newton's laws of motion. The simulation shows, that stable orbits can exist in the Heliocentric Model. You can change parameters of the simulated solar system and disable some forces to study the consequences.

Restart Stop Moon-Sun off Earth-Sun off Sun off Reset

Parameters and Buttons

The big gray circle around the earth is the Hill Sphere. It defines the range where stable orbits around the earth are possible. As long as the moon orbits within the light gray circle with the thick border, the orbit is stable. Outside this circle the orbit is instable and the moon may be lost in space or captured by the sun.

The other cicles show the initial orbits of earth and moon. You can disable all circles by disabling Show Orbits Checkbox.

Restart Button
Restart the simulation with the current parameters.
Stop/Continue Button
Stops the simulation or continues the simulation without changing anything. You may also click into the graphic to stop or continue the simulation.
Moon-Sun off/on Button
switches the force between moon and sun on or off. If you switch off the force the moon is only held by earth's gravity. This results commonly in loosing the moon and changing the orbit of the earth.
Earth-Sun off/on Button
switches the force between earth and sun on or off. If you swich off the force, the earth flies away from the sun. The moon tries to follow, sometime crashing into the earth, sometimes breaking free from the earth and entering an orbit around the sun.
Sun off Button
switches the sun off or on. If the sun is switched off, earth and moon fly away tangentially. The moon keeps its orbit around the earth.
Reset Button
Sets all parameters to their default values.
Time Slider
slows down or speeds up the simulation. If you choose a to high value, depending on your computer power, the simulation may not be able to keep up the frame rate and loose some frames. The precision of the simulation is not affected by that. Note: the Time slider snaps to the value 1 if you come close to it.
Arrows Slider
scales the force or acceleration arrows. Note, the lengths of the arrows are not proportional to the force/acceleration magnitudes. The forces are scaled by a function x1/3 and the accelerations are scaled by x in addition to the slider value to make them more even in length, because their magnitude differs very much. But if an arrow's length is longer than another, it's force/acceleration is stronger than the other. You can choose ArrorType = off to hide the arrows.
CoordSys Selection
chooses a coordinate system which gets centered in the display. The Galaxy coordinate system will not be centered in the display but rather the display follows the center of the solar system with the grid fixed to the Galaxy system.
Note: the trails are always drawn relative to the choosen coordinate system. They show how the objects appear to move as seen from an observer in that system.
Show Selection
turns on/off some items on the screen.
Orbits shows the initial orbits of earth and moon. The orbits can change over time, but the shown orbit cirles keep their size and position as a reference.
CM shows the center of masses between Earth and Moon (black cross), sun and earth (blue cross) and from the whole solar system (red crosshair).
Speeds displays the speeds of the bodies relative to a chooses coordinate system. The choosen system is stated above the speeds.
ArrowType Selection
chooses wheter the force or acceleration vectors are displayed.
Arrow Selection
Single shows the singe components of the forces or accelerations due to each other body.
Sum shows the effective sum of the forces or accelerations which controls the bodies movements.
All shows the sum and the individual components together. Note: the green force vectors and the red acceleration vectors are the vectorial sum of the individual vectors.
DSunEarth, DEarthMoon Field
Distance between the 2 bodies in pixels. The distances together with the orbital periods determine the masses and sizes of the bodies, see How the Simulations works.
TEarth, TMoon Field
Orbital period in seconds. If the period of the moon is in the same magnitude as the period of the sun, the moon can be ejected into space, because the gravity of the earth gets too low to hold it.
Note: The mass and hence the gravitational attraction is calculated from the distances D and periods T, see How the Simulations works. Some combinations result in too low mass for the earth to hold the moon.
CMEarthMoon Field
Location of the common Center of Mass (CM) between earth and moon in % of the distance between earth and moon as measured from the earth. This value determines the masses of earth and moon. The CM for the real earth-moon system is at about 1%.

Simulation or Animation?

The App on this page is a Simulation, not an Animation. An animation is a predetermined programmed sequence of movements, following explicit steps or certain formulas that describe the motions.

A simulation is not predetermined. It follows physical laws. The motions are generally not predictable in detail and depend on start conditions and interactions with the user.

This simulation uses Newton's laws of universal gravitation and the laws of motion. The shown trajectories and orbits are the result of this natural laws, implemented in a computer program. The simulations shows what would happen in reality given the same parameters.

 See How the Simulations works

So if this simulation can produce stable orbits obeying Newton's laws, then such orbits are possible in reality too.

Role of the Observer

From an observer stationary with respect to the sun we can see that the moon traces a weird epicyclic path: Sometimes he is taking over the earth on the far side of the sun, gets nearer to the sun, seems to come to a halt and the suddenly gets accelerated to catch up with the earth again:

Moons epicycles as seen by an observer stationary with respect to the sun

Show Simulation of Moon's Epicycles

Even weirder is the corkscrew path of earth and moon as seen from an observer stationary with respect to the galaxy:

Corkscrew path of earth and moon as seen from an observer in rest with respect to the galaxy

Show Simulation of Corkscrew Path

How is it possible that the apparent path of the bodies depend on the observer? How is it possible, that the orbits are stable despite the observation that they trace weird paths depending on the observer?

To answer this question, ask yourself the following: How does an observer influence the motion (positions and velocities) of objects which he does not affect by exerting a force on them, only by looking at them?

The answer is: The motions of observed objects are not affected by a pure observer at all. The traces of moving objects are illusions caused by the relative motion of the observer with respect to the observed objects. The traces are only pictures emerging from plotting past relative positions of objects in the coordinate system of the observer. So each observer sees their own traces, but no observer has any influence on positions, velocities or any other physical properties of the objects, as described in Relativity of Positions and Velocities.

How do Orbits work?

To get a deeper inside into orbital mechanics, we need to understand some basic properties of the universe and their implications on motion in general and on orbits in particular. Here I start with a rough description of how orbits work. Read Basic Properties of the Universe to get a deeper understanding.

Gravity, Inertia, Conservation of Energy and tangential velocity are the ingredients that keep planets and moons in their orbits.

The attractive force between two bodies creates an acceleration that is directed from one body to the other. If both bodies were initially at rest with respect to each other, this would result in the bodies getting closer until they collide. But if the bodies have relative velocities that are not in the direction of the acceleration, they constantly miss each other. Because there is no friction in space slowing things down the bodies keep orbiting each other around a common center of mass, called the Barycenter.

If one body is much more massive than the other, the barycenter lies near the center of the heavier body, so the less massive body practically orbits the heavier body, while the heavy body seams to stay rather stationary, only wiggles slowly around the barycenter.

Orbits are generally not perfect circles but ellipses. Only if the velocitiy is always exactly at 90° to the acceleration vector and the magnitude has exactly a certain value then the orbit is a perfect circle. Although the orbits of the planets and moons in the solar system are all slightly elliptical, the deviation from a perfect circle is barely noticable.

On elliptical orbits the distance between two bodies and the speed of the orbiting body constantly changes, which means that the forces/accelerations between the bodies are constantly changing too. How can such orbits be stable?

This has to do with Symmetries and Conservation Laws, which are Basic Properties of the Universe.

In orbits (circular and elliptic), the total energy = sum of potential and kinetic energy at each point of the orbit is constant = conserved. It is not dependent on the excentricity of the orbit. This is also a consequence of the inverse square law of Gravity. The inverse square law on the other hand is a consequence of the universe being 3-dimensional. All this enables stable elliptical orbits.

In the simulation the darker gray circle around the earth shows the range of the so called Hill Sphere. Orbits inside 1/2 (lighter gray circle) to 1/3 of this sphere are stable. Greater orbits are instable due to the influence of the sun or other big planets. Bodies outside of the Hill sphere can not orbit the earth.

If the Hill sphere lies inside a body, then there are no orbits possible around the body. For example the Hill sphere of the ISS lies inside the hull of the ISS, so an astronaut outside can not orbit the station although he gets attracted to it.

The Barycenter of the Solar System

ZoomMoving Barycenter of the solar system

One consequence of the fact, that all masses in the solar system attract each other, is, that the earth and the other planets do not orbit around the center of the sun, but all planets and the sun orbit around the common center of mass, called the Barycenter.

The barycenter of two bodies lies on the line connecting the center of the two bodies and is nearer the body with the greater mass. In our solar system the barycenter of the sun and all planets makes complicated figures and lies sometimes inside the sun, sometimes outside.

So with respect to the common center of mass of the solar system the sun makes very slow complicated movements.

In the simulation it can be observed, that the sun revolves around a center that is not the center of the sun. Select the option Show CM to show the center of masses. The barycenter of the whole system is indicated by the red crosshair.

The barycenter of earth and moon lies also not at the center of the earth (black cross). The Earth-Moon systems barycenter revolves around the sun on the orange orbit. Earth and moon revolve around this barycenter on their orbit. This feature of the simulation can be observed in reality.

Show Simulation of Barycenters

Why does the Moon not get caught by the Sun?

Now that we understand how the paths of objects are an illusion created by the observer and the observer has no effect on the motion of the objects, we can analyze the paths without having an observer to take into account.


To determine the trajectory of the moon we have to determine all forces acting on the moon all the times.

In the solar system all bodies exert a force on each other due to Gravity. Because the force gets much weaker as further away a body is (proportional to one over distance squared), only the force of the earth and the sun are relevant to the motion of the moon. Although the sun is very far away from the moon compared to the earth, its influence can not be neglegted, because the sun has an enormous mass.

More than 99.8% of the mass of the whole solar system is concentrated in the sun. In fact the attracting force on the moon is more than twice as strong as the attracting force of the earth on the moon. See Hill Sphere for an explanation why the moon orbits the earth anyway.

Lets explore the forces between sun, earth and moon. Because the earth has a bigger mass than the moon, the attraction force between sun and earth is greater than the attraction force between the sun and moon. The attraction force between earth and moon is the same for both, according to Newton's third law of motion.

This may be surprising. It implies that you are attracting the earth with the same force as the earth is attracting you. But because acceleration is also dependent on the mass of the attracted object, the movement of the earth caused by you attracting it is not perceivable, but not zero!

To be specific: The earth has roughly 1023 times more mass than a human, so the earth's displacement caused by you attracting it is 1023 times smaller than the displacement of you caused by earth's attraction. Nowadays we can measure the change in earths rotation rate due to the displacement of large masses, like when we empty a big artificial lake.

But back to the forces between sun, earth and moon. You can visualize the forces in the simulation:

ZoomForces acting between sun, earth and moon

Show Forces

Note that the forces between earth and moon are equal but opposite. The moon is attracting the earth with the same force as the earth is attracting the moon (Newton's third law).

Accelerations of earth and moon

Show Accelerations

Note that the acceleration of the moon and earth caused by the sun are almost the same. So they both orbit the sun at about the same path, because their mean speed around the sun is the same too.

In the left image above you see the individual force components. The total force on a body is the vector sum of the force components acting on the body. By showing the individual force components, it is easier to see what's going on.


Notice, that the attraction force sun/earth is greater than the attraction force sun/moon. You may ask, how can the moon follow a nearly circular orbit around the earth, if earth and moon are not attracted with the same force to the sun? Sould not the earth get caught by the sun or the moon get lost into space?

This is not the case. It has to do with the fact that not the force is responsible for the motion of objects, but the resulting acceleration. The acceleration is not only dependent on the force, but depends on the mass of the object too: a = F / m. So if we look at the components of the acceleration in the right image above, we notice that the acceleration in direction to the sun is the same for earth and moon! So the sun accelerates earth and moon with the same amount towards it.

This may be surprising. But on the earth we can observer the same phenomenon: each mass is accelerated exactly the same amount to the center of the earth, no matter how much mass an object has. This also applies to space. If two objects are the same distance to the sun, they get attracted to the sun with the same acceleration. So the whole earth/moon system orbits the sun on the same track.

Strictly speaking, this is not quite right. The orbit of the moon is not always exactly at the same distance to the sun. So the attraction between sun and moon changes constantly. But as long as the attraction between sun and moon does not vary a lot with respect to the mean attraction, the orbit of the moon around the earth is not disturbed much by the sun. This is the case if the distance between the earth/moon system and sun is much greater than the distance between earth and moon, so that the moon lies well inside the Hill Sphere, which is the case in reality.

Acceleration in the real Solar System

Lets calculate the accelerations in the real solar system:

Sun accelerating Earth 0.00593 m/s2
Sun accelerating Moon (0.00593 ± 0.00003) m/s2
Earth accelerating Moon 0.00270 m/s2
Moon accelerating Earth 0.0000332 m/s2

We can see that the sun is accelerating earth and moon the same amount, so earth and moon orbit the sun together. But surprisingly the sun is accelerating the moon about twice as much as the earth is accelerating the moon. Why does the moon not get accelerated away from the earth?

Hill Sphere

To answer this we have to calculate the range around the earth in which the influence of the earth on any satellite like the moon is greater than the sun. This range is a sphere around the earth which radius is the distance from the center of the earth to the Lagrangian Points L1 and L2. This sphere is called Hill sphere. As long as a satellite stays within this sphere it keeps orbiting the earth.

The radius of the Hill sphere for the earth is:

' =' 'radius of the Hill sphere of the earth
' =' '150,000,000 km = distance between sun and earth
' =' '5.97 × 1024 kg = mass of the earth
' =' '1.99 × 1030 kg = mass of the sun

Detailed numerical calculations show that orbits at or just within the Hill sphere are not stable in the long term; it appears that stable satellite orbits exist only inside 1/2 to 1/3 of the Hill radius (Source Wikipedia: Hill sphere). The distance between earth and moon is with 384,000 km smaller than 1/3 of the Hill sphere radius, so it's orbit is stable.

In the simulation the Hill sphere around the earth is displayed in light grey. You can simulate a solar system where the acceleration of the moon from the sun is bigger than the acceleration of the moon from the earth maintaining a stable orbit by clicking the following button:

Show stable orbit withing the Hill sphere

Playing with Gravity

In the simulation, using the blue buttons, you can deactivate the attraction between sun, earth and moon to simulate what happens. Try to disable one force only for a very short time to disturb the orbits. There are three possibles outcomes of such disturbances:

  1. the moon or the earth/moon system get captured by the sun again but now follow an elliptical orbit
  2. the moon my get captured by the sun if its orbit leaves the Hill Sphere
  3. the moon or the earth/moon system escape the solar system

Try and disable some Forces

Why can't we feel motion?

This has 3 reasons:

  1. Uniform, non-accelerated motion of a system is not detectable in the system itself.
  2. The human body gets used to uniform forces and can not feel constant accelerations below a certain level.
  3. Changes in accelerations below a certain magnitude or rate can not be felt by the human body.

Uniform motion

Because of the Relativity of Positions and Velocities, which states that there is no such thing as absolute position and velocity, it follows, that in all systems that are not accelerated, the physical laws are not dependent on the motion of the system with respect to anything. Therefore there is no way to measure or feel any motion in a non-accelerated system. There is no physical effect that is caused by uniform motion.

Because the impression of motion is caused by forces acting on a person and there are no forces caused by uniform motion, you can not feel uniform motion. The impression of motion can be caused by vibrations or accelerations of the vehicle. The impression of motion can also be caused by looking at objects which are moving relative to the observer. Without such a reference this impression vanishes.

Accelerations due to Rotation and Orbits

Is a rotating planet orbiting a sun a non-accelerated system?

No, orbits are accelerated motions and an object on the surface of a rotating body is in an accelerated state too. Acceleration can be measured with accelerometers. Rotations can be measured eg. with ring LASER Gyros.

So why can't we feel the accelerations due to rotation of the earth and the moon orbiting the earth and the orbit of the earth around the sun?

The tidal acceleration from the moon, the tidal part from the sun and the centrifugal acceleration due to earths rotation are too small to be noticed by the human body. But they can be measured.

The acceleration from the sun's gravity can not be measured on earth (except the tidal part), because everything on earth is accelerated the same amount by the sun. We call this free fall around the sun.

If you don't have any difference in acceleration between objects, you can't measure or feel an acceleration.

So in a rocket orbiting the earth, you are in free fall on a curved = accelerated path around the earth. Although there is still gravitational acceleration acting on you, it is also acting on everything around you the same amount. So all objects are orbiting exactly on the same track together. There is no relative acceleration between you, the rocket and anything else in the rocket. All is freely floating inside the rocket and you feel weightless.

But there are still the very small attractions between all objects and very small tidal effects from earth, moon and sun. That's the reason why we speak of micro gravity environment instead of zero gravity. Gravity acts berween all objects, not only between earth and other objects.

Tidal forces arise because no gravitational field is homogeneous, but they are radial symmetric and point to a center of mass and the magnitude decreases with the square of the distance from the center of mass. This results in very slightly different gravitational accelerations in different directions. A sphere of small objects starts to be elongated in the direction of the center of mass and to be squashed perpendicular to that direction. Two tidal bulges appear like the tides on earth.

To be specific, the accelerations are:

' =' 'earth's gravitational acceleration (mean value)
' =' '6.674 × 10−11 m3/(kg·s2) = gravitational constant
' =' '5.97 × 1024 kg = mass of the earth
' =' '6371 km = radius of the earth
' =' 'centrifugal acceleration at the equator due to earth's rotation
' =' '2·π/Trot = 7.27 × 10−5 s−1 = angular speed of earth's rotation
' =' '24·3600 s = rotation period (1 day)
' =' '6371 km = radius of the earth

So a 100 kg weight measured at the poles would weigh 340 g less at the equator.

' =' 'maximal acceleration due to moons gravity in direction to the moon
' =' '6.674 × 10−11 m3/(kg·s2) = gravitational constant
' =' '7.34 × 1022 kg = mass of the moon
' =' '384,400 km = distance from earth to moon
' =' '6371 km = radius of the earth
' =' 'maximal acceleration due to sun's gravity in direction to the sun
' =' '6.674 × 10−11 m3/(kg·s2) = gravitational constant
' =' '1.99 × 1030 kg = mass of the sun
' =' '150,000,000 km = distance from earth to sun
' =' '6371 km = radius of the earth

Basic Properties of the Universe

To understand orbital mechanics, we need to understand some basic properties of the universe and their implications on motion in general and on orbits specifically. All motions of gravitationally bound objects obey the following basic observable properties of the universe:

Symmetries and Conservation Laws

Note: it is not nessesary that you understand what Noether's theorem is, only the physical consequences due to observable properties of the universe are important here.

Noether's theorem states that every differentiable symmetry of the action of a physical system has a corresponding conservation law. The theorem was proven by mathematician Emmy Noether in 1915 and published in 1918.

The action of a physical system is the integral over time of a Lagrangian function, from which the system's behavior can be determined by the principle of least action. The principle of least action can be used to obtain the equations of motion for a system.

Loosely speaking, symmetries in nature account for conservations laws like:

Place and Time Symmetry
If a physical process exhibits the same outcomes regardless of place or time, then its Lagrangian is symmetric under continuous translations in space and time respectively: by Noether's theorem, these symmetries account for the conservation of linear momentum and energy within this system, respectively.
Rotational Symmetry
If a physical system behaves the same regardless of how it is oriented in space, its Lagrangian is symmetric under continuous rotations: by Noerther's theorem, this symmetry accounts for the conservation of angular momentum of the system. The physical system itself need not be symmetric; a jagged asteroid tumbling in space conserves angular momentum despite its asymmetry. It is the laws of its motion that are symmetric.

Source: Wikipedia Noether's theorem

This symmetries of the universe are one reason why stable orbits can exist.

Relativity of Positions and Velocities

Position and velocity are not properties that can be assigned to a single object or system of objects. Position and velocity are relations between different objects or systems. There is no absolute reference point or center of the universe that would allow to assign an absolute position and velocity to an object or system.

You always have to measure position and velocity with respect to a certain observer or reference frame. An observer, moving relativ to another observer measures different positions and velocities of the same observed object or system.

The physical laws are the same at any point in the universe. Therefore there is no special point in the universe that is distinct from any other point, that we could call origin and use as an universal reference point. All positions and velocities are relative to a certain observer and the corresponding values are unique for this observer but different for any other observer.

Because we cannot assign any position or velocity to an object or system itself, no matter what position and velocity that system has with respect to any observer, it has no effect on the system itself whatsoever. You cannot measure a position or velocity or feel a velocity of a system itself, because it has no position and velocity assigned to itself. Position and velocity only exist in the context of relations between objects and observers and do not change the physics in the observed object or system.

This implies that we can choose an arbitrary non-accelerated point, observer or frame as our reference to describe the motion of an object or system of objects, but for all computations we have to use the same choosen observer or reference frame.

This is reflected in the simulation as you can choose between four observer coordinate systems CoordSys and it does not change the orbits of the bodies. It only changes the apparent paths of the bodies, as apparent paths are distinct for each observer.

The simulation uses for all calculations the galaxy as the non-accelerated reference frame, no matter which observer coordinate system is choosen. But any non-accelerated reference frame will do the same.

Absoluteness of Accelerations and Forces

Contrary to position and velocity, accelerations and forces are absolute and not relative to an observer. Each object can have an acceleration of its own due to forces acting on it independent of any observer. This means each observer measures the same acceleration of a certain object (the same change in velocity) and the same forces acting on that object. This includes an observer that is on the observed object itself at any moment in time.

So accelerations and forces that change the trajectory are local properties of an object or system that can be measured within the system itself without reference to something external. This is taken advantige of in Inertial Reference Units. It's the reason why we can feel accelerations respectively the corresponding forces, if they are greater than a certain threshold.

Accelerations and forces are related to each other according to Newton's second law of motion:

' =' 'one individual force i acting on the object of mass m
' =' 'mass of the object
' =' 'acceleration of the object

means, sum of all individual forces. The arrows above the symbols denote that the forces and the acceleration have a direction in 3D space. So you have to take the vector sum of all forces acting on an object. The acceleration has then the direction of the vector sum of all forces.

Why are accelerations and forces absolute local properties of an object while position and velocity are relative to an observer?

Acceleration is the rate of change of velocity with respect to time:

acceleration = change_in_velocity / change_in_time =

in the limit of an infinitesimal short time span. That is the time Derivative of velocity. This is denoted as follows:


This is spelled: vector a is the limit, as delta t goes to zero, of vector delta v over delta t.

Acceleration and velocity are vector quantities. At time t the velocity of an object relative to an observer is . At time the velocity is . So the change in velocity over the infinitesimal short time period is the difference between the velocity at time and the velocitiy at time t relative to a certain observer. Taking this difference cancels the relative velocities and between observers and observed object:

' =' 'acceleration
' =' 'relative velocity between observer and object at time t
' =' 'relative velocity at time
' =' 'change in velocity in the time span
' =' 'infinitesimal short time span

We can see that the relative velocities between observer and object fall out of the equation. Only the change in velocity is relevant for the acceleration. The change in velocity is the same for all observers, no matter what the velocities between the observers and object are.

This means every observer sees the same acceleration of an object, no matter what the relative velocity is between observer and object. This includes an observer at the object itself. Therefore it follows, that the acceleration is observable from within the object itself. Acceleration is a property that can be assigned to an object itself and is independent of an observer.

Because forces and accelerations are proportional to each other, forces, like accelerations, are not dependent on any non-accelerated observer or Inertial frame of reference.

Note that even if the speed remains constant, the direction of the velocity vector can change as the results of an applied force. So you can have accelerations or forces that do not change the speed, but the direction of motion. This is the case if the acceleration or force always acts perpendicular to the direction of motion like in circular orbits, where the acceleration/force is due to the gravitational attraction towards the central object.


Mass attracts Mass: This property of mass can be measured eg. with the Cavendish Experiment. The force between two masses is according to Newton's law of universal gravitation:

' =' 'magnitude of the force between the two bodies m1 and m2
' =' '6.674 × 10−11 N·m2/kg2 = gravitational constant
' =' 'attracting masses
' =' 'distance between the centers of the masses

According to Newton's third law body 1 attracts body 2 with the same force F as body 2 attracts body 1. The force vectors are pointing from one body to the other. For the vector form of this equation see Computing all Forces.

Laws of Motion

Now that we know how to compute all forces acting on an object due to gravity we can compute its acceleration, velocity and path.

Newton's laws of motion describe the connection between forces, accelerations, velocities and positions:

First law
In an inertial frame of reference (non-accelerated system), an object either remains at rest or continues to move at a constant velocity, unless acted upon by a force. The resistance of any physical object to any change in its position and state of motion is called Inertia.
Second law
In an inertial reference frame, the vector sum of the forces F on an object is equal to the mass m of that object multiplied by the acceleration a of the object: F = m·a (or solved for acceleration: a = F/m).
Third law
When one body exerts a force on a second body, the second body simultaneously exerts a force equal in magnitude and opposite in direction on the first body.

The second law is also called Equation of motion. If we know all forces acting on an object, we can calculate the acceleration of the object which determines the change in velocity and position in time. The connection between acceleration, velocity and position is described by the following differential equations (bear with me, I explain it below):

' =' 'velocity as a function of time
' =' 'position as a function of time
' =' 'means the derivative of with respect to time
' =' 'acceleration as a function of time
' =' 'means the derivative of with respect to time

This equations simply mean, that current velocity at any time t is nothing more than an infinitesimal small path traveled at that time divided by the time it takes to travel this path. This is the definition of velocity. The d stands for delta, that is a symbol for an infinitely small change of:

velocity = change_in_distance / change_in_time

The same applies to accelerations:

acceleration = change_in_velocity / change_in_time.

But we don't know the path of an object and it's velocity. That is what we want to calculate from the known acceleration. This can be achieved by integrating the differential equations above, so we get:

' =' 'initial velocity
' =' 'initial position

These are the foundations of classical mechanics and can be applied to any system of objects, as long as the speeds involved are much smaller than the speed of light and gravity is weak (eg. far from a neutron star or black hole).

The simulation uses Numerical Integration to compute velocity and position from acceleration.

How the Simulations works

The App divides the simulation in many tiny time steps of length Δt = 50 μs. For each time step the following algorithm is executed:

  1. Computing all forces acting on each body from the current positions of the bodies using Newton's law of gravitation
  2. Computing the acceleration of each body from the sum of the forces acting on it using Newtons second law of motion a = F / m
  3. Computing the change in velocity due to acceleration for each body
  4. Computing the new velocity by adding the change in velocity for each body
  5. Computing the change in position due to velocity for each body
  6. Computing the new position by adding the change in position for each body

This algorithm is repeatet over and over again and produces the shown orbits. The essential parts of the simulation code is explained in Simulation Code of Solar System Animation explained. The whole source code can be inspected in Source Code: Solar System Animation.

Computing all Forces

First the simulation computes the forces between all bodies according to Newton's law of universal gravitation. Given the positions and masses of two bodies i and j, the attractive force between them can be computed as follows:

' =' 'force of mass on mass in the direction from to
' =' '6.674 × 10−11 m3/(kg·s2) = Gravitational constant
' =' 'the two masses attracting each other
' =' 'distance between the two masses
' =' 'unit-vector pointing from position of mass to position of mass
' =' 'positions of the two masses

Note that the attraction force is a vector pointing from one mass to the other. According to Newton's fist law of motion the force pointing from object i to object j is the same in magnitude but in opposite direction as the force pointing from object j to object i:


The expression means: take the vector pointing from to and compute its length. So generally means the length of the vector . The length of a vector can be computed applying Pythagoras on its components :


For each of the 3 bodies we get 2 forces respectively. One force to each other body. Now we have to combine all forces acting on one body by vectorial addition to get the vector sum:


To add vectors, you simply add the corresponding components of the vectors to get a new vector. Note, the new vector of object i is pointing in another direction somewhere between the single vectors that are added.

Computing the Acceleration of each Body

Now each object has one single combined force acting on it. From Newton's second law of motion F = m·a we can compute the acceleration of each object due to the combined forces acting on it:

' =' 'acceleration vector of object i
' =' 'combined force acting on object i
' =' 'mass of object i

Note that the acceleration vector acts in the direction of the vectorial sum of all Forces acting on the object i.

Now we have the acceleration of each body and the direction in which the acceleration acts. How do we get from this the individual velocities and poisitions while the time is passing?

Computing the Velocity of each Body

To get the velocity for each object, we have to integrate the acceleration. This is mathematically expressed as follows:


Or we can get the change in velocity in the timespan :


Computing the Position of each Body

Similar we can calculate the position for each object at each time by integrating the velocity:


Or the change in the timespan is:


Numerical Integration

We can not integrate and algebraically for a 3 body system. So we have to use numerical algorithms. In principle we divide the motions into small chunks of time length . Then we compute for each time step from the known acceleration of each body the change in velocity and the change in position. We add the change in velocity to the current velocity and the change in position to the current position and get velocity and position for the next time step:


This steps are continuously repeatet for each time step and the objects are drawn at the calculated positions.

Note: the simulation uses a more sophisticated rule for the integration, that halves the error compared to the above method.

Problems of Numeric Simulations

Numeric simulations like this one have one big problem: small rounding errors accumulate by the integration process. In the case of this simulation it results in slowly decaying orbits, especially if the angular speed around an object gets big. To minimize the errors the simulation computes 20,000 steps for each frame, ie 20,000 steps each 16.7 ms!

If you encounter decaying orbits, it's due to accumulating numerical errors. In reality such decays do not happen, except a body is slowed down by friction.

Computing the Start Values

We have to compute start conditions, the values for positions and velocities of the bodys, so that they initially produce stable orbits. We can use Kepler's laws to compute the start positions and velocities given distances between the bodies and their orbital period.

The App also computes the masses and their corresponding sizes of the objects from the distances and periods, assuming some density of the objects, so that their pixel size is appropriate.

Note: in reality the masses, their distances and their velocities and start positions are given and the orbital periods and center of masses depend on that. For the simulation it was a priority, that the graphics fits onto the sceen. Therefor the data is computed the other way around as follows:

Computing the Masses

Given the orbital period T and the distance between two bodies D we can compute the central mass needed to hold the body in orbit using Kepler's law:

' =' 'Mass of sun
' =' 'Distance sun to earth-moon center of mass
' =' '6.674 × 10−11 m3/(kg·s2) = Gravitational constant
' =' 'Orbital period of earth-moon system
' =' 'Mass of earth
' =' 'Distance earth to moon
' =' '6.674 × 10−11 m3/(kg·s2) = Gravitational constant
' =' 'Orbital period of moon

The mass of the moon is computed from the relative position of the common center of mass (CMEarthMoon) between earth and moon:

' =' 'Mass of the moon
' =' 'Mass of the earth as computed with (24)
' =' 'relative Distance earth to center of mass (CM). 0.5 means the same distance from CM to earth and moon.

Initial Positions and Velocities for the Sun

The sun and earth-moon system orbits around a common center of mass. The distance between sun and earth-moon system as given by the parameter DSunEarth has to be corrected by incorporating the calculated mass of the sun and mass of the earth-moon system from above:


The distance of the common center of mass sun-earth from the earth is:


The distance of the common center of mass sun-earth from the sun is:


The tangential velocity of the sun around the CM is:


And the tangential velocity of the earth-moon CM around the CM of the sun is:


Now we can setup an initial state for the sun. To simulate movement of the whole solar system through the galaxy in the left direction we add a negative velocity component to the x axis of the start velocity vector of each body:


Initial Positions and Velocities for Earth and Moon

The earth and moon orbit around a common center of mass between them. The distance between earth and moon as given by the parameter DEarthMoon has to be corrected by incorporating the calculated masses of the earth and moon:


The distance of the common center of mass earth-moon from the moon is:


The distance of the common center of mass earth-moon from the earth is:


The tangential velocity of the Earth around the CM is:


And the tangential velocity of the moon around the CM is:


Now we can setup an initial states for earth and moon:


Implementation Detail

The presented formulas work for a real solar system. The model however uses distances in pixels and periods in seconds. To account for that, the gravitational constant was scaled to G = 1 px3/(kg·s2) and all masses are scaled accordingly. The size of the bodies are computed from the scaled masses by incorporating a scaled density, so that the radius of the bodies gets in a range of 8 to 80 pixels.

The radius of a sphere with mass M and density ρ is:


So the radius is proportional the the cube root of the mass. I can define a density factor ρ', that converts a scaled simulator mass to a decent radius:


The following density factors turned out to be usefull to get decent pixel sizes depending on the masses:

ρ' for sun  : 
ρ' for earth: 
ρ' for moon : 


1george Hnatiuk 9/6/2018 | 21:01

EXCELLENT - well done Walter.


2Therumpus 9/13/2018 | 18:15

Really, really excellent Walter, I might contact you by email so you can have a look at my ray tracer modelling of refraction.

Fabby stuff.

3cearnicus 11/28/2018 | 15:43

Stellar work as always.

I've also done something similar in a simple spreadsheet program, and found that you can run into problems with simple Euler integration pretty quickly. However using Verlet integration (which skips the velocity intermediate step) you get much more stable results. Might be worth looking into for this stuff.

4wabiswalter@bislins.ch (Walter Bislin, Author of this Page) 11/28/2018 | 20:22

cearnicus: Might be worth looking into [Verlet integration] for this stuff.

Thank you very much for this information.

And thank you for your contribution to gravity on the comment section of Flat Earth Dome Model. Below is a copy of your comment, because it better fits to this articel.


Re gravity: it may also be instructive to look at how one can derive the basic form of Newton's law of gravitation from the observations.

In 2d, circular motion is given by , with r the circle's radius and ω the angular velocity. To get the velocity and acceleration you have to differentiate once and twice with respect to time. If you look at the magnitude of those, you have

(= speed along the circle)

( = centripetal acceleration)

Note: this stuff is simply part of motion along a circular path. This has nothing to do with gravity (yet), this is what it means to move in a circle. In terms of forces, by definition , meaning that any force that points directly inward and has the same magnitude at constant r results in a circular path.

Kepler's laws provide an accurate description of planetary motion. They are essentially summaries of the observations. Simplifying things to circles, his third law states that the radius cubed is proportional to the period squared: . Again, no magic; this is what the observations tell us.

So, let's rewrite that so that it fits the formula for the centripetal force.

In other words, the pattern we see in planetary motion can be explained by a force that's inversely proportional to the distance squared between the planet and the sun. And, again, since , we also know that this force is proportional to the mass of the planet:


Now, technically it's not just simply . It's actually the force of one object (the sun S) acting on another (a planet P). So really we have .Finally, from Newton's third law we know action = -reaction, so . For that we have the something similar: .

Putting all of this together, we get:

Again, all I've done here is distill the observed paths of planets into a formula of a force. And, oh hey, looks suspiciously like Newton's Law of gravity. Note that right now I've only looked at circles and magnitudes, but if you generalize it to vectors and ellipses, you'll find that the law of gravity correctly describes all of Kepler's laws (see its wikipedia page for details). It also correctly predicts that the falling acceleration on earth should decrease with altitude, the atmospheric pressure profile, buoyancy, period-vs-distance relation between the moons of the solar system, etc, etc.

So yes, a force of this form is required to accurately describe nature. We call this force "gravity". Flat earthers can whine about it all they like, but this is what the observations tell us.

5Jhon Sperry 4/16/2019 | 11:26

In 'Why are accelerations and forces absolute local properties of an object while position and velocity are relative to an observer?'
You simply state (as if being something self evident) that {@ t2, the velocity is v2 = v1 + Δv} and then you use it into a mathematical equivalence that suits your purpose. I'd like you to elaborate on that <<vectorial>> Δv and how would you translate/describe that in practice . You can't just simply hide a long hystory of values (because that's what Δv is) under the carpet of a simple symbol ...

6wabiswalter@bislins.ch (Walter Bislin, Author of this Page) 4/16/2019 | 20:47

Jhon, you are right. I didn't want to introduce calculus in the description, so I was not quite correct there. My definition is only correct if the velocity does not change in the time span Δt.

Acceleration is defined as the change in velocity in an infintesimal short time span. In Calculus, it's the derivative of velocity with respect to time. If you plot the velocity over time, it's the slope of the curve at each time.

So in reality there is no "long history of values hidden under the carped of a simple symbol". I have corrected the paragraph. Please read it again:

Absoluteness of Accelerations and Forces

Thank you for your comment.

More Page Infos / Sitemap
Created Wednesday, September 5, 2018
Scroll to Top of Page
Changed Wednesday, June 3, 2020