[FEAT] Add Newton's Law of Gravitation algorithm#6854
Closed
Priyanshu1303d wants to merge 3 commits into
Closed
Conversation
Priyanshu1303d
requested review from
DenizAltunkapan,
alxkm and
yanglbme
as code owners
October 20, 2025 17:00
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6854 +/- ##
=========================================
Coverage 77.95% 77.96%
- Complexity 6429 6435 +6
=========================================
Files 736 737 +1
Lines 21476 21489 +13
Branches 4204 4205 +1
=========================================
+ Hits 16742 16754 +12
- Misses 4060 4061 +1
Partials 674 674 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Priyanshu1303d
force-pushed
the
feat/Gravitation
branch
2 times, most recently
from
October 20, 2025 17:15
86bafb8 to
4d54467
Compare
Priyanshu1303d
force-pushed
the
feat/Gravitation
branch
from
October 20, 2025 17:21
4d54467 to
39359a0
Compare
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.
This PR adds an implementation of Newton's Law of Universal Gravitation (
Gravitation.java) to thephysicsmodule.clang-format -i --style=file src\main\java\com\thealgorithms\physics\Gravitation.javaThis utility class provides two key, related functions:
calculateGravitationalForce: Calculates the 2D force vector between two bodies.calculateCircularOrbitVelocity: Calculates the speed required for a stable circular orbit.I have run the
GravitationTest.javafile, as well as the full project test suite, locally using mvn test, and all tests passed with a BUILD SUCCESS