平抛运动的特点的(平抛运动演示)(1)

程序演示

import turtle import math colors = ["blue", "black", "brown", "red", "yellow", "green", "orange", "beige", "turquoise", "pink"] turtle.setup(800, 800) # 设置窗口尺寸 t_line = turtle.Turtle() t_line.pencolor('red') t_line.pensize(5) t_line.speed(0) t_line.down() t_line.goto(-400,0) t_line.goto(400,0) t_line.hideturtle() h = 20 # 球的高度 g = 9.8 # 重力加速度 k = 10 # 放大系数,为了图形显示 h,g = h*k,g*k # 放大倍数,便于显示 n = 1 # 实验次数 v = float(input('请输入' colors[(n-1) % 10] '球的水平初速度:')) # 球的水平初速度 ,建议测试10,20,30,300 while v!=0: v = v*k # 放大倍数,便于显示 y = h t_ball = turtle.Turtle() t_ball.speed(0) t_ball.shape('circle') t_ball.color(colors[(n-1)]) t_ball.up() t_ball.goto(-400, h) t_ball.down() t = 0 while y>0: y=h-0.5*g*t*t x=-400 v*t t_ball.goto(x,y) turtle.delay(10) t=t 0.01 n = n 1 # 实验次数增加 v = float(input('请输入球的水平初速度:')) # 球的水平初速度 turtle.mainloop()

,