Python script to demonstrate the Magnus Effect.
# © 2019 TheFlyingKeyboard and released under MIT License # theflyingkeyboard.net import math import matplotlib.pyplot as plt from pylab import rcParams rho = 1.225 radius = 0.0635 spin = 100 omega = (2 * math.pi * spin) / 60.0 c = math.pi * math.pow(rho, 2) * math.pow(radius, 3) * omega mass = 0.136 y = 1.8288 x = 0.0 time = 0.0 precision = 0.01 v0x = 40.0 v0y = 0.0 gravity = 9.81 sy = 1.0 plotX = [] plotY = [] while sy > 0: time += precision vx = (1.0 / (1.0 - math.pow(time / mass, 2) * math.pow(c, 2))) * (v0x + c * v0y * (time / mass) - c * gravity * math.pow(time, 2) / mass) vy = (v0y + (time / mass) * c * vx) - gravity * time sx = x + v0x * time + 0.5 * (c / mass * vy) * math.pow(time, 2) sy = y + v0y * time + 0.5 * (((c * vx) - mass / gravity) / mass) * math.pow(time, 2) plotX.append(sx) plotY.append(sy) rcParams['figure.figsize'] = 16, 9 plt.gca().xaxis.grid(True) plt.gca().yaxis.grid(True) plt.xlabel("X") plt.ylabel("Y") plt.plot(plotX, plotY) plt.show()
Python Magnus Effect