Skip to content

Re-organize math/series #5044

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

Merged
merged 6 commits into from
Oct 18, 2021
Merged

Re-organize math/series #5044

merged 6 commits into from
Oct 18, 2021

Conversation

atharva01903
Copy link
Contributor

@atharva01903 atharva01903 commented Oct 5, 2021

Describe your change:

Added the implementation of harmonic mean.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@atharva01903 atharva01903 requested a review from Kush1101 as a code owner October 5, 2021 17:17
@ghost ghost added the awaiting reviews This PR is ready to be reviewed label Oct 5, 2021
@atharva01903
Copy link
Contributor Author

atharva01903 commented Oct 5, 2021

@poyea @dhruvmanila Hello, can anyone of you please review my contribution to this repository? I'll be glad to get some suggestions and learn from them,

Thanks.

Updated the write-up of reference given in the code.

Co-authored-by: John Law <johnlaw.po@gmail.com>
@atharva01903
Copy link
Contributor Author

atharva01903 commented Oct 7, 2021

Thanks @poyea for the suggestion and reviewing my code :) I've made the change. Also, I checked other implementations in the the /maths/series folder. In the implementation of arithmetic mean and geometric mean, the code first checks if a series is an arithmetic or a geometric series respectively. But arithmetic and geometric mean can be computed without the series actually being an arithmetic and a geometric series respectively. So the condition that requires a series to follow arithmetic or geometric progression should be removed. Should I proceed to make that change?

@atharva01903 atharva01903 requested a review from poyea October 11, 2021 13:11
@poyea
Copy link
Member

poyea commented Oct 11, 2021

Yes, you may make those changes on this branch.

@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Oct 11, 2021
@ghost ghost added the awaiting reviews This PR is ready to be reviewed label Oct 12, 2021
@atharva01903
Copy link
Contributor Author

Thank you so much @poyea for the approval. I have incorporated the changes to the branch. 😊👍🏼

@atharva01903
Copy link
Contributor Author

@poyea Ah yes, we can do that as well! I think it is better to add the methods is_arithmetic_series and is_geometric_series to a new file arithmetic_series.py (as it isn't available in the repository) and geometric_series.py respectively. So along with the implementation we can also check if the series is arithmetic/geometric. With that we can add one more method is_harmonic_series to the file harmonic_series.py. Do tell me if you need those changes.

@poyea
Copy link
Member

poyea commented Oct 16, 2021

@poyea Ah yes, we can do that as well! I think it is better to add the methods is_arithmetic_series and is_geometric_series to a new file arithmetic_series.py (as it isn't available in the repository) and geometric_series.py respectively. So along with the implementation we can also check if the series is arithmetic/geometric. With that we can add one more method is_harmonic_series to the file harmonic_series.py. Do tell me if you need those changes.

@atharva01903 Let's do it this way:
In maths/series/, we make 3 files: arithmetic.py, geometric.py and harmonic.py. Then add the mean and is_series functions is each of the files.

@poyea poyea changed the title added harmonic mean add harmonic mean Oct 16, 2021
@atharva01903
Copy link
Contributor Author

Alright @poyea, I did that. Now the mean and is_series functions lie in a single file. 👍🏼

Copy link
Member

@poyea poyea left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request!🤩

@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Oct 18, 2021
@poyea poyea changed the title add harmonic mean Re-organize math/series Oct 18, 2021
@poyea poyea merged commit 1e64bf4 into TheAlgorithms:master Oct 18, 2021
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
* added harmonic mean

* Update maths/series/harmonic_mean.py

Updated the write-up of reference given in the code.

Co-authored-by: John Law <johnlaw.po@gmail.com>

* changes in arithmetic and geometric mean code

* mean and series added in a single file

Co-authored-by: John Law <johnlaw.po@gmail.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.

2 participants