* Precision must be a nonnegative integer
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* consists of area of various geometrical shapes
In this program it consists of various area calculation of different geometrical shapes such as (square,rectangle) and many other shapes.
* print(f'Rectangle: {area_rectangle(10, 20)=}')
* Update area.py
* Areas of various geometric shapes:
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added file aliquot_sum.py containing a function to find theo
* Added parameter type info to aliquot_sum.py
* Update maths/aliquot_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update maths/aliquot_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Updated code to raise ValueErrors if input is bad
* Fixed logical operators
* Removed unnecessary import
* Updated aliquot_sum.py
* fixed formatting
* fixed documentation
Co-authored-by: Christian Clauss <cclauss@me.com>
* improved prime number generator to check only up to sqrt(n) instead of n
* added old version as slow_primes() and named new, faster version primes()
* fixed docstring in slow_primes
* Add a timeit benchmark
* Update prime_numbers.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix astar
Single character variable names are old school.
* fixup! Format Python code with psf/black push
* Tuple
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Deal with maps
Try with the search term "pizza" to see why this was done in #1932
* fixup! Format Python code with psf/black push
* Update armstrong_numbers.py
* updating DIRECTORY.md
* Update crawl_google_results.py
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Rename math/add.py to maths/add.py
* fixup! Format Python code with psf/black push
* Fix sum to add
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Add Monte Carlo estimation of PI
* Add type annotations for Monte Carlo estimation of PI
* Compare the PI estimate to PI from the math lib
* accuracy -> error
* Update pi_monte_carlo_estimation.py
Co-authored-by: John Law <johnlaw.po@gmail.com>
* spelling corrections
* review
* improved documentation, removed redundant variables, added testing
* added type hint
* camel case to snake case
* spelling fix
* review
* python --> Python # it is a brand name, not a snake
* explicit cast to int
* spaces in int list
* "!= None" to "is not None"
* Update comb_sort.py
* various spelling corrections in documentation & several variables naming conventions fix
* + char in file name
* import dependency - bug fix
Co-authored-by: John Law <johnlaw.po@gmail.com>
* estimate area under a curve defined by non-negative real-valued continuous function within a continuous interval using monte-carlo
* run black; update comments
* Use f”strings” and drop unnecessary returns
Co-authored-by: Christian Clauss <cclauss@me.com>
* add example to estimate area under line using montecarlo
* separate estimate func and print statements
* use mean from stats package
* avoid creating extra variable
* min_value: float=0.0, max_value: float=1.0
* Update montecarlo.py
* Update montecarlo.py
* Rename montecarlo.py to monte_carlo.py
* Update monte_carlo.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add Chudnovskys algorithm for calculating many digits of pi
* Update return value type hint
* Initialize partial sum to be of type Decimal
* Update chudnovsky_algorithm.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Create Bisection.py
Find root of
* Update Bisection.py
* Update Bisection.py
i changed the given function with one that i could make the doctests.
* Rename Bisection.py to bisection.py
* Update bisection.py
* Update bisection.py
* Update bisection.py
* Update bisection.py
* Update bisection.py
Made the changes that were requested
* Update bisection.py
* Update bisection.py
* Add wiki url
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added montecarlo.py
This algorithm uses a Monte Carlo simulation to estimate the value of pi.
* Rename montecarlo.py to maths/montecarlo.py
* Add files via upload
* Delete montecarlo.py
* Rename montecarlo.py to maths/montecarlo.py
* Update montecarlo.py
- Add more doctests and type checking to make sure only natural
numbers are used
- Simplified the algorithm slightly
This new verison is also between 10-15% faster for really
long sequences
* A recursive insertion sort
* added doctests and typehints
* Added arc length and numerical integration calculators
* fixed doc test
* Fixed some conversion errors
* Fixed some commenting
* Deleted numerical integration to allow 1 file per push
* Changed string formatting method
* Added program to calculate trapezoidal area under curve
* Deleted files ensure 1 pull request per file
* file name changed
* Update area_under_curve.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added to maths and strings
* added changes suggest by cclauss
* added square root function
* Fixed type hinting
* fixed type error
* Fixed another type error
* update volumes with type hints + some refactoring
* added docstrings
* Use float instead of ints in doctest results
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added binary exponentiaion with respect to modulo
* Added miller rabin: the probabilistic primality test for large numbers
* Removed unused import
* Added test for miller_rabin
* Add test to binary_exp_mod
* Removed test parameter to make Travis CI happy
* unittest.main() # doctest: +ELLIPSIS ...
* Update binary_exp_mod.py
* Update binary_exp_mod.py
* Update miller_rabin.py
* from .prime_check import prime_check
Co-authored-by: Christian Clauss <cclauss@me.com>
* Harmonic Geometric and P-Series Added
* Editing comments
* Update and rename series/Geometric_Series.py to maths/series/geometric_series.py
* Update and rename series/Harmonic_Series.py to maths/series/harmonic_series.py
* Update and rename series/P_Series.py to maths/series/p_series.py
* improved prime numbers implementation
* fixup! Format Python code with psf/black push
* fix type hint
* fixup! Format Python code with psf/black push
* fix doctests
* updating DIRECTORY.md
* added prime tests with negative numbers
* using for instead filter
* updating DIRECTORY.md
* Remove unused typing.List
* Remove tab indentation
* print("Sorted order is:", " ".join(a))
* Factors of a number
* Update factors.py
* Fix mypy issue in basic_maths.py
* Fix mypy error in perceptron.py
* def primes(max: int) -> List[int]:
* Update binomial_heap.py
* Add a space
* Remove a space
* Add a space
* Another method added for GCD
* Now doctest fulfilled for added method.
* Update greatest_common_divisor.py
* Now unnecessary white spaces removed.
* Cycle_Detection_Undirected_Graph
Cycle_Detection_Undirected_Graph using Disjoint set DataStructure
* Update greatest_common_divisor.py again
* Again Updated cycle_detection_undirected_graph.py
* Delete cycle_detection_undirected_graph.py
* Add doctests and format the code with psf/black
* fixup: Typo
* Update greatest_common_divisor.py
* greatest_common_divisor()
* some pytest on math folder
* Run the test function via a doctest
Also format the code with psf/black as discussed in CONTRIBUTING.md
* Update abs.py
* Update average_mean.py
* Implementation of Hardy Ramanujan Algorithm
* added docstrings
* added doctests
* Run Python black on the code
* Travis CI: Upgrade to Python 3.8
* Revert to Python 3.7
* renamed module to extend the acronym
* add type hints (will not work with Python less than 3.4)
* update docstring
* refactor the function
* add unittests for the least common squares multiple
* Add Kth lexicographic permutation
Function that computes the kth lexicographic permtation of 0,1,2,...,n-1 in O(n^2) time
* Update kth_lexicographic_permutation.py
Addressed requested changes
* Add radix2 FFT
Created a dynamic implementation of the radix - 2 Fast Fourier Transform for fast polynomial multiplication.
Reference: https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm#The_radix-2_DIT_case
* Rename radix2_FFT.py to radix2_fft.py
* Update radix2_fft printing
Improved the printing method with f.prefix and String.join()
* __str__ method update
* Turned the tests into doctests
* Create Quadratic Equations(Complexes Numbers)
Created function that solves quadratic equations treating the cases with complexes numbers. Giving an answer with the imaginary unit "i".
* Update Quadratic Equations(Complexes Numbers)
Since there was no response from the owner of this PR, I made this little change which I hope will solve the issue!
* Add Lucas_Lehmer_primality_test
* Add explanation for Lucas_Lehmer_primality_test
* Update and rename Lucas_Lehmer_primality_test.py to lucas_lehmer_primality_test.py
* LargestOfVeryLargeNumbers
Finds the largest among two very large numbers of the form x^y. Numbers like 512^513 etc
* Rename LargestOfVeryLargeNumbers to LargestOfVeryLargeNumbers.py
* Input() statements have been indented.
input() statements are indented under if __name__ == "__main__":
* largest_of_very_large_numbers.py
Both of the two files implemented sieve of eratosthenes.
However, there was a bug in other/finding_primes.py, and the time complexity was larger than the other.
Therefore, remove other/finding_primes.py and add doctest tomaths/sieve_of_eratosthenes.py.