Processing math: 100%

 

 

 

Building a code for the solar system, force equations

Introducing x=rcos(θ), y=rsin(θ) and r=x2+y2, we can rewrite Fx=GMMEr2cos(θ)=GMMEr3x, and Fy=GMMEr2sin(θ)=GMMEr3y, for the y direction.