gravforce - f print"Fnet2 =" Fnet2 arr2 =...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
from __future__ import division from visual import * G = 6.7e-11 mcraft = 15e3 mplanet = 6e24 m planet = sphere(pos=vector(0,0,0), radius=6.4e6, craft = sphere(pos=vector(-13e7, 6.5e7,0), radius=3e6, planet2 = sphere(pos=vector(-6.5e7, 6.5e7, 0), radius=6.4e6, planet3 = sphere(pos=vector(0, 6.5e7, 0), radius=6.4e6, color=color.yellow) planet4 = sphere(pos=vector(6.5e7, 6.5e7, 0), radius=6.4e6, planet5 = sphere(pos=vector(13e7, 6.5e7, 0), radius=6.4e6, color=color.cyan) p r = craft.pos - planet.pos print r rmag = (r[0]**2+r[1]**2+r[2]**2)**0.5 Fmag = (G*mcraft*mplanet)/(rmag**2) print Fmag rhat = r/rmag print Fnet = Fmag *-rhat F fscale = 0.3*rmag/Fmag/2 f print "Fnet =", Fnet p arr1 = arrow(pos=craft.pos, axis=Fnet*fscale, color=color.yellow) a r2 = planet2.pos - planet.pos print r2 rmag2 = sqrt(r2.x**2+r2.y**2+r2.z**2) Fmag2 = (G*mcraft*mplanet)/(rmag2**2) print Fmag2 rhat2 = r2/rmag2 print Fnet2 = Fmag2 *-rhat2 F fscale2 = rmag2/Fmag2/2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: f print "Fnet2 =", Fnet2 arr2 = arrow(pos=planet2.pos, axis=Fnet2*fscale, color=color.yellow) a r3 = planet3.pos - planet.pos print r3 rmag3 = (r3[0]**2+r3[1]**2+r3[2]**2)**0.5 Fmag3 = (G*mcraft*mplanet)/(rmag3**2) print Fmag3 rhat3 = r3/rmag3 print Fnet3 = Fmag3 *-rhat3 F fscale3 = rmag3/Fmag3/2 f arr3 = arrow(pos=planet3.pos, axis=Fnet3*fscale, color=color.yellow) a r4 = planet4.pos - planet.pos print r4 rmag4 = (r4[0]**2+r4[1]**2+r4[2]**2)**0.5 Fmag4 = (G*mcraft*mplanet)/(rmag4**2) print Fmag4 rhat4 = r4/rmag4 print Fnet4 = Fmag4 *-rhat4 F fscale4 = rmag4/Fmag4/2 f arr4 = arrow(pos=planet4.pos, axis=Fnet4*fscale, color=color.yellow) a r5 = planet5.pos - planet.pos print r5 rmag5 = (r5[0]**2+r5[1]**2+r5[2]**2)**0.5 Fmag5 = (G*mcraft*mplanet)/(rmag5**2) print Fmag5 rhat5 = r5/rmag5 print Fnet5 = Fmag5 *-rhat5 F fscale5 = rmag5/Fmag5/2 arr5 = arrow(pos=planet5.pos, axis=Fnet5*fscale, color=color.yellow) a...
View Full Document

This note was uploaded on 06/19/2010 for the course PHYSICS Physics taught by Professor Greco during the Spring '10 term at Georgia Tech.

Page1 / 2

gravforce - f print"Fnet2 =" Fnet2 arr2 =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online