Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GlowScript 2.9 VPython
- r=1
- gr_h=0.1
- h=10
- g=9.81
- t0=0
- dt=1e-3
- sc=canvas(background=color.cyan)
- sc.center=vector(0,h/2,0)
- ball=sphere(pos=vector(0,h,0),R=r)
- ground=box(pos=vector(0,0,0), length=10, height=0.1, width=10)
- y0=h
- vy0=0
- ay=-g
- y=y0
- vy=vy0
- t=t0
- while y>=0:
- rate(1/dt)
- y += vy * dt # use old vy to calculate new y
- vy += ay * dt # use old ay to calculate new vy
- t += dt
- ball.pos.y=y
- print("Конечная скорость: ",vy)
- print("Время: ",t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement