Commit Graph

87 Commits

Author SHA1 Message Date
Du YuanChao
8c443ccfad add floor() (#1551)
* ceil and floor

* ceil and floor
2019-11-04 08:28:51 +01:00
Du YuanChao
814750e637 update factorial (#1535)
* update factorial

* update factorial
2019-10-31 13:45:32 +01:00
Du YuanChao
6d44cdd315 perfect square (#1534)
* perfect square

* perfect square
2019-10-31 12:33:40 +01:00
LokiUvaraj
63433616c9 average_mode.py (#1491)
* Add files via upload

Finds the mode in the input data.

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Tabs do not belong in Python files!
2019-10-30 00:26:28 +01:00
himanshujain171
53ff735701 Factors of a number (#1493)
* 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
2019-10-29 23:54:30 +01:00
percy07
f8e97aa597 Update basic_maths.py (#1517)
* Update basic_maths.py

Add Doctests.

* Update basic_maths.py

* Add a space to fix the doctest
2019-10-29 21:54:31 +01:00
5ur3
4880e5479a Create prime_numbers.py (#1519)
* Create prime_numbers.py

* Update prime_numbers.py
2019-10-29 21:28:51 +01:00
percy07
e3d4d2bb57 Update greatest_common_divisor.py (#1513)
Add Doctests.
2019-10-29 11:06:37 +01:00
Du YuanChao
3fc276ca2c rename and add doctest (#1501) 2019-10-28 13:50:36 +01:00
Deekshaesha
8a5b1abd0a finding max (#1488)
* Update find_max.py

* Update find_max.py

* Format with psf/black and add doctests
2019-10-28 09:14:53 +01:00
ArjunwadkarAjay
bc52aa6d4d Some grammatical and spelling corrections (#1475) 2019-10-27 18:37:25 +01:00
prathmesh1199
a57809af9c Added binomial coefficient (#1467)
* Added binomial coefficient

* Format code with psf/black and add a doctest
2019-10-26 11:18:28 +02:00
Ankur Chattopadhyay
7592cba417 psf/black code formatting (#1421)
* added sol3.py for problem_20

* added sol4.py for problem_06

* ran `black .` on `\Python`
2019-10-22 19:13:48 +02:00
Ghulam Mohiyuddin
7444a1f069 Another method added for GCD (#1387)
* 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()
2019-10-22 11:26:06 +02:00
moita69
f93cce66a6 some pytest on math folder (#1405)
* 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
2019-10-21 22:36:33 +02:00
Shubham Lad
a06995a686 add simple improved Sieve Of Eratosthenes Algorithm (#1412)
* add simple improved Sieve Of Eratosthenes Algorithm

* added doctests

* name changed
2019-10-21 20:10:19 +02:00
Stephen
afeb13bbc8 added explicit euler's method (#1394)
* added explicit euler's method

* update explicit_euler.py variable names
2019-10-21 19:19:43 +02:00
Stephen
dbf904f438 added runge-kutta (#1393) 2019-10-19 17:11:05 +08:00
Alfin_William
5c351d81bf Implementation of Hardy Ramanujan Algorithm in /maths (#1355)
* 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
2019-10-19 06:02:38 +02:00
Phyllipe Bezerra
455509acee Add Topological Sort (#1302)
* add topological sort

* fix topological sort?

* running black

* renaming file
2019-10-18 08:13:58 +02:00
Yurii
3cc3531076 Feature/update least common multiple (#1352)
* 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
2019-10-18 07:35:29 +02:00
Yurii
870eebf349 rewrite the algorithm from scratch (#1351) 2019-10-18 07:27:55 +02:00
Stephen
14c23bc847 create qr_decomposition (#1363) 2019-10-18 06:48:16 +02:00
Du YuanChao
83c104e839 Divide and Conquer (#1308)
Thanks for your persistence!
2019-10-18 06:20:36 +02:00
Stephen
927a8c7722 added horner's method (#1360) 2019-10-17 16:50:51 +02:00
Aliabbas Merchant
b190c8f629 Rename GCD File (#1354) 2019-10-15 00:05:51 +05:30
Rishabh Kumar
61f7f94fde Create karatsuba.py (#1309)
* Create karatsuba.py

Added karatsuba algorithm for multiplication of two numbers

* Update karatsuba.py

Added doctests and divmod

* Update karatsuba.py
2019-10-08 17:25:50 +05:00
Du YuanChao
f0568d642e less code (#1292) 2019-10-08 13:24:01 +05:00
Maram Sumanth
22bd6ff967 Update average_mean.py (#1293) 2019-10-07 23:26:40 +05:00
TheRealDarkCoder
0a7d387acb Added a python script for finding sum of arithmetic series (#1279)
* Added a python script for finding sum of arithmetic series

* Added some linting

* Resolved comments

* Fixed flake8 test
2019-10-06 23:47:32 +05:00
Nikhil Nayak
c4a97677a5 Update fibonacci_sequence_recursion.py (#1287)
- Fixed minor bugs.
 - Minimized Codes
2019-10-06 23:35:56 +05:00
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
Kaushik Amar Das
07f04a2e55 adding jaccard similarity (#1270)
* adding jaccard similarity

* renaming files. zeebus! what an headache
2019-10-04 09:59:45 +02:00
Kaushik Amar Das
0e2d6b2963 adding softmax function (#1267)
* adding softmax function

* wraped lines as asked
2019-10-03 16:30:36 +02:00
Shoaib Asgar
b738281f2b maths-polynomial_evalutation (#1214)
* maths-polynomial_evalutation

* added doctest and removed redundancy
2019-10-01 08:58:00 +02:00
Christian Clauss
a79fc2b92a Fix the build typo: fn --> fn1 (#1205) 2019-09-26 21:02:04 +05:30
Aniruddha Bhattacharjee
e40d4a25f9 Added Matrix Exponentiation (#1203)
* Added the matrix_exponentiation.py file in maths directory

* Implemented the requested changes

* Update matrix_exponentiation.py
2019-09-25 20:08:45 +02:00
Kiril Bangachev
47d17951b8 Add Kth lexicographic permutation (#1179)
* 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
2019-09-13 13:13:55 +02:00
KirilBangachev
a41a14f9d8 Add radix2 FFT (#1166)
* 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
2019-09-06 11:06:56 +02:00
Christian Clauss
47a9ea2b0b
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python

* sort() --> sorted()
2019-08-19 15:37:49 +02:00
Christian Clauss
c74fd0c9bf
Add maths/test_prime_check.py (#1125)
* Add maths/test_prime_check.py

* Add comments on why this file is required
2019-08-13 11:50:13 +02:00
Christian Clauss
7cf3db1843
Add test for QuadraticEquation() (#1107) 2019-08-06 21:32:27 +02:00
Christian Clauss
89acf5d017 print() is a function just like every other function (#1101)
* print() is a function just like every other function
2019-08-06 12:14:23 +02:00
Harshil
6654e1ec7d remove from __future__, propre filename (#1102) 2019-08-06 11:41:23 +02:00
AugustofCravo
22d2453773 Create Quadratic Equations(Complexes Numbers) (#941)
* 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!
2019-08-06 02:22:34 +02:00
Marvin M. Michum
bdbe682568
Zeller's Congruence Algorithm (#1095)
* doctest updates

* remove unused math import

* cleanup (suggestions)

* cleanup - Dict fix (TravisCI error)
2019-08-04 23:22:28 -04:00
Sanders Lin
9c0cbe3307 Create collatz_sequence.py (#639)
* Create  collatz_sequence.py

* Update and rename collatz_sequence.py to maths/collatz_sequence.py

* doctest
2019-08-01 23:54:03 +08:00
obelisk0114
861a8c3631 Add Lucas_Lehmer_primality_test (#1050)
* 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
2019-07-30 18:00:24 +02:00
Abhijeeth S
7b2c954169 LargestOfVeryLargeNumbers (#818)
* 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
2019-07-30 08:47:54 +02:00
obelisk0114
46bc6738d7 Add doctest to maths/sieve_of_eratosthenes.py and remove other/finding_primes.py (#1078)
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.
2019-07-26 12:25:38 +02:00