Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. GlowScript 2.9 VPython
  2. r=1
  3. gr_h=0.1
  4. h=10
  5. g=9.81
  6. t0=0
  7. dt=1e-3
  8.  
  9. sc=canvas(background=color.cyan)
  10. sc.center=vector(0,h/2,0)
  11.  
  12. ball=sphere(pos=vector(0,h,0),R=r)
  13. ground=box(pos=vector(0,0,0), length=10, height=0.1, width=10)
  14. y0=h
  15. vy0=0
  16. ay=-g
  17. y=y0
  18. vy=vy0
  19. t=t0
  20.  
  21. while y>=0:
  22. rate(1/dt)
  23. y += vy * dt # use old vy to calculate new y
  24. vy += ay * dt # use old ay to calculate new vy
  25. t += dt
  26. ball.pos.y=y
  27. print("Конечная скорость: ",vy)
  28. print("Время: ",t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement