Processing math: 100%

 

 

 

Building a code for the solar system, gravitational force and constants

We start with a simpler case first, the Earth-Sun system in two dimensions only. The gravitational force FG is F=GMMEr2,

where G is the gravitational constant, ME=6×1024Kg,
the mass of Earth, M=2×1030Kg,
the mass of the Sun and r=1.5×1011m,
is the distance between Earth and the Sun. The latter defines what we call an astronomical unit AU. From Newton's second law we have then for the x direction d2xdt2=FxME,
and d2ydt2=FyME,
for the y direction.