Commit Graph

73 Commits

Author SHA1 Message Date
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
Christian Clauss
3c8e9314b6 Travis CI: Add a flake8 test for unused imports (#1038) 2019-07-25 13:19:00 +05:30
QuantumNovice
c964d743b6 Added Mobius Function (#1058)
* Add files via upload

* Update mobius_function.py

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update mobius_function.py

* Delete mobius_function.py

* Add files via upload
2019-07-21 10:35:42 +02:00
Christian Clauss
93fdc9f2a1 Travis CI: Add pytest --doctest-modules maths (#1020)
* Travis CI: Add pytest --doctest-modules maths

* Update lucas_series.py

* Update lucas_series.py
2019-07-21 11:46:28 +05:30
QuantumNovice
61fec83242 Adds Gaussian Function in maths section (#1054)
* Create gaussian.py

* Update gaussian.py

* Update gaussian.py

* Create gaussian.png

* Add files via upload

* Create prime_factors.py

* Update prime_factors.py

* Update prime_factors.py
2019-07-20 14:32:40 +02:00
thiru15
9f8953dc0c Update find_lcm.py (#1019)
* Update find_lcm.py

Improved code quality and added comments.

* Make the doctests work
2019-07-18 23:40:51 +02:00
cclauss
9a55f2b36a Remove the space: lucas series.py --> lucas_series.py (#1036) 2019-07-19 00:15:54 +08:00
Sanders Lin
1e0b33d3dd Update 3n+1.py (#996)
* Update 3n+1.py

Made variable names more meaningful and removed nested functions.

* Update 3n+1.py

* Update 3n+1.py

* Update 3n+1.py
2019-07-13 09:04:43 +02:00
Sanders Lin
c2f2fa8b23 Update abs_Min.py (#1004)
* Update abs_Min.py

* Create __init__.py

* Rename abs_Min.py to abs_min.py

* Update abs_min.py
2019-07-11 18:20:41 +02:00
Alfonso Rodríguez Pereira
5f991f7740 #315 Renamed all files to snake_case (#993) 2019-07-11 11:16:42 +02:00
Sanders Lin
b79a197e8c Update abs_Max.py (#997)
* Update abs_Max.py

fix docstring for doctest to work properly (add space after >>>)

* Update abs_Max.py
2019-07-11 06:43:03 +02:00
Sanders Lin
37fbd8ca2e Update average_median.py (#998)
added doctest, fixed TypeError: list indices must be integers or slices, not float error due to number/2 producing float as index.
2019-07-10 22:38:10 +02:00
PatOnTheBack
897f1d0fb4 Improved Formatting and Style of Math Algos (#960)
* Improved Formatting and Style

I improved formatting and style to make PyLama happier.

Linters used:

- mccabe
- pep257
- pydocstyle
- pep8
- pycodestyle
- pyflakes
- pylint
- isort

* Create volume.py

This script calculates the volumes of various shapes.

* Delete lucasSeries.py

* Revert "Delete lucasSeries.py"

This reverts commit 64c19f7a6c.

* Update lucasSeries.py
2019-07-10 22:09:24 +02:00
PatOnTheBack
add1aef064 Rename average.py to average_mean.py (#939)
'average.py' is ambiguous. There are several kinds of averages, so 'average_mean.py' is a more precise name.
2019-07-10 07:21:04 +02:00
PatOnTheBack
2b365284c8 Removed Unnecessary Assignment for 'error' Var (#920)
`error = abs(f(a))` was declared on line 24 and line 32. It is unnecessary to have in both places.
I removed the second instance since it wastes resources to keep redefining the variable inside the for loop.
This fixes an [issue found by lgtm](66c4afbd0f/files/maths/newton_raphson.py)
2019-07-07 23:45:42 +08:00