Commit Graph

424 Commits

Author SHA1 Message Date
Ravi Kumar
444dfb0a0f
Added adams-bashforth method of order 2, 3, 4, 5 (#10969)
* added runge kutta gills method

* added adams-bashforth method of order 2, 3, 4, 5

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update adams_bashforth.py

* Deleted extraneous file, maths/numerical_analysis/runge_kutta_gills.py

* Added doctests to each function adams_bashforth.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update adams_bashforth.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 00:12:17 +02:00
Tiela Rose Black-Law
34b25c0c76
Add doctest for maths/primelib (#10978) 2023-10-26 14:52:47 +02:00
Ravi Kumar
c71c280726
added runge kutta gills method to maths/ numerical_analysis (#10967)
* added runge kutta gills method

* Apply suggestions from code review

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-26 03:20:28 -04:00
Dale Dai
0e7f8284a3
Add error tests in doctest and fix error message (#10930)
* Add error tests in doctest and fix error message

* Change AssertationError to ValueError

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-26 01:27:46 -04:00
Saptadeep Banerjee
28f4c16132
Tried new TESTS for the binomial_coefficient (#10822)
* Tried new TESTS for the binomial_coefficient

* Fix the tests request

* Update binomial_coefficient.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update binomial_coefficient.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-24 15:46:00 +02:00
Tianyi Zheng
b98312ca9f
Consolidate Newton-Raphson implementations (#10859)
* updating DIRECTORY.md

* updating DIRECTORY.md

* Consolidate Newton-Raphson duplicates

* Rename consolidated Newton-Raphson file

* updating DIRECTORY.md

* updating DIRECTORY.md

* Fix doctest precision

* Fix doctest precision again

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-23 16:37:17 -04:00
Tauseef Hilal Tantary
4cbefadbd7
[New Algorithm] - Triangular Numbers (#10663)
* Add New Algorithm: Triangular Numbers

* Calculate nth triangular number instead of generating a list

* Handle 0th position and update function name and docstring
2023-10-23 09:51:09 -04:00
Tianyi Zheng
a8b6bda993
Delete arithmetic_analysis/ directory and relocate its contents (#10824)
* Remove eval from arithmetic_analysis/newton_raphson.py

* Relocate contents of arithmetic_analysis/

Delete the arithmetic_analysis/ directory and relocate its files because
the purpose of the directory was always ill-defined. "Arithmetic
analysis" isn't a field of math, and the directory's files contained
algorithms for linear algebra, numerical analysis, and physics.

Relocated the directory's linear algebra algorithms to linear_algebra/,
its numerical analysis algorithms to a new subdirectory called
maths/numerical_analysis/, and its single physics algorithm to physics/.

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-23 09:31:30 +02:00
Dale Dai
a9cee1d933
Add perfect cube binary search (#10477)
* Add perfect cube binary search algorithm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add support for testing negative perfect cubes

* Add TypeError check for invalid inputs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-23 01:56:59 -04:00
gio-puter
0601b56173
Add tests without modifying code (#10740)
* Contributes to #9943
Added doctest to largest_of_very_large_numbers.py
Added doctest to word_patterns.py
Added doctest to onepad_cipher.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Contributes to #9943
Added doctest to maths/largest_of_very_large_numbers.py
Added doctest to strings/word_patterns.py
Added doctest to ciphers/onepad_cipher.py

* Add tests without modifying code #10740
Added test to maths/largest_of_very_large_numbers
Added test to strings/word_patterns.py
Added test to ciphers/onepad_cipher.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-22 07:42:26 +02:00
Barun Parua
d9562033f6
added a function to calculate perceived frequency by observer using Doppler Effect (#10776)
* avg and mps speed formulae added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* avg and mps speed formulae added

* fixed_spacing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* spacing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ws

* added amicable numbers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added amicable numbers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* spacing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* removed

* changed name of file and added code improvements

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* issues fixed due to pi

* requested changes added

* Created doppler_effect_of_sound.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated doppler_effect_of_sound.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added desc names

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed spacing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* renamed doppler_effect_of_sound.py to doppler_frequency.py

* used expection handling rather than print statements

* fixed spacing for ruff

* Update doppler_frequency.py

This is super slick!  Well done.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-22 00:33:50 +02:00
Saptadeep Banerjee
4707fdb0f2
Add tests for Perfect_Number (#10745)
* Added new tests!

* [ADD]: Inproved Tests

* fixed

* Removed spaces

* Changed the file name

* Added Changes

* changed the code and kept the test cases

* changed the code and kept the test cases

* missed the line

* removed spaces

* Update power_using_recursion.py

* Added new tests in Signum

* Few things added

* Removed few stuff and added few changes

* Fixed few things

* Reverted the function

* Update maths/signum.py

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

* Added few things

* Update maths/signum.py

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

* Added the type hint back

* Update signum.py

* Added NEW tests for Perfect_Number

* Update maths/special_numbers/perfect_number.py

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

* Added the line back

* Update maths/special_numbers/perfect_number.py

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

* Fixed a space

* Updated

* Reverted changes

* Added the old code and FIXED few LINES

* Fixed few things

* Changed Test CASES

* Update perfect_number.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-22 00:05:37 +02:00
Tianyi Zheng
06edc0eea0
Consolidate binary exponentiation files (#10742)
* Consolidate binary exponentiation files

* updating DIRECTORY.md

* Fix typos in doctests

* Add suggestions from code review

* Fix timeit benchmarks

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-21 13:27:36 -04:00
Saptadeep Banerjee
579937613a
Added New Tests in Signum (#10724)
* Added new tests!

* [ADD]: Inproved Tests

* fixed

* Removed spaces

* Changed the file name

* Added Changes

* changed the code and kept the test cases

* changed the code and kept the test cases

* missed the line

* removed spaces

* Update power_using_recursion.py

* Added new tests in Signum

* Few things added

* Removed few stuff and added few changes

* Fixed few things

* Reverted the function

* Update maths/signum.py

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

* Added few things

* Update maths/signum.py

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

* Added the type hint back

* Update signum.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-20 13:02:30 +02:00
Tianyi Zheng
6f2d6f72d5
Move files for special numbers to own directory (#10714) 2023-10-20 08:17:31 +02:00
Saptadeep Banerjee
4154428351
[ADD]: Improved tests in power recursion! (#10664)
* Added new tests!

* [ADD]: Inproved Tests

* fixed

* Removed spaces

* Changed the file name

* Added Changes

* changed the code and kept the test cases

* changed the code and kept the test cases

* missed the line

* removed spaces

* Update power_using_recursion.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-20 06:29:24 +02:00
Iyiola Aloko
b301e589e2
Update binary_exponentiation.py (#10342)
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-19 08:21:48 -04:00
rtang09
30c8d5573a
Update binary_exponentiation.py (#10253)
* Update binary_exponentiation.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-19 08:15:23 -04:00
rtang09
9adb7ced16
Update primelib.py (#10209)
* Update primelib.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-19 08:02:04 -04:00
Jai Vignesh J
788e4ede9b
Fix doctest power recursion (#10659)
* Added doctests to power_using_recursion.py

* Added doctest to power_using_recursion.py

* Update power_using_recursion.py

* Update power_using_recursion.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-18 00:50:57 +02:00
Dwarkadhish Kamthane
69707bf693
Minimization of while loop in Armstrong Numbers (#9976)
* Minimization of while loop in Armstrong Numbers

The while loop is removed and simple length calculation is used so the task of minimization of while loop is achieved

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-16 04:21:03 -04:00
Yousha Mahamuni
cc0405d05c
Update volume.py with volume of Icosahedron (#9628)
* Update volume.py with volume of Icosahedron

Added function to find volume of a regular Icosahedron

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

* Update volume.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-15 22:47:27 -04:00
Tianyi Zheng
73ebf7bdb1
Move and rename maths/greedy_coin_change.py (#10418)
* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Move greedy_coin_change.py to greedy_methods/ and rename file

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-16 01:42:55 +02:00
Rahul Jangra
b5474ab68a
[ADD] : maths joint probabilty distribution (#10508)
* Create joint_probability_distribution.py

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update joint_probability_distribution.py

* Update joint_probability_distribution.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maclaurin_series.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Revert changes to maclaurin_series.py

* Revert changes to maclaurin_series.py

* Update joint_probability_distribution.py

* Update joint_probability_distribution.py

* Update joint_probability_distribution.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-15 17:03:03 +02:00
Ravi Kumar
777eca813a
Corrected typo in function name and doctests. rkf45.py (#10518)
* Corrected typo in function name and doctests. rkf45.py

There was a mistake in name of function (runge_futta_fehlberg instead of runge_kutta_fehlberg) . I have corrected this in function name and  also doctest.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename rkf45.py to runge_kutta_fehlberg_45.py

* Update runge_kutta_fehlberg_45.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-15 12:55:56 +02:00
Ravi Kumar
7dbc301818
added rkf45 method (#10438)
* added rkf45 method

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated rkf45.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated rkf45.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update rkf45.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update rkf45.py with suggestions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Improved Code Quality rkf45.py

* Added more test cases and exception rkf45.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update rkf45.py

* corrected some spellings. rkf45.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update rkf45.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update rkf45.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-15 11:07:29 +02:00
Dale Dai
9fb0cd271e
Expand euler phi function doctest (#10401) 2023-10-14 02:47:08 -04:00
Saahil Mahato
ebe66935d2
Add Solovay-Strassen Primality test (#10335)
* Add Solovay-Strassen Primality test

* fix: resolve comments

* refactor: docs change
2023-10-13 08:04:48 +02:00
Vipin Karthic
92fbe60082
Added doctests to carmichael_number.py (#10210)
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-11 15:05:24 -04:00
Christian Clauss
3f094fe49d
Ruff pandas vet (#10281)
* Python linting: Add ruff rules for Pandas-vet and Pytest-style

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-11 14:30:02 -04:00
Aasheesh
d5323dbaee
Adding doctests in simpson_rule.py (#10269)
* Adding doctests in simpson_rule.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maths/simpson_rule.py

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

* Update maths/simpson_rule.py

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

* Adding doctests in simpson_rule.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Adding doctests in simpson_rule.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Adding doctests in simpson_rule.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Adding doctests in simpson_rule.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Adding doctests in simpson_rule.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update simpson_rule.py

* Adding doctests in simpson_rule.py

* Adding doctests in simpson_rule.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-11 20:20:18 +02:00
Ricardo Martinez Peinado
5fb6496d1b
Improve primelib.py test coverage #9943 (#10251)
* Update the doctest of primelib.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Correct errors for the doctest of primelib.py

* last error for the doctest of primelib.py

* last error for the doctest of primelib.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-11 12:11:05 +02:00
cornbread-eater
c850227bee
Add doctests to primelib.py (#10242)
* Update primelib.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-10 23:07:07 +02:00
Kamil
9a5a6c663c
carmichael_number - add doctests (#10038)
* Replacing the generator with numpy vector operations from lu_decomposition.

* Revert "Replacing the generator with numpy vector operations from lu_decomposition."

This reverts commit ad217c6616.

* Added doctests

* Update carmichael_number.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update carmichael_number.py

I make an empty commit to reset:
tests are failing.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update carmichael_number.py

Made changes taking into account the addition: 
from maths.greatest_common_divisor import greatest_common_divisor.

Now instead of gcd it is used: greatest_common_divisor.

* Update carmichael_number.py

* Update carmichael_number.py

* Update carmichael_number.py

I added a check for 0 and negative numbers in the tests and the code itself. Simplified obtaining the final result.

* Update carmichael_number.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maths/carmichael_number.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update carmichael_number.py

* Update carmichael_number.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-10 16:14:13 -04:00
Vipin Karthic
6d13603667
Fixes #9943 Added Doctests to binary_exponentiation_3.py (#10121)
* Python mirror_formulae.py is added to the repository

* Changes done after reading readme.md

* Changes for running doctest on all platforms

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Change 2 for Doctests

* Changes for doctest 2

* updating DIRECTORY.md

* Doctest whitespace error rectification to mirror_formulae.py

* updating DIRECTORY.md

* Adding Thermodynamic Work Done Formulae

* Work done on/by body in a thermodynamic setting

* updating DIRECTORY.md

* updating DIRECTORY.md

* Doctest adiition to binary_exponentiation_3.py

* Change 1

* updating DIRECTORY.md

* Rename binary_exponentiation_3.py to binary_exponentiation_2.py

* updating DIRECTORY.md

* updating DIRECTORY.md

* Formatting

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-10 01:52:37 -04:00
AkhilYadavPadala
9c02f1220e
seperation between description and docstrings (#9687)
* seperation between description and docstrings

* Update maths/factorial.py

---------

Co-authored-by: sarayu sree <sarayusreeyadavpadala@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-10 01:13:32 -04:00
Md Mahiuddin
4f8fa3c44a
TypeError for non-integer input (#9250)
* type error check

* remove str input

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-10 00:19:40 -04:00
Dean Bring
b9a797f3d4
Added the Minkowski distance function (#10143)
* Added the Minkowski distance function

* Made error handling more precise

* Added note about floating point errors and corresponding doctest
2023-10-09 19:00:37 -04:00
Dean Bring
b0aa35c7b3
Added the Chebyshev distance function (#10144)
* Added the Chebyshev distance function

* Remove float cast and made error handling more precise
2023-10-09 17:21:46 -04:00
Siddik Patel
583a614fef
Removed redundant greatest_common_divisor code (#9358)
* Deleted greatest_common_divisor def from many files and instead imported the method from Maths folder

* Deleted greatest_common_divisor def from many files and instead imported the method from Maths folder, also fixed comments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Deleted greatest_common_divisor def from many files and instead imported the method from Maths folder, also fixed comments

* Imports organized

* recursive gcd function implementation rolledback

* more gcd duplicates removed

* more gcd duplicates removed

* Update maths/carmichael_number.py

* updated files

* moved a file to another location

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-09 14:19:12 +02:00
Megan Payne
a2b695dabd
Added Germain primes algorithm to the maths folder (#10120)
* Added algorithm for Germain Primes to maths folder

* Fixed test errors Germain primes.

* Formatting Germain primes after pre-commit

* Fixed path to maths

* Update maths/germain_primes.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update maths/germain_primes.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Added function for safe primes

* Update maths/germain_primes.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Apply suggestions from code review

---------

Co-authored-by: Megan Payne <payneconsulting.nl@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-08 17:33:50 -04:00
Tianyi Zheng
8e108ed92a
Rename maths/binary_exponentiation_3.py (#9656)
* updating DIRECTORY.md

* Rename binary_exponentiation_3.py

Rename binary_exponentiation_3.py to binary_exponentiation_2.py because
the original binary_exponentiation_2.py was renamed to
binary_multiplication.py in PR #9513

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-09 08:43:07 +13:00
SubhranShu2332
e7a59bfff5
In place of calculating the factorial several times we can run a loop k times to calculate the combination (#10051)
* In place of calculating the factorial several times we can run a loop k times to calculate the combination 

for example:
5 C 3 = 5! / (3! * (5-3)! )
= (5*4*3*2*1)/[(3*2*1)*(2*1)]
=(5*4*3)/(3*2*1)
so running a loop k times will reduce the time complexity to O(k)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maths/combinations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-08 15:17:02 -04:00
Aarya Balwadkar
6860daea60
Made Changes shifted CRT, modular division to maths directory (#10084) 2023-10-08 11:53:38 -04:00
pre-commit-ci[bot]
895dffb412
[pre-commit.ci] pre-commit autoupdate (#9543)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.291 → v0.0.292](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.291...v0.0.292)
- [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6)
- [github.com/tox-dev/pyproject-fmt: 1.1.0 → 1.2.0](https://github.com/tox-dev/pyproject-fmt/compare/1.1.0...1.2.0)

* updating DIRECTORY.md

* Fix typos in test_min_spanning_tree_prim.py

* Fix typos

* codespell --ignore-words-list=manuel

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-07 21:32:28 +02:00
Kamil
2122474e41
Segmented sieve - doctests (#9945)
* Replacing the generator with numpy vector operations from lu_decomposition.

* Revert "Replacing the generator with numpy vector operations from lu_decomposition."

This reverts commit ad217c6616.

* Added doctests.

* Update segmented_sieve.py

Removed unnecessary check.

* Update segmented_sieve.py

Added checks for 0 and negative numbers.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update segmented_sieve.py

* Update segmented_sieve.py

Added float number check.

* Update segmented_sieve.py

* Update segmented_sieve.py

simplified verification

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update segmented_sieve.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update segmented_sieve.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ValueError: Number 22.2 must instead be a positive integer

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-07 05:09:39 -04:00
fxdup
995c5533c6
Consolidate gamma (#9769)
* refactor(gamma): Append _iterative to func name

* refactor(gamma): Consolidate implementations

* refactor(gamma): Redundant test function removal

* Update maths/gamma.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-06 14:46:58 -04:00
Muhammad Umer Farooq
cffdf99c55
Updated prime_numbers.py testcases. (#9851)
* Updated prime_numbers.py testcases.

* revert __main__ code.
2023-10-05 20:44:55 +02:00
Aasheesh
deb0480b3a
Changing the directory of sigmoid_linear_unit.py (#9824)
* Changing the directory of sigmoid_linear_unit.py

* Delete neural_network/activation_functions/__init__.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-05 10:07:44 -04:00
Kamil
9bfc314e87
hardy_ramanujanalgo type annotation (#9799)
* Replacing the generator with numpy vector operations from lu_decomposition.

* Revert "Replacing the generator with numpy vector operations from lu_decomposition."

This reverts commit ad217c6616.

* Added type annotation.
2023-10-05 08:39:29 -04:00