#////////////////////////////////////////////Оптимальный угол бросания//////////////////////////////////////////////////
θ = u
i = 0
ymax = 0
shag = 0.001
shag_θ = 0.0001
while (ymax<1):
V = V0
θ = u + shag_θ * i
y = 0
x = 0
t = 0
while (round(y, 3) >= 0):
# print(round(t,3))
# print (round(x,4))
# print (round(y,4))
# print (round(V,4))
# print(round(np.degrees(θ), 4))
# Производная в начальной точке
dx = find_dx(V, θ)
dy = find_dy(V, θ)
dV = find_dV(V, θ)
dθ = find_dθ(V, θ)
# Промежуточная точка
y1 = y + dy * shag / 2
x1 = x + dx * shag / 2
V1 = V + dV * shag / 2
θ1 = θ + dθ * shag / 2
dx1 = find_dx(V1, θ1)
dy1 = find_dy(V1, θ1)
dV1 = find_dV(V1, θ1)
dθ1 = find_dθ(V1, θ1)
# Новая точка
y += dy1 * shag
x += dx1 * shag
V += dV1 * shag
θ += dθ1 * shag
t += shag
if y>ymax:
ymax = y
i += 1
#///////////////////////////////////////////Дальность прямого выстрела//////////////////////////////////////////////////
V = V0
θ = u + shag_θ * (i-2)
y = 0
x = 0
t = 0
shag = 0.001
while (round(y,3) >= 0):
# print(round(t,3))
# print (round(x,4))
# print (round(y,4))
# print (round(V,4))
print (round(np.degrees(θ),4))
# Производная в начальной точке
dx = find_dx(V,θ)
dy = find_dy(V,θ)
dV = find_dV(V,θ)
dθ = find_dθ(V,θ)
# Промежуточная точка
y1 = y + dy * shag / 2
x1 = x + dx * shag / 2
V1 = V + dV * shag / 2
θ1 = θ + dθ * shag / 2
dx1 = find_dx(V1,θ1)
dy1 = find_dy(V1,θ1)
dV1 = find_dV(V1,θ1)
dθ1 = find_dθ(V1,θ1)
# Новая точка
y += dy1 * shag
x += dx1 * shag
V += dV1 * shag
θ += dθ1 * shag
t += shag
print(np.degrees(u + shag_θ * (i-2)))