← 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:
This file cannot be displayed: https://storage.googleapis.com/replit/images/1530062531655_8861d27817899ed5ec6bb0b252275dee.pn
https://repl.it/@LevMckinney/Projectile-Distance-Calculator

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

Super cool!

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.