Skip to content

Instantly share code, notes, and snippets.

@lihuanshuai
Created July 19, 2021 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lihuanshuai/2ad8a5d5f90664ff4ce3853235ee291a to your computer and use it in GitHub Desktop.
Save lihuanshuai/2ad8a5d5f90664ff4ce3853235ee291a to your computer and use it in GitHub Desktop.
Mil Simulation
from __future__ import print_function
def get_mil(d, v0, ds):
t = d * 1.0 / v0
mil = (5 * t * t - ds) * 1000 / d
return int(mil * 10 + 0.5) / 10.0
cols = [600, 700, 800, 900, 1000, 1100, 1200]
header = [''] + cols
print(*header, sep='\t')
for d in [10, 100, 200, 300, 400, 500, 800, 1000, 1500]:
print(d, end='\t')
row = [get_mil(d, v0, 0) for v0 in cols]
print(*row, sep='\t')
600 700 800 900 1000 1100 1200
10 0.1 0.1 0.1 0.1 0.1 0.0 0.0
100 1.4 1.0 0.8 0.6 0.5 0.4 0.3
200 2.8 2.0 1.6 1.2 1.0 0.8 0.7
300 4.2 3.1 2.3 1.9 1.5 1.2 1.0
400 5.6 4.1 3.1 2.5 2.0 1.7 1.4
500 6.9 5.1 3.9 3.1 2.5 2.1 1.7
800 11.1 8.2 6.3 4.9 4.0 3.3 2.8
1000 13.9 10.2 7.8 6.2 5.0 4.1 3.5
1500 20.8 15.3 11.7 9.3 7.5 6.2 5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment