Commit Graph

187 Commits

Author SHA1 Message Date
Christian Clauss
1c62bd10c1
Precision must be a nonnegative integer (#2013)
* 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>
2020-05-19 15:46:20 +05:30
Adityanagraj
e6fdcc90fd
consists of area of various geometrical shapes (#2002)
* 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>
2020-05-18 23:06:19 +02:00
Kenneth P
77f3888b71
Pi digit extraction algorithm (#1996)
* added pi digit extraction formula

* updating DIRECTORY.md

* fixed typo in a comment

* updated bbp_formula.py

* Update maths/bbp_formula.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update maths/bbp_formula.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update bbp_formula.py

* Update and rename bbp_formula.py to bailey_borwein_plouffe.py

* updating DIRECTORY.md

* calculate

* "".join(bailey_borwein_plouffe(i) for i in range(1, 12))

* Update bailey_borwein_plouffe.py

* Update bailey_borwein_plouffe.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-18 22:54:08 +02:00
Christian Clauss
565060aa99
actions/setup-python@v2 (#1986)
* actions/setup-python@v2

* fixup! Format Python code with psf/black push

* Update autoblack.yml

* updating DIRECTORY.md

* Update codespell.yml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-16 08:49:56 +02:00
Kenneth P
a29a2a3a06
Added file aliquot_sum.py (#1985)
* 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>
2020-05-15 08:06:51 +02:00
Steven Qu
c8fbdee229
improved prime number generator to check only up to sqrt(n) instead of n (#1984)
* 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>
2020-05-15 00:33:50 +02:00
Christian Clauss
a7cd633bb6
Fix astar (#1966)
* 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>
2020-05-10 20:49:40 +05:30
Raj-Parekh24
eef6393935
Kadanes_algorithm (#1959)
* Add files via upload

* Update Kadane's_algorithm.py

* Update and rename Kadane's_algorithm.py to kadanes_algorithm.py

* Update kadanes_algorithm.py

* Update kadanes_algorithm.py

* Update kadanes_algorithm.py

* Update kadanes_algorithm.py

* Update kadanes_algorithm.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-09 21:00:59 +02:00
Christian Clauss
08c8bb5ad5
Deal with maps (#1945)
* 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>
2020-05-06 03:32:40 +02:00
Akash
f80ffe1f54
added method for checking armstrong number (#1936)
* added method for checking armstrong number

* Update comment

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-03 19:56:33 +02:00
Christian Clauss
6acd7fb5ce
Wrap lines that go beyond GitHub Editor (#1925)
* Wrap lines that go beyond GiHub Editor

* flake8 --count --select=E501 --max-line-length=127

* updating DIRECTORY.md

* Update strassen_matrix_multiplication.py

* fixup! Format Python code with psf/black push

* Update decision_tree.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 23:36:35 +02:00
Christian Clauss
f6ee518ee1
Rename math/add.py to maths/add.py (#1857)
* 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>
2020-04-13 07:50:46 +02:00
Christian Clauss
f17e9822b0
psf/black changes to next_greater_element.py (#1817)
* psf/black changes to next_greater_element.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-28 07:24:59 +01:00
wind-Lv
ac664df6a0
'allocation_content_length' (#1808)
* 'allocation_content_length'

* 'allocation_number'

* Delete allocation_content_length.py

* Update allocation_number.py

* Update allocation_number.py

* number_of_bytes and partitions

* Update allocation_number.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-20 15:24:05 +01:00
Christian Clauss
ab3400bfad
Travis CI: Fix Travis linter errors (#1802)
* Travis CI: Fix Travis linter errors

* fixup! Format Python code with psf/black push

* Update .travis.yml

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-14 23:55:13 +01:00
cschuerc
1bc84e1fa0
Add Monte Carlo estimation of PI (#1712)
* 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>
2020-03-14 07:51:30 +01:00
yoshitaka-i
5e3eb12a7b
add relu function (#1795) 2020-03-13 08:33:36 +01:00
matkosoric
7f04e5cd34
contribution guidelines checks (#1787)
* 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>
2020-03-04 13:40:28 +01:00
singlav
5543d14b3f
estimate area under a curve defined by non-negative real-valued continuous function within a continuous interval using monte-carlo (#1785)
* 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>
2020-02-23 08:10:50 +01:00
singlav
b36e46b9b2
extend estimation of area under curve of y=x using monte carlo simulation to any given lower and upper bound (#1784)
* extend estimation of area under curve of y=x using monte carlo simulation to any given lower and upper bound

* remove doctest
2020-02-22 23:33:12 +01:00
singlav
6d7cbdacb1
add example to estimate area under line using montecarlo (#1782)
* 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>
2020-02-22 19:06:47 +01:00
Christian Clauss
59bf115aa1
uses: actions/checkout@v2 (#1779)
* uses: actions/checkout@v2

* fixup! Format Python code with psf/black push
2020-02-21 15:32:35 +05:30
Iqrar Agalosi Nureyza
6b3bbc70a8
Added doctests in modular_exponential.py (#1775)
* added doctests in modular_exponential.py

* added doctests in modular_exponential.py

* added URL link
2020-02-20 12:29:01 +01:00
TheSuperNoob
d2f7982a4e
Update quadratic equations solver (#1764)
Use pythons complex number module cmath for the calculation of the
roots
2020-02-20 00:15:55 +05:30
Naveen M V
748702b461
Add Monte Carlo dice simulation algorithm (#1759)
* Implement basic dice simulation

* Add tests to throw_dice

* Fix comment

* Add type hints

* Add additional comments

* Update monte_carlo_dice.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-17 10:55:04 +01:00
onlinejudge95
4866b1330b
Fixes black failures from Previous PR (#1751)
* Fixes black failures from Previous PR

* Fixes equality testing alert

* Fixes call to main() alert

* Fixes unused import
2020-02-13 02:19:41 +05:30
TheSuperNoob
f0dfc4f46d
Add Chudnovskys algorithm for calculating many digits of pi (#1752)
* 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>
2020-02-12 15:04:59 +01:00
billpaps
fde31c93a3
Added Bisection algorithm (#1739)
* 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>
2020-02-11 09:20:24 +01:00
onlinejudge95
80718bd880 Fixes black failures (#1742) 2020-02-10 11:43:57 +01:00
MatteoRaso
32ceec550f
Added a Monte Carlo simulation (#1723)
* 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
2020-02-09 02:17:11 +05:30
TheSuperNoob
1608d75351
Improve collatz_sequence algorithm (#1726)
- 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
2020-02-07 02:30:08 +05:30
Christian Clauss
46ac50a28e codespell --quiet-level=2 (#1711)
* codespell --quiet-level=2

Suppress the BINARY FILE warnings

* fixup! Format Python code with psf/black push
2020-01-24 00:21:51 +08:00
kostogls
2cf7e8f994 fix comment (#1710)
* fix comment

* Update armstrong_numbers.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-22 17:00:48 +01:00
kostogls
9a8e7de2df Adding Armstrong number (#1708)
* Adding Armstrong number

* Update armstrong_numbers

* Update armstrong_numbers.py

* Update armstrong_numbers.py

* Update armstrong_numbers.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-22 16:35:30 +01:00
Sharan Krishnan
3042702d04 Area Under a Curve Algorithm (#1701)
* 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>
2020-01-19 05:21:12 +01:00
Sharan Krishnan
e25d4248a3 Added an algorithm that approximates line lengths (#1692)
* 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
2020-01-19 01:25:27 +08:00
Pooja
99ebd1a018 Create factorial_iterative.py (#1693)
* Create factorial_iterative.py

* Update factorial_iterative.py

* Update factorial_iterative.py

* Update factorial_iterative.py

* print(f"factorial{n} is {factorial(n)}")

* Update factorial_recursive.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-18 14:06:48 +01:00
Christian Clauss
bfcb95b297
Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
Cole Mollica
38bad6b1e8 Implemented Square Root Algorithm (#1687)
* Added to maths and strings

* added changes suggest by cclauss

* added square root function

* Fixed type hinting

* fixed type error

* Fixed another type error
2020-01-15 22:21:26 +01:00
Cole Mollica
a26ae00b24 Added to maths and strings (#1642)
* Added to maths and strings

* added changes suggest by cclauss
2020-01-08 14:18:17 +01:00
Yurii
1cc817bcc9 update volumes with type hints + some refactoring (#1353)
* 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>
2020-01-05 07:19:29 +01:00
Christian Clauss
28419cf839 pyupgrade --py37-plus **/*.py (#1654)
* pyupgrade --py37-plus **/*.py

* fixup! Format Python code with psf/black push
2020-01-03 22:25:36 +08:00
Anzo Teh
725834b9bc Added binary exponentiaion with respect to modulo (#1428)
* 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>
2019-12-24 07:23:15 +01:00
Muhammad Ibtihaj Naeem
bc5b92f7f9 Harmonic Geometric and P-Series Added (#1633)
* 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
2019-12-14 06:46:02 +01:00
heartsmoking
d385472c6f Update find_min.py (#1627)
Line 5:     :return: max number in list   
"max" must be "min"
2019-12-11 07:57:08 +01:00
GeorgeChambi
9eb50cc223 Improved readability (#1615)
* improved readability

* further readability improvements

* removed csv file and added f
2019-12-07 06:39:59 +01:00
Níkolas Vargas
938dd0bbb5 improved prime numbers implementation (#1606)
* 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))
2019-12-07 06:39:08 +01:00
Abhijit Patil
74aeaa333f Code for Eulers Totient function (#1229)
* Create eulersTotient.py

* Rename eulersTotient.py to eulers_totient.py

* Update eulers_totient.py
2019-12-01 06:58:25 +01:00
Bruno Santos
4dca9571db Pythagoras (#1243)
* add pythagoras.py

* function distance

* run as script

* Update pythagoras.py
2019-12-01 06:29:23 +01:00
Christian Clauss
5df8aec66c
GitHub Action formats our code with psf/black (#1569)
* GitHub Action formats our code with psf/black

@poyea Your review please.

* fixup! Format Python code with psf/black push
2019-11-14 19:59:43 +01:00
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