Created
August 19, 2020 00:18
-
-
Save ahmedazizkhelifi/a86288d188b1b99946292e7e4f1d9ff4 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
def gravitationalForce(p1,p2): | |
G = 1 #real-world value is : G = 6.67e-11 | |
rVector = p1.pos - p2.pos | |
rMagnitude = vp.mag(rVector) | |
rHat = rVector / rMagnitude | |
F = - rHat * G * p1.mass * p2.mass /rMagnitude**2 | |
return F |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment