Skip to content
Sign upLog in
← Back to Community

A simulator for calculating the flight of a projectile in the atmosphere

Profile icon
LevMckinney

Ever taken physics and wanted to not ignore air resistance well here is the program for you. It will calculate the distance a projectile will fly in the atmosphere and make a nice graph out of it:

Cannot infer image mime type

https://repl.it/@LevMckinney/Projectile-Distance-Calculator

Voters
Profile icon
WyattGeorge
Profile icon
vedprad1
Profile icon
Babbel
Profile icon
alfredobustos
Profile icon
NathanielLowis
Profile icon
timmy_i_chen
Profile icon
LevMckinney
Comments
hotnewtop
Profile icon
NathanielLowis

Very good

Profile icon
NathanielLowis

@LevMckinney
but I do have a zero division error. This is what I inputted:
launch velocity (m/s) = 100
luanch angle (deg) = 27
frontal area of projectle (m^2) = 500
drag cofficent = 2
projectle mass (kg) = 1000
Is on Earth Near Sea Level y/n : y
hight off the groud (m) = 0
time step (recomended 0.01 to 1) (sec) = .5
shold it print a plot (y/n): y
Traceback (most recent call last):
File "python", line 108, in
File "python", line 98, in Distance
ZeroDivisionError: float division by zero

Profile icon
LevMckinney

@NathanielLowis
Added a try catch. It will tell the user to use a lower the time step. I know its a bit sloppy. I think this is a floating point error caused by the numbers just getting way to small. Will switch to higher precision floating point later tonight.

Profile icon
timmy_i_chen

Super cool!