scene.range=RE/10
scene.camera.pos = vec(0,RE,RE/10)
# The next several lines set up the target area of the ocean. The target is shown
# to scale - approximately 20 square miles. Note that the target appears to
# float above the surface of the Earth. This is because GlowScript spheres are
# not perfectly smooth.
targetrange = 487.3E3
# The Freedom 7 capsule traveled 487.3 km
# across the Earth’s surface.
targetangle = targetrange/RE # angular distance traveled, radians
targetpos = RE*vec(cos(pi/2-targetangle),cos(targetangle),0)
targetaxis = 4E3*vec(cos(pi/2-targetangle),cos(targetangle),0)
target = cylinder(pos=targetpos, axis=targetaxis, radius=4E3, color=color.yellow)
Earth = sphere(pos=vec(0,0,0), radius=RE, color=color.cyan)
Freedom7 = cone(pos=vec(0,RE,0), axis=vec(0,2,0)*scalefactor,radius=1*scalefactor,
color=color.green, make_trail=True)
r = Freedom7.pos - Earth.pos
v = vec(1250,1868,0)
p = mc*v
Teacher Resource 1
Using GlowScript to Solve Problems
– Answer Sheet
L e s s o n
6
(PHYSICS, PROGRAMMING)

J o u r n e y s i n F i l m
: H i d d e n F i g u r e s
Teacher Resource 1
Using GlowScript to Solve Problems
– Answer Sheet
maxheight = 0
dt = 0.1
while mag(r) >= RE:
rate(100/dt)
F = -G*mc*mE/mag(r)**2 * norm(r)
p = p + F*dt
v = p/mc
Freedom7.pos = Freedom7.pos + v*dt
r = Freedom7.pos - Earth.pos
if mag(r)-RE > maxheight:
maxheight = mag(r)-RE
print(maxheight/1E3)
# print maximum height of rocket, km
Once the students have a working program, it is quite acceptable for them to find suitable initial conditions by trial and
error. During the process of experimentation, it is likely that their initial guesses will either fall short or escape from the
Earth altogether. By refining their guesses, they can get a feel for the gradual transition from parabolic flight in a constant
gravitational field, to elliptical flight with a gravitational field that changes direction and magnitude.
Another key insight is that launching a spacecraft requires a large amount of sideways velocity, not just vertical velocity.
A hint for speeding up guesses: It helps to find an initial
component of velocity that gives the correct apogee of
approximately 187.5 km. They can then refine the
component to make the capsule hit the target. The
component will
need only small adjustments after that.
21.
This is a challenging problem, and should be assigned only as a long-term project for highly motivated students. Students
will need to change both the magnitude and direction of thrust over the course of the flight, in several distinct stages.
Although the problem does not ask for it, another significant variable to model can be the changing mass of the spacecraft,
as it sheds fuel, and also as the booster engines are dropped. If mass change is modeled, this problem can work well in
conjunction with teaching the rocket equation ().

#### You've reached the end of your free preview.

Want to read all 26 pages?

- Winter '17
- Mrs. Manternach
- English