Skip to content

feat(maths): add harmonic mean algorithm - #14234

Closed
benarch wants to merge 1 commit into
TheAlgorithms:masterfrom
benarch:feature/add-harmonic-mean
Closed

feat(maths): add harmonic mean algorithm#14234
benarch wants to merge 1 commit into
TheAlgorithms:masterfrom
benarch:feature/add-harmonic-mean

Conversation

@benarch

@benarch benarch commented Jan 31, 2026

Copy link
Copy Markdown

Description

Adds a new algorithm to compute the harmonic mean of numbers.

The harmonic mean is defined as n divided by the sum of the reciprocals of n numbers. It is particularly useful for calculating average rates (e.g., speed, density).

Changes

  • Added maths/harmonic_mean.py with:
    • compute_harmonic_mean() function
    • Comprehensive doctests
    • Proper error handling for edge cases

Reference

Checklist

  • I have read CONTRIBUTING.md
  • This pull request is all my own work
  • I added relevant tests
  • All new and existing tests passed

@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Jan 31, 2026
@cclauss

cclauss commented Sep 4, 2026

Copy link
Copy Markdown
Member

Closing "tests are failing" PRs to prepare for Hacktoberfest

@cclauss cclauss closed this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants