import math
x = 10
v0 = 10
g = 9.8
angle = 45
y0 = 150
y = x * math.tan(angle) - (1 / 2 * v0) * (g * x * x)/math.cos(2 * angle) + y0
print("y的值: {}".format(y))
如果觉得答案对你有帮助,请点击下采纳,谢谢~
import math
def fun(x,v0,g,d,y0):
y=x*math.tan(d)-g*x*x/(2*v0*math.cos(2*d))+y0
return y
v0=10
g=9.8
d=60
y0=150 #cm
x=float(input('输入x:'))
print('y的值为:',fun(x,v0,g,d,y0),'cm')
觉得有用的话采纳一下哈
import math
v0 = 1
g = 1
o = 1
y0 = 1
x = 1
y = x*math.tan(o)-1/(2*v0)*(gxx/math.cos(2o))+y0
print(y)
import turtle
import math
v0 = float(input("vo:"))
g = float(input("g:"))
the = float(input("the:"))
y0 = float(input("y0:"))
T = turtle.Turtle()
turtle.tracer(False)
T.up()
for x in range(0, 200, 4):
y =y0 + x * math.tan(math.radians(the)) -(g * pow(x, 2)) / (2 * v0 * math.cos(2 *math.radians(the)))
T.goto(x, y)
T.pd()
T.up()
turtle.tracer(True)
turtle.done()