Okay class.

I have assigned you the following problem.

A similar but yet different problem can be solved using this code:

GlowScript 3.0 VPython

#green grass
mybox = box(pos=vector(0,-5,0), size=vector(20,0.1,20),color=color.green)

#ball
ball  = sphere(pos=vector(0,-4.8,0),radius=0.5,color=color.red, make_trail=True)

#Add Part Two
tgraph = graph(xtitle = 'Time(s)',ytitle = 'Pos(m)')
f1 = gcurve(color=color.red)

initialVelocity = vector(2,10,2)
TimeStep        = 0.01
Acc             = vector(0,-9.81,0)
Velocity        = initialVelocity
time            = 0

while ball.pos.y > -5:
    rate(20)
    
    Velocity = Velocity + Acc * TimeStep
    ball.pos = ball.pos + Velocity * TimeStep
    time     = time + TimeStep
    f1.plot(time, ball.pos.y)

How do you modify the code for this problem?

Posted in

Leave a Reply


Cosmic Pathways, Lab for Kids, and many of the other research activities discussed on this website is supported by the National Science Foundation and the Physics Teacher Education Coalition (PhysTEC) under grant no. 2325980. Any opinions, findings, and conclusions, or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.