-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Add algorithm for Newton's Law of Gravitation #6626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hey @cclauss, sorry for pinging. Could you please take a look at this PR? |
product_of_mass = mass_1 * mass_2 | ||
|
||
if (force, mass_1, mass_2, distance).count(0) != 1: | ||
raise ValueError("Only one argument must be 0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPTIONAL:
raise ValueError("Only one argument must be 0") | |
raise ValueError("One and only one argument must be 0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let me know if you want this change or not and then we can merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the suggestion looks good to me. Let me commit it.
Co-authored-by: Christian Clauss <[email protected]>
I don't know why it shows failing after the suggested change. Do you want me to commit the file from my local machine again? Because I committed the change from my browser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rock & Roll -- Thanks for doing this!
Thanks for merging! |
Describe your change:
I implemented an algorithm to find out the values of either Force of attraction, distance or magnitude of any one of the masses of a two-body gravitational system using Newton's Universal Law of Gravitation, provided the values of the other three parameters are non-zero numbers.
Checklist:
Fixes: #{$ISSUE_NO}
.