试图弯曲棒球投篮

时间:2019-05-13 18:51:15

标签: python graph

这是任务: (用python编写)

输入:发射速度和发射角度

输出:当球击中地面并显示投掷图形时,便会消失

我发现了这个,但我不太了解:/ 也许他使用了我没有的图书馆?

https://www.wired.com/story/lets-use-physics-to-model-a-curving-soccer-ball/

我走了这么远:


from pylab import * 

from math import sin, cos, atan2, pi, sqrt

rho = 1.2  # density for air

g = 9.8 

A = 0.038 # area (m^3)

m = 0.43  # mass


def Dragcoefficient(velocity): #m/s

   if velocity<10: return 0.47

   elif velocity>16: return 0.17

   else: return 0.97-velocity*0.05


def drag(launchspeed, launchangle):

   F = rho * launchspeed * launchspeed * A * Dragcoefficient(launchspeed)/2

   return (F*cos(launchangle), F*sin(launchangle))


launchspeed= input("launchspeed to ball? (m/s) ")

launchangle= input("launchangle to ball? (degrees) ")

0 个答案:

没有答案