def calculate(self):
i = 0
while(True):
self.C = 4E-2 * math.pow(1 - 6.5 * self.y[i] / 300, 2.5)
self.g.append(self.G * self.M_E / (self.R_E + self.y[i]) ** 2)
self.x.append(self.x[i] + self.v_x[i] * self.dt)
self.y.append(self.y[i] + self.v_y[i] * self.dt)
self.v_x.append(self.v_x[i] - self.C * math.hypot(self.v_x[i], self.v_y[i]) * self.v_x[i] * self.dt)
self.v_y.append(self.v_y[i] - self.g[i-1] * self.dt - self.C * math.hypot(self.v_x[i], self.v_y[i]) * self.v_y[i] * self.dt)
i += 1
if self.y[i] < 0:
break
#For the falling point
self.x[i] = - self.y[i-1] * (self.x[i] - self.x[i-1]) / (self.y[i] - self.y[i-1]) + self.x[i-1]
self.y[i] = 0
#Maxmize the range and find the corresponding firing angle
5(improved) code.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录