This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ## gravitational force, momentum, and position r = craft.pos - Earth.pos rmag = mag(r) Fmag = (G*mcraft*mEarth)/rmag**2 rhat = r/rmag Fnet = -Fmag*rhat pcrafti = pcraft + vector(0,0,0) pcraft = pcraft + Fnet*deltat deltap = pcraft - pcrafti craft.pos = craft.pos + (pcraft/mcraft)*deltat parr.pos = craft.pos parr.axis = pcraft*pscale farr.pos = craft.pos farr.axis = Fnet*fscale dparr.pos = craft.pos dparr.axis = deltap*dpscale ## check to see if the spacecraft has crashed on the Earth. ## if so, get out of the calculation loop if rmag < Earth.radius: break trail.append(pos=craft.pos) ## this adds the new position of the spacecraft to the trail t = t+deltat print 'Calculations finished after ',t,'seconds' print 'Final position =', craft.pos print 'Final velocity=', pcraft/mcraft print 'Gravitational Force=', Fnet...
View Full Document
This note was uploaded on 09/12/2011 for the course PHYISCS 2211 taught by Professor Jarrio during the Spring '10 term at Georgia Tech.
- Spring '10