Created
August 19, 2020 00:31
-
-
Save ahmedazizkhelifi/49048e4a1161f4e12d581d1d10b97f54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
vp.rate(500) | |
#calculte the force using gravitationalForce function | |
star.force = gravitationalForce(star,planet) | |
planet.force = gravitationalForce(planet,star) | |
#Update momentum, position and time | |
star.momentum = star.momentum + star.force*dt | |
planet.momentum = planet.momentum + planet.force*dt | |
star.pos = star.pos + star.momentum/star.mass*dt | |
planet.pos = planet.pos + planet.momentum/planet.mass*dt | |
t+= dt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment