In [4]:
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate as intg
In [52]:
y = 5
x = 0
v = 10
ang = np.pi / 4
m = 100
g = -9.7864
C = 0.1
p = 0.1
A = 0.1
B = - (C * p * A) / 2
listx = []
listy = []
listt = []
delta = 5e-1
(vx, vy) = (v * np.tan(ang), v * 1 / np.tan(ang))
while y > 0:
y = v + delta * vy
x = x + delta * vx
vy = vy + delta * g
ang = np.arctan(vx/vy)
v = v + delta * B * (vx ** 2 + vy ** 2)
vx = v * np.sin(ang)
vy = v * np.cos(ang)
listx.append(x)
listy.append(y)
listt.append(delta * (len(listt) + 1))
In [ ]:
plt.plot(listt, listx, '.')
plt.show()
In [45]:
listx[-3]
Out[45]:
In [ ]: