* Fix ruff errors
Renamed neural_network/input_data.py to neural_network/input_data.py_tf
because it should be left out of the directory for the following
reasons:
1. Its sole purpose is to be used by neural_network/gan.py_tf, which is
itself left out of the directory because of issues with TensorFlow.
2. It was taken directly from TensorFlow's codebase and is actually
already deprecated. If/when neural_network/gan.py_tf is eventually
re-added back to the directory, its implementation should be changed
to not use neural_network/input_data.py anyway.
* updating DIRECTORY.md
* Change input_data.py_tf file extension
Change input_data.py_tf file extension because algorithms-keeper bot is being picky about it
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* tanh function been added
* tanh function been added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tanh function is added
* tanh function is added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tanh function added
* tanh function added
* tanh function is added
* Apply suggestions from code review
* ELU activation function is added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* elu activation is added
* ELU activation is added
* Update maths/elu_activation.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Exponential_linear_unit activation is added
* Exponential_linear_unit activation is added
* SiLU activation is added
* SiLU activation is added
* mish added
* mish activation is added
* inter_quartile_range function is added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Mish activation function is added
* Mish action is added
* mish activation added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* mish activation added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* inter quartile range (IQR) function is added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* IQR function is added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* code optimized in IQR function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* interquartile_range function is added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update maths/interquartile_range.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Changes on interquartile_range
* numpy removed from interquartile_range
* Fixes from code review
* Update interquartile_range.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Input for user choose his Collatz sequence
Now the user can tell the algorithm what number he wants to run on the Collatz Sequence.
* updating DIRECTORY.md
---------
Co-authored-by: Hugo Folloni <hugofollogua07@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* tanh function been added
* tanh function been added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tanh function is added
* tanh function is added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tanh function added
* tanh function added
* tanh function is added
* Apply suggestions from code review
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Create pi_generator.py
* Update pi_generator.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update pi_generator.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update pi_generator.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update pi_generator.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update pi_generator.py
* Update pi_generator.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated commentary on line 28, added math.pi comparison & math.isclose() test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed # noqa: E501
* printf() added as recommended by cclaus
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* pre-commit: Upgrade psf/black for stable style 2023
Updating https://github.com/psf/black ... updating 22.12.0 -> 23.1.0 for their `2023 stable style`.
* https://github.com/psf/black/blob/main/CHANGES.md#2310
> This is the first [psf/black] release of 2023, and following our stability policy, it comes with a number of improvements to our stable style…
Also, add https://github.com/tox-dev/pyproject-fmt and https://github.com/abravalheri/validate-pyproject to pre-commit.
I only modified `.pre-commit-config.yaml` and all other files were modified by pre-commit.ci and psf/black.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add maths/Gcd of N Numbers
* add maths/Gcd of N Numbers
* add maths/Gcd of N Numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add maths/Gcd of N Numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add maths/Gcd of N Numbers
* add maths/Gcd of N Numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add maths/Gcd of N Numbers
* add maths/Gcd of N Numbers
* more pythonic
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* more pythonic
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* merged
* merged
* more readable
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* feat: Add `fib_recursive_cached` func
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* doc: Show difference in time when caching algorithm
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Refactor bottom-up function to be class method
* Add type hints
* Update convolve function namespace
* Remove depreciated np.float
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* Renamed function for consistency
* updating DIRECTORY.md
* Remove extra imports in gamma.py doctests
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* feat: Add hexagonal number
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* feat: Add juggler sequence
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* refactor: Remove temp variable
* refactor: Change error type for negative numbers
* refactor: Remove # doctest: +NORMALIZE_WHITESPACE
* refactor: Remove int typecasting
* test: Add unit tests for n=10 and n=25
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* feat: Add twin prime algorithm
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: Fix broken import statement
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* feat: Add pronic number implementation
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* feat: Add automorphic number implementation
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* refactor: Add type checking for number
* refactor: Rename variable n to number
* test: Add doctest
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* test: Add unit test for number=0
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Update 3n_plus_1.py
1. Minor issue with ValueError message: Given integer should be positive, not greater than 1, as 1 is allowed.
2. += calls underlying list extend method which might be slower. Calling apend seems more appropriate.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* refactor(abs): Condense `abs_min` and `abs_max`
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Added Torus volume algorithm
* Updated Torus volume for simplicity (removed ref to vol_sphere())
* Refactoring
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Added Torus surface area
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed error in test
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Hexagonal number sequence
A hexagonal number sequence is a sequence of figurate numbers where the nth hexagonal number hₙ is the number of distinct dots in a pattern of dots consisting of the outlines of regular hexagons with sides up to n dots, when the hexagons are overlaid so that they share one vertex.
This program returns the hexagonal number sequence of n length.
* Update hexagonalnumbers.py
* Update hexagonalnumbers.py
* Update hexagonalnumbers.py
* Update hexagonalnumbers.py
* Update and rename hexagonalnumbers.py to hexagonal_numbers.py
* Length must be a positive integer
* Create dodecahedron.py
* Update dodecahedron.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update dodecahedron.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update dodecahedron.py
* Update dodecahedron.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update dodecahedron.py
* Update dodecahedron.py
* Apply suggestions from code review
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply suggestions from code review
* Update dodecahedron.py
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
* Add print_multiplication_table.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added return type description
* Update print_multiplication_table.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Addition_without_arithmetic
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added_param
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added_param_in_first_sec
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* change_align
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update Addition_without_arithmetic.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Rename Addition_without_arithmetic.py to addition_without_arithmetic.py
* Update addition_without_arithmetic.py
* Update addition_without_arithmetic.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* implement function to handle polynomial operations
* edit documentation
* fix type hint and linter errors
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix short variable name
* fix spelling
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Added Manhattan distance algorithm, Fixes: #7776
* Forgot that isinstance can accept a tuple
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update manhattan_distance.py
* Update manhattan_distance.py
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Implemented Swish Function
* Added more description and return hint in def
* Changed the name and added more descrition including test for sigmoid function
* Added * in front of links
* Remove unnecessary else statement
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Spheres union
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update volume.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update volume.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* f-strings
* Update maths/volume.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* more tests
* fix non negative
* fix 0 radius
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix tests
* fix print
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix comment
* fix comment
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update volume.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Included area of n sided regular polygon
Added a function to calculate the area of n sided regular polygons
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* code standard fixes as per PR comments
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Create decimal_conversions.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Create arc_length.py
* Delete decimal_conversions.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant statement, fixed line overflow
* Update arc_length.py
Changed rad to radius as not to get confused with radians
* Update arc_length.py
* Update arc_length.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* Reduced Time Complexity to O(sqrt(n))
* Added testmod
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add signum function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add typehints for functions
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update signum.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Created sum_of_harmonic_series.py
Here in this code the formula for Harmonic sum is not used, Sum of the series is calculated by creating a list of the elements in the given Harmonic series and adding all the elements of that list !
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update maths/sum_of_harmonic_series.py
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* Update maths/sum_of_harmonic_series.py
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* Update maths/sum_of_harmonic_series.py
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update maths/sum_of_harmonic_series.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update maths/sum_of_harmonic_series.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update maths/sum_of_harmonic_series.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update sum_of_harmonic_series.py
* Add doctests
* Update sum_of_harmonic_series.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* renamed maclaurin_sin.py to maclaurin_series.py and included function for cos approximation
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* attempt to fix pytest error
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* added maclaurin_sin.py function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added type hints and fixed line overflows
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed incompatable type examples
* Update maths/maclaurin_sin.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* changed error details
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed grammatical errors
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* improved function accuracy and added test case
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update maths/maclaurin_sin.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* removed redundant return
* fixed pytest
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Implemented Gelu Function
* Renamed file and added more description to function
* Extended the name GELU
* Update gaussian_error_linear_unit.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added some more comments
added some more comments (to formulas which need it) which make the code more readable and understandable. might make a list of all the formulas on the top, later
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply suggestions from code review
* The order changes the result
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix long line
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Create weird_number.py
In number theory, a weird number is a natural number that is abundant but not semiperfect
* check
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* resolved
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed
* Update weird_number.py
* Update weird_number.py
* Update weird_number.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add surface area of cuboid, conical frustum
* add tests for floats, zeroes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add files via upload
Python program to determine whether a number is Carmichael Number or not.
* Rename Carmichael Number.py to carmichael number.py
* Rename carmichael number.py to carmichael_number.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update carmichael_number.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Create carmichael_number.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update maths/carmichael_number.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add Catalan number to maths
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Added algorithm for creating Hamming numbers series in Python
* Changed to f-string format.
* Added modifications
* Update and rename hamming.py to hamming_numbers.py
* Update hamming_numbers.py
* Update hamming_numbers.py
* Rename maths/series/hamming_numbers.py to maths/hamming_numbers.py
Co-authored-by: John Law <johnlaw.po@gmail.com>
* renames prime functions and occurances in comments
* changes implementation of primality testing to be uniform
* adds static typing as per conventions
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Added average absolute deviation
* Formats program with black
* reruns updated pre commit
* Update average_absolute_deviation.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add points are collinear in 3d algorithm to /maths
* Apply suggestions from code review in points_are_collinear_3d.py
Thanks to cclauss.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Rename some variables to be more self-documenting.
* Update points_are_collinear_3d.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* The black formatter is no longer beta
* pre-commit autoupdate
* pre-commit autoupdate
* Remove project_euler/problem_145 which is killing our CI tests
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Rewrite parts of Vector and Matrix methods
* Refactor determinant method and add unit tests
Refactor determinant method to create separate minor and cofactor
methods.
Add respective unit tests for new methods.
Rename methods using snake case to follow Python naming conventions.
* Reorganize Vector and Matrix methods
* Update linear_algebra/README.md
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Fix punctuation and wording
* Apply suggestions from code review
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Deduplicate euclidean length method for Vector
* Add more unit tests for Euclidean length method
* Fix bug in unit test for euclidean_length
* Remove old comments for magnitude method
* Rewrite maths/fibonacci.py
* Rewrite timer and add unit tests
* Fix typos in fib_binet unit tests
* Fix typos in fib_binet unit tests
* Clean main method
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Rewrite parts of Vector and Matrix methods
* Refactor determinant method and add unit tests
Refactor determinant method to create separate minor and cofactor
methods.
Add respective unit tests for new methods.
Rename methods using snake case to follow Python naming conventions.
* Reorganize Vector and Matrix methods
* Update linear_algebra/README.md
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Fix punctuation and wording
* Apply suggestions from code review
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Deduplicate euclidean length method for Vector
* Add more unit tests for Euclidean length method
* Fix bug in unit test for euclidean_length
* Remove old comments for magnitude method
* Rewrite maths/fibonacci.py
* Rewrite timer and add unit tests
* Fix typos in fib_binet unit tests
* Fix typos in fib_binet unit tests
* Clean main method
* Merge fibonacci.py and fibonacci_sequence_recursion.py
* Fix fib_binet unit test
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Hexagonal number sequence
A hexagonal number sequence is a sequence of figurate numbers where the nth hexagonal number hₙ is the number of distinct dots in a pattern of dots consisting of the outlines of regular hexagons with sides up to n dots, when the hexagons are overlaid so that they share one vertex.
This program returns the hexagonal number sequence of n length.
* Update hexagonalnumbers.py
* Update hexagonalnumbers.py
* Update hexagonalnumbers.py
* Update hexagonalnumbers.py
* Update and rename hexagonalnumbers.py to hexagonal_numbers.py
* Length must be a positive integer
Co-authored-by: Christian Clauss <cclauss@me.com>
* [mypy] Fix type annotation in euler_method.py
In line with issue #4052.
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* 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