Commit Graph

209 Commits

Author SHA1 Message Date
Christian Clauss
4535283554
Re-blacken (#2246)
* Avoid double spaces

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-01 09:23:23 +05:30
aryan26roy
373f193c6d
Correcting the Gaussian Formula (#2249)
* Correcting the Gaussian Formula

I have added the parenthesis around the 2*sigma^2 term.

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 21:32:36 +02:00
Utsav Akash Naskar
c7a5f1673e
Python Program to Check Krishnamurthy Number (#2248)
* Added Python Program to Check Perfet Number

* CodeSpell Error Fix - 1

* Build Error Fix - 1

* Made suggested changes

* Use generator expression

* Added Python Program to Check Krishnamurthy Number or not

* Added Python Program to Check Krishnamurthy Number

* Added Python Program to Check Krishnamurthy Number or not

* Build Error Fix - 1

* Build Error Fix - 2

* Fix Brackets positions

* Fix Character Exceeding Error

* Made Review Changes

* Build Error Fix - 3

* Build Error Fix - 4

* Update krishnamurthy_number.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 10:54:05 +02:00
Utsav Akash Naskar
9ea144f3bd
Added Python Program to Check Perfect Number (#2244)
* Added Python Program to Check Perfet Number

* CodeSpell Error Fix - 1

* Build Error Fix - 1

* Made suggested changes

* Use generator expression

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-28 09:59:44 +02:00
lance-pyles
093a56e3c2
Remove function overhead in area (#2233)
* remove function overhead
add type hints

* remove unused import
2020-07-27 21:29:31 +08:00
Utsav Akash Naskar
dfb4ce4074
Added Finding Exponent Program (#2238)
* Finding Exponent Program

* Build Error Fix - 1

* Build Error Fix - 2

* Error Fix - 1 datatype

* self-documenting naming convension added

* Update and rename exponent_recursion.py to power_using_recursion.py

* Fix typo

* Fix typo

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-27 11:33:13 +02:00
Vasu Gamdha
e296f7b3ff
Updated maths/number_of_digits.py (#2221)
* Updated number_of_digits.py

Added two more methods!

* Update number_of_digits.py

* Update number_of_digits.py

* Added benchmarks!

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py
2020-07-26 12:42:18 +02:00
lance-pyles
b3950035a6
update variable names for consistency using standard formula terms; (#2223)
* update variable names for consistency using standard formula terms;

fix flake8 syntax errors;

fix doctests;

* tweak to variable name
2020-07-23 00:49:34 +02:00
XxSamixX123
749ffd8c6f
Added a binomial distribution formula calculator algorithm (#2197)
* Add files via upload

* Update binomial_distribution.py

* Update maths/binomial_distribution.py

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

* Update binomial_distribution.py

* Update maths/binomial_distribution.py

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

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-13 22:18:37 +02:00
Advik Kulkarni
6c2c08c076
sum_of_geometric_progression (#2168)
* Add files via upload

* Rename sum_of_Geometric_Progression.py to sum_of_geometric_progression.py

* Update sum_of_geometric_progression.py

* Update maths/sum_of_geometric_progression.py

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

* Update maths/sum_of_geometric_progression.py

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

* Update maths/sum_of_geometric_progression.py

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

* Update sum_of_geometric_progression.py

* Update sum_of_geometric_progression.py

* Type hints and test for zeros and negative numbers

* Update sum_of_geometric_progression.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-10 14:56:43 +02:00
lance-pyles
48df91d48b
Add surface area class (#2183)
* add surface area class

* add new line to end of file

* move surface area class into area class

* add missing import

* added pi import

* fix typo

* added blank line

* fixed more import issues

* comment fix

* comment fixes
2020-07-07 00:21:59 +02:00
Christian Clauss
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
Christian Clauss
f97af65579
Blacken our code (#2125)
* Blacken

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-17 06:59:38 +08:00
beqakd
924ef9b7d8
implementation of entropy algorithm. (#2110)
* implementation of entropy algorithm.

* add tests, fix requested changes

* open_file() --> analyze_text()

* Create bidirectional_breadth_first_search.py

* # type: ignore

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-16 21:36:57 +02:00
Christian Clauss
b9e5259aeb
Fix long line, tests (#2123)
* Fix long line

* updating DIRECTORY.md

* Add doctest

* ...

* ...

* Update tabu_search.py

* space

* Fix doctest

    >>> find_neighborhood(['a','c','b','d','e','a'])  # doctest: +NORMALIZE_WHITESPACE
    [['a','e','b','d','c','a',90], [['a','c','d','b','e','a',90],
     ['a','d','b','c','e','a',93], ['a','c','b','e','d','a',102],
     ['a','c','e','d','b','a',113], ['a','b','c','d','e','a',93]]

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-06-16 14:29:13 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Nika Losaberidze
8bb7b8f457
Fix syntax for flake8 passing (#2096)
* Fix syntax for flake8 passing

* fixup! Format Python code with psf/black push

* # fmt: off / # fmt: on

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-12 06:51:47 +02:00
Vignesh
3893ed30ca
created perfect_cube.py (#2076)
* created perfect_cube.py

To find whether a number is a perfect cube or not.

* Update perfect_cube.py

* Update perfect_cube.py

* Update perfect_cube.py
2020-06-11 19:36:53 +02:00
Jeffin Francis
7a14285cb6
Harris corner detection (#2064)
* Added Lstm example for stock predection

* Changes after review

* changes after build failed

* Add Kiera’s to requirements.txt

* requirements.txt: Add keras and tensorflow

* psf/black

* haris corner detection

* fixup! Format Python code with psf/black push

* changes after review

* changes after review

* fixup! Format Python code with psf/black push

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-04 16:02:51 +02:00
Vignesh
0904610a76
create sum_of_digits.py (#2065)
* create sum_of_digits.py

create sum_of_digits.py to find the sum of digits of a number
digit_sum(12345) ---> 15
digit_sum(12345) ---> 10

* Update sum_of_digits.py

* Update maths/sum_of_digits.py

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

* Update maths/sum_of_digits.py

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

* Update sum_of_digits.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-02 23:38:32 +02:00
Vignesh
dc720a83d7
Create number_of_digits.py (#1975)
* Create number_of_digits.py

A python program to find the number of digits in a number.

* Update number_of_digits.py

* Update number_of_digits.py

* Add #1976 to get Travis CI to pass

#1976

* Add type hints as discussed in CONTRIBUTING.md

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-01 17:23:15 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
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