lab08.py - from_future import division from visual import...

This preview shows page 1 - 2 out of 3 pages.

from __future__ import division from visual import * from visual.graph import * #Invoke graphing routines scene.y = 400 #Move orbit window below graph scene.width=1024 scene.height=760 # CONSTANTS G = 6.7e-11 mEarth = 6e24 mcraft = 15000 mMoon=1#7e22 deltat = 60 t = 0 pscale=.25 fscale=10000 dpscale=100 #OBJECTS AND INITIAL VALUES Earth = sphere(pos=vector(0,0,0), radius=6.4e6, color=color.cyan) Moon = sphere(pos=vector(4e8,0.0), radius=1.75e6, color=color.white) scene.range=11*Earth.radius # Add a radius for the spacecraft. It should be BIG, so it can be seen. craft = sphere(pos=vector(-69760000,2880000,0),radius=2e6, color=color.yellow) vcraft = vector(920,2827,0) value=sqrt(G*mEarth/mag(Moon.pos-Earth.pos)) vMoon=vector(0,value,0) pMoon=mMoon*vMoon pcraft = mcraft*vcraft pArrow=arrow(color=color.green) fArrow=arrow(color=color.cyan) dpArrow=arrow(color=color.red) trail = curve(color=craft.color) # This creates a trail for the spacecraft mtrail= curve(color=Moon.color) scene.autoscale = 0 # And this prevents zooming in or out Fnet_tangent_arrow=arrow(color=color.yellow) Fnet_perp_arrow=arrow(color=color.magenta) U_graph = gcurve(color=color.blue)
Image of page 1

Subscribe to view the full document.

Image of page 2
You've reached the end of this preview.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern