* Update annotations to Python 3.10 #4052
* Add floats doctest
* Copy list to avoid changing input unpredictably
* Refactor code to make it readable
* updating DIRECTORY.md
* Improve raised ValueErrors and add doctest
* Split doctest in multiples lines
* Change ValueError to Monogons and Digons are not poly
* Correct doctest refering number of sides
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* 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>
* Add Proth number to maths
* Add test for 0 and more informative output
* Fixing test failure issue - unused variable
* Update proth_number.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Magnitude and Angle
Core function to find Magnitude and Angle of two Given Vector
* Magnitude and Angle with Doctest
added Doctest to the functions
* Update linear_algebra/src/lib.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update linear_algebra/src/lib.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Changes done
and Magnitude and Angle Issues
* black
* Modified Euler's Method
Adding Modified Euler's method, which was the further change to a Euler method and known for better accuracy to the given value
* Modified Euler's Method (changed the typing of function)
Modified function is used for better accuracy
* Link added
Added link to an explanation as per Contributions Guidelines
* Resolving Pre-Commit error
* Pre-Commit Error Resolved
* Pre-Commit Error import statement Change
* Removed Import Math
* import math built issue
* adding space pre-commit error
* statement sorter for doc
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update and rename check_valid_ip_address.py to is_ip_v4_address_valid.py
New test cases that the algorithm must detect:
* [ ] an octet much bigger than 255
* [ ] an octet is negative
* [ ] number of octets is less than 4
* [ ] number of octets is greater than 4
* [ ] an octet is a letter
* updating DIRECTORY.md
* Add two more tests to is_ip_v4_address_valid.py
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
* added gamma_function
* Add files via upload
* Resolved issue with str.format
And also changed output to math notation
* Update gamma_function.py
* Rename physics/gamma_function.py to maths/gamma_recursive.py
* Fixes: #4709 Fixed issues for pre-commit test
* Fixes: #4709 solved issues with doctests
And comments
* Fixes: #4709 Added failed tests to doctest
* Align with Python's Standard Library math.gamma()
Replicate the exceptions of https://docs.python.org/3/library/math.html#math.gamma
* Update gamma_recursive.py
* Update gamma_recursive.py
* Update gamma_recursive.py
* Update gamma_recursive.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix mypy errors for maths/greedy_coin_change.py
* Fix mypy errors for maths/two_sum.py
* Fix mypy errors for maths/triplet_sum.py
* Fix the format of maths/greedy_coin_change.py
* Fix the format of maths/greedy_coin_change.py
* Fix format with pre-commit
* Average mean refactor
Added doctests and type hints to average_mean
* Wiki link added
* Empty list check added
Empty list check added
Type hint changed to typing.List
A serious bug was addressed with this pull request. The mode function previously
didn't return the mode of the input list. Instead, it always returned the first value.
Due to lacking tests, the bug was never caught. This pull request also adds new
functionality to the function, allowing support for more than one mode.
See #4464 for details.
* * Mistake in average_mode.py fixed. The previous solution was to returnthe
value on the first loop iteration, which is not correct, more than that it
used to delete repeating values, so result's array and check array lost
relation between each other
* Type hint added
* redundant check_list deleted
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
* Suggestions resolved
* output typing changed to Any
* test cases added
* Black done
File formatted
* Unused statistics import
statistics only used in doctest, now they are imported in doctest
* Several modes support added
Several modes support added
* Comment fix
* Update maths/average_mode.py
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
* Suggestions added
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
This is a documentation fix. This fix patches a mistake in the description of the Armstrong number.
* * Doc fix
* Armstrong number is not the sum of cube's of number digits, but
the sum of number's digits each raised to the power of the number of digits
* Update armstrong_numbers.py
Line shorten
* Hacktoberfest: Add greedy_coin_change.py file
added the file in greedy_methods folder to implement the same method
Altered the code according to the changes that were requested.
* Added doctests.
doctests added to the function find_minimum_change.
* Added Greedy change file in Maths folder.
* updating DIRECTORY.md
* Deleted Greedy Method Folder
* updating DIRECTORY.md
* Update greedy_coin_change.py
* fix: black formatting issues
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
* Update area.py
Modified area of triangle function. Added a new algorithm to calculate area when 3 sides are known
* Add files via upload
* Update area.py
* Update area.py
* Update area.py
* Update area.py
* Remove unnecessary whitespace
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
* add type hints to math/gcd
* add doctest
* math/gcd - run black formatter
* math/gcd: remove manual doctest
* add correction to gcd of negative numbers
* add more doctest in iterative gcd
* Made improvements to combinations.py
* Update maths/combinations.py
Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
* Function now raises an error when given invalid input
* Update maths/combinations.py
Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>