Skip to content

feat: add free-fall motion calculations#233

Open
nickzerjeski wants to merge 2 commits intoTheAlgorithms:masterfrom
nickzerjeski:feat-free-fall-distance-194
Open

feat: add free-fall motion calculations#233
nickzerjeski wants to merge 2 commits intoTheAlgorithms:masterfrom
nickzerjeski:feat-free-fall-distance-194

Conversation

@nickzerjeski
Copy link
Copy Markdown

Summary

  • add free-fall helper methods using constant acceleration formulas
  • implement both distance from time and time from distance calculations
  • add input validation and tests

Testing

  • ruby maths/free_fall_distance_test.rb

Fixes #194

Copilot AI review requested due to automatic review settings April 13, 2026 08:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new maths helper for free-fall motion calculations (constant acceleration under gravity), addressing Issue #194 by providing both “distance from time” and “time from distance” APIs with basic domain validation.

Changes:

  • Added FreeFallDistance.distance(time:, gravity:) implementing d = 0.5 * g * t^2
  • Added FreeFallDistance.time(distance:, gravity:) implementing t = sqrt(2d / g)
  • Added Minitest coverage for the core formulas and negative time/distance validation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
maths/free_fall_distance.rb Introduces free-fall distance/time helpers, gravity constant default, and domain validation.
maths/free_fall_distance_test.rb Adds unit tests validating the formulas and negative-input error behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Free Fall Distance

2 participants