GlowScript 2.9 VPython get_library('https://cdn.rawgit.com/PERLMSU/physutil/master/js/physutil.js') #Window setup scene.range=7e7 scene.width = 1024 scene.height = 760 #Objects Earth = sphere(pos=vector(0,0,0), radius=6.4e6, color=color.blue) Satellite = sphere(pos=vector(42164e3, 0,0), radius=1e6, color=color.red, make_trail=True) #Parameters and Initial Conditions mSatellite = 15e3 pSatellite = mSatellite*vector(0,3073,0) G = 6.67e-11 mEarth = 5.97e24 #Time and time step t = 0 tf = 60*60*24 dt = 1 #MotionMap/Graph SatelliteMotionMap = MotionMap(Satellite, tf, 20, markerScale=2000, labelMarkerOrder=False) FnetMotionMap = MotionMap(Satellite, tf, 20, markerScale=2000, labelMarkerOrder=False) #separationGraph = PhysGraph(numPlots=1) f1=series() #Calculation Loop while t < tf: rate(10000) Fgrav = -G*mSatellite*mEarth*Satellite.pos/(mag(Satellite.pos)**3) Fnet = Fgrav pSatellite = pSatellite + Fnet*dt Satellite.pos = Satellite.pos + (pSatellite/mSatellite)*dt SatelliteMotionMap.update(t, pSatellite/mSatellite) FnetMotionMap.update(t, Fnet) #separationGraph.plot(t,mag(mSatellite)) f1.plot(t,mag(Satellite.pos)) t = t + dt #Earth Rotation (IGNORE) theta = 7.29e-5*dt Earth.rotate(angle=theta, axis=vector(0,0,1), origin=Earth.pos)