Add algorithm for Newton's Law of Gravitation - #6626
Merged
Conversation
Contributor
Author
|
Hey @cclauss, sorry for pinging. Could you please take a look at this PR? |
cclauss
reviewed
Oct 6, 2022
| 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") |
Member
There was a problem hiding this comment.
OPTIONAL:
Suggested change
| raise ValueError("Only one argument must be 0") | |
| raise ValueError("One and only one argument must be 0") |
Member
There was a problem hiding this comment.
LGTM. Let me know if you want this change or not and then we can merge.
Contributor
Author
There was a problem hiding this comment.
Thanks, the suggestion looks good to me. Let me commit it.
Co-authored-by: Christian Clauss <cclauss@me.com>
Contributor
Author
|
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. |
cclauss
approved these changes
Oct 6, 2022
cclauss
left a comment
Member
There was a problem hiding this comment.
Rock & Roll -- Thanks for doing this!
Contributor
Author
|
Thanks for merging! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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}.