Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 计算delta-v给出了否定的结果_Python_Physics - Fatal编程技术网

Python 计算delta-v给出了否定的结果

Python 计算delta-v给出了否定的结果,python,physics,Python,Physics,我试图完全由我自己设计自己的火箭模型,但当我试图用齐奥科夫斯基方程计算delta-v时,我的代码只给出了否定的答案 我想这可能是因为我的火箭没有足够的动力来产生任何delta-v,所以我使用了一个真实的例子(土星v),它给出了一个准确的结果,但仍然是否定的(第一阶段:-2000 delta-v) 这是我的代码: import math netMass = int(input('what is the total mass of the rocket: ')) dryMass = int(inp

我试图完全由我自己设计自己的火箭模型,但当我试图用齐奥科夫斯基方程计算delta-v时,我的代码只给出了否定的答案

我想这可能是因为我的火箭没有足够的动力来产生任何delta-v,所以我使用了一个真实的例子(土星v),它给出了一个准确的结果,但仍然是否定的(第一阶段:-2000 delta-v)

这是我的代码:

import math
netMass = int(input('what is the  total mass of the rocket: '))
dryMass = int(input('what is the empty mass of the rocket: '))
Isp = int(input('what is the Isp of the engine: '))
fuelMass = netMass - dryMass
Δv = Isp*9.8*math.log(float(dryMass/netMass))
print(Δv)

我也没有Numpy可供使用,所以只能使用数学库。

在齐奥科夫斯基火箭方程中,应该使用的比率是湿质量(或初始总质量)与干质量(或最终总质量)之比。那么代码应该是

导入数学
净质量=int(输入('火箭的总质量是多少:'))
dryMass=int(输入('火箭的空质量是多少:'))
Isp=int(输入('引擎的Isp是什么:'))
燃料质量=净质量-干质量
Δv=Isp*9.8*数学日志(浮子(净质量/干质量))
打印(Δv)

这会给你一个真空中理想火箭的正确(正)值

不确定我是否理解了您的问题,但当
dryMass
时,对数中的商小于1,这使得对数结果为负数,因此假设
Isp>0
,结果将始终为负数。我想您交换了netMass和dryMass。