Commit Graph

330 Commits

Author SHA1 Message Date
Margaret
6939538a41
adding the remove digit algorithm (#6708) 2023-05-11 06:55:48 +12:00
Dipankar Mitra
c1b3ea5355
The tanh activation function is added (#8689)
* tanh function been added

* tanh function been added

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

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

* tanh function is added

* tanh function is added

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

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

* tanh function added

* tanh function added

* tanh function is added

* Apply suggestions from code review

---------

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-04-25 18:06:14 +02:00
JulianStiebler
11582943a5
Create maths/pi_generator.py (#8666)
* Create pi_generator.py

* Update pi_generator.py

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

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

* Update pi_generator.py

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

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

* Update pi_generator.py

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

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

* Update pi_generator.py

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

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

* Update pi_generator.py

* Update pi_generator.py

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

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

* Updated commentary on line 28, added math.pi comparison & math.isclose() test

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

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

* Removed  # noqa: E501

* printf() added as recommended by cclaus

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-18 11:57:48 +02:00
Christian Clauss
521fbca61c
Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
Christian Clauss
c96241b5a5
Replace bandit, flake8, isort, and pyupgrade with ruff (#8178)
* Replace bandit, flake8, isort, and pyupgrade with ruff

* Comment on ruff rules

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-03-15 13:58:25 +01:00
Christian Clauss
64543faa98
Make some ruff fixes (#8154)
* Make some ruff fixes

* Undo manual fix

* Undo manual fix

* Updates from ruff=0.0.251
2023-03-01 17:23:33 +01:00
Christian Clauss
c909da9b08
pre-commit: Upgrade psf/black for stable style 2023 (#8110)
* pre-commit: Upgrade psf/black for stable style 2023

Updating https://github.com/psf/black ... updating 22.12.0 -> 23.1.0 for their `2023 stable style`.
* https://github.com/psf/black/blob/main/CHANGES.md#2310

> This is the first [psf/black] release of 2023, and following our stability policy, it comes with a number of improvements to our stable style…

Also, add https://github.com/tox-dev/pyproject-fmt and https://github.com/abravalheri/validate-pyproject to pre-commit.

I only modified `.pre-commit-config.yaml` and all other files were modified by pre-commit.ci and psf/black.

* [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-02-01 18:44:54 +05:30
Caeden Perelli-Harris
c00af459fe
feat: Concatenate both factorial implementations (#8099)
* feat: Concatenate both factorial implementations

* fix: Rename factorial recursive method
2023-01-26 08:12:11 +01:00
MohammadReza Balakhaniyan
1a27258bd6
gcd_of_n_numbers (#8057)
* add maths/Gcd of N Numbers

* add maths/Gcd of N Numbers

* add maths/Gcd of N Numbers

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

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

* add maths/Gcd of N Numbers

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

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

* add maths/Gcd of N Numbers

* add maths/Gcd of N Numbers

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

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

* add maths/Gcd of N Numbers

* add maths/Gcd of N Numbers

* more pythonic

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

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

* more pythonic

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

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

* merged

* merged

* more readable

* [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-01-10 23:47:02 +01:00
Caeden Perelli-Harris
4939e8463f
Create cached fibonacci algorithm (#8084)
* feat: Add `fib_recursive_cached` func

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

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

* doc: Show difference in time when caching algorithm

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-01-07 17:56:39 +01:00
Tianyi Zheng
7c1d23d448
Change prime_sieve_eratosthenes.py to return list (#8062) 2023-01-02 14:10:59 +13:00
Tianyi Zheng
b72d0681ec
Remove extra imports in gamma.py doctests (#8060)
* Refactor bottom-up function to be class method

* Add type hints

* Update convolve function namespace

* Remove depreciated np.float

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Renamed function for consistency

* updating DIRECTORY.md

* Remove extra imports in gamma.py doctests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-12-29 18:06:26 +01:00
Aaryan Raj
b25915adf9
Add algorithm to convert decimal number to its simplest fraction form (#8001)
* Added algorithm to convert decimal number to its simplest fraction form

* Apply suggested changes
2022-12-11 08:04:04 +01:00
Akshay Dubey
5654c6242e
algorithm: Hexagonal number (#8003)
* feat: Add hexagonal number

* [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>
2022-11-29 19:29:21 +01:00
Mark Mayo
f32d611689
clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
Akshay Dubey
b33ea81a74
algorithm: Add juggler sequence (#7985)
* feat: Add juggler sequence

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

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

* refactor: Remove temp variable

* refactor: Change error type for negative numbers

* refactor: Remove # doctest: +NORMALIZE_WHITESPACE

* refactor: Remove int typecasting

* test: Add unit tests for n=10 and n=25

* [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>
2022-11-18 09:18:47 +01:00
Akshay Dubey
4ce8ad9ce6
algorithm: Liouville lambda function (#7986)
* feat: Add liouville lambda function

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

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

* refactor: Refactor if-else block

* refactor: Refactor error handling for -ve numbers

* refactor: Remove # doctest: +NORMALIZE_WHITESPACE

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-15 18:28:49 +01:00
Akshay Dubey
e1be882f72
algorithm: Twin prime (#7980)
* feat: Add twin prime algorithm

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

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

* fix: Fix broken import statement

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-10 11:55:50 +01:00
Christian Clauss
5c92b7390e
prime_numbers.py: Tighten up the benchmarks (#7976)
* prime_numbers.py: Tighten up the benchmarks

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-10 15:42:14 +13:00
Akshay Dubey
076193eefa
feat: Add pronic number implementation (#7979)
* feat: Add pronic number implementation

* [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>
2022-11-10 15:39:47 +13:00
Akshay Dubey
3f9aae149d
feat: Add automorphic number implementation (#7978)
* feat: Add automorphic number implementation

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

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

* refactor: Add type checking for number

* refactor: Rename variable n to number

* test: Add doctest

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

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

* test: Add unit  test for number=0

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-09 16:36:38 +01:00
Christian Clauss
6aaf0a2c77
maths/number_of_digits.py: Streamline benchmarks (#7913)
* maths/number_of_digits.py: Streamline benchmarks

```
num_digits(262144): 6 -- 0.2226011250168085 seconds
num_digits_fast(262144): 6 -- 0.13145116699161008 seconds
num_digits_faster(262144): 6 -- 0.09273383300751448 seconds

num_digits(1125899906842624): 16 -- 0.6056742920191027 seconds
num_digits_fast(1125899906842624): 16 -- 0.15698366600554436 seconds
num_digits_faster(1125899906842624): 16 -- 0.1027024170034565 seconds

num_digits(1267650600228229401496703205376): 31 -- 1.1957934170495719 seconds
num_digits_fast(1267650600228229401496703205376): 31 -- 0.15552304196171463 seconds
num_digits_faster(1267650600228229401496703205376): 31 -- 0.13062308297958225 seconds
```

* updating DIRECTORY.md

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

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

* Update number_of_digits.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-08 11:49:47 +00:00
Caeden Perelli-Harris
daa1c7529a
Raise error not string (#7945)
* ci: Add `B023` to `.flake8` ignores

* refactor: Return `bool`/raise Exception

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

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

* revert: Remove previous branch commit

* Update data_structures/binary_tree/segment_tree_other.py

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

* feat: Apply `__repr__` changes

* chore: Fix failing tests

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

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

* Update data_structures/binary_tree/segment_tree_other.py

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

* test: Fix doctests

* random.choice(population_score[:N_SELECTED])[0]

* Update basic_string.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>
2022-11-06 15:54:44 +01:00
Sanders Lin
51708530b6
Update 3n_plus_1.py (#7966)
* Update 3n_plus_1.py

1. Minor issue with ValueError message: Given integer should be positive, not greater than 1, as 1 is allowed.
2. += calls underlying list extend method which might be slower. Calling apend seems more appropriate.

* [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>
2022-11-06 10:35:40 +01:00
Christian Clauss
d23e709aea
maths/sum_of_digits.py: Streamline benchmarks (#7914)
* maths/sum_of_digits.py: Streamline benchmarks

```
sum_of_digits(262144): 19 -- 0.3128329170285724 seconds
sum_of_digits_recursion(262144): 19 -- 0.34008108399575576 seconds
sum_of_digits_compact(262144): 19 -- 0.6086010000435635 seconds

sum_of_digits(1125899906842624): 76 -- 0.8079068749793805 seconds
sum_of_digits_recursion(1125899906842624): 76 -- 0.8435653329943307 seconds
sum_of_digits_compact(1125899906842624): 76 -- 1.247976207989268 seconds

sum_of_digits(1267650600228229401496703205376): 115 -- 1.6441589999594726 seconds
sum_of_digits_recursion(1267650600228229401496703205376): 115 -- 1.713684624992311 seconds
sum_of_digits_compact(1267650600228229401496703205376): 115 -- 2.2197747920290567 seconds
```

* updating DIRECTORY.md

* Update sum_of_digits.py

* Update sum_of_digits.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-01 14:07:11 +01:00
Caeden Perelli-Harris
7d139ee7f1
refactor(abs): Condense abs_min and abs_max (#7881)
* refactor(abs): Condense `abs_min` and `abs_max`

* [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>
2022-11-01 07:50:43 +01:00
Paradact
7addbccee7
Torus volume (#7905)
* Added Torus volume algorithm

* Updated Torus volume for simplicity (removed ref to vol_sphere())

* Refactoring

* [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>
2022-11-01 10:51:45 +13:00
Paradact
6c15f526e5
Added Torus surface area (#7906)
* Added Torus surface area

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

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

* Fixed error in test

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-01 10:50:50 +13:00
Shriyans Gandhi
ded5deabe9
Dodecahedron surface area and volume (#6606)
* Hexagonal number sequence 

A hexagonal number sequence is a sequence of figurate numbers where the nth hexagonal number hₙ is the number of distinct dots in a pattern of dots consisting of the outlines of regular hexagons with sides up to n dots, when the hexagons are overlaid so that they share one vertex.

This program returns the hexagonal number sequence of n length.

* Update hexagonalnumbers.py

* Update hexagonalnumbers.py

* Update hexagonalnumbers.py

* Update hexagonalnumbers.py

* Update and rename hexagonalnumbers.py to hexagonal_numbers.py

* Length must be a positive integer

* Create dodecahedron.py

* Update dodecahedron.py

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

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

* Update dodecahedron.py

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

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

* Update dodecahedron.py

* Update dodecahedron.py

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

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

* Update dodecahedron.py

* Update dodecahedron.py

* Apply suggestions from code review

Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>

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

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

* Apply suggestions from code review

* Update dodecahedron.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>
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
2022-10-31 18:15:37 +01:00
himanshit0304
f8958ebe20
Add print_multiplication_table.py (#6607)
* Add print_multiplication_table.py

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

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

* Added return type description

* Update print_multiplication_table.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>
2022-10-30 23:55:11 +01:00
kumarsurajsk
2c65597093
addition_without_arithmetic (#6830)
* Addition_without_arithmetic

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

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

* added_param

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

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

* added_param_in_first_sec

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

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

* change_align

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

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

* Update Addition_without_arithmetic.py

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

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

* Rename Addition_without_arithmetic.py to addition_without_arithmetic.py

* Update addition_without_arithmetic.py

* Update addition_without_arithmetic.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>
2022-10-30 13:52:37 +01:00
Lukas Esc
cafbbab125
shortened code using abs() and inplace ops (#7191)
n = -n if n < 0 else n --> n = abs(n)
n = n // 10 --> n //= 10
2022-10-30 11:56:54 +01:00
Emmanuel Bauma Murairi
b5d7f186f4
Polynomial (#6745)
* implement function to handle polynomial operations

* edit documentation

* fix type hint and linter errors

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

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

* fix short variable name

* fix spelling

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 11:52:50 +01:00
happiestbee
00fc53de97
added sumset.py Fixes: #{6563} (#6742)
* Create sumset.py

* updating DIRECTORY.md

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

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

* Add descriptive var names

* Update maths/sumset.py

Co-authored-by: Caeden <caedenperelliharris@gmail.com>

* Update sumset.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 11:49:05 +01:00
Carlos Villar
17d93cab78
Added Manhattan distance algorithm (#7790)
* Added Manhattan distance algorithm, Fixes: #7776

* Forgot that isinstance can accept a tuple

* Apply suggestions from code review

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

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

* Update manhattan_distance.py

* Update manhattan_distance.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>
2022-10-30 10:00:47 +01:00
Andrey
584e743422
Fix yesqa hook (#7843)
* fix yesqa hook

* Remove redundant noqa

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-29 15:07:02 +02:00
Kuldeep Borkar
3a671b57a2
Implemented Swish Function (#7357)
* Implemented Swish Function

* Added more description and return hint in def

* Changed the name and added more descrition including test for sigmoid function

* Added * in front of links
2022-10-28 16:27:16 +02:00
Caeden Perelli-Harris
61eedc16c3
Remove useless code in doctests (#7733)
* refactor: Fix matrix display deprecation

* refactor: Remove useless `print` and `pass` statements

* revert: Replace broken doctests

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

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

* revert: Fix failing doctests

* chore: Satisfy pre-commit

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-27 22:52:00 +02:00
Alexandre Velloso
501a1cf0c7
Remove unnecessary else statement (#7759)
* Remove unnecessary else statement

* [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>
2022-10-27 22:51:14 +02:00
Matteo Messmer
71e8ed81ae
Added spheres union (#6879)
* Spheres union

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

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

* Update volume.py

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

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

* Update volume.py

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

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

* f-strings

* Update maths/volume.py

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

* more tests

* fix non negative

* fix 0 radius

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

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

* fix tests

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

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

* fix tests

* fix print

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

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

* fix comment

* fix comment

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

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

* Update volume.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>
2022-10-27 19:45:58 +02:00
Caeden Perelli-Harris
9bba42eca8
refactor: Indent ... for visual purposes (#7744) 2022-10-27 19:42:30 +02:00
Mislah
505c5e20fa
Included area of n sided regular polygon (#7438)
* Included area of n sided regular polygon 

Added a function to calculate the area of n sided regular polygons

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

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

* code standard fixes as per PR comments

* [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>
2022-10-26 00:26:05 +02:00
Tianyi Zheng
d25187eb7f
Remove type cast in combinations algorithm (#7607)
* Remove commented-out print statements in algorithmic functions

* Encapsulate non-algorithmic code in __main__

* Remove unused print_matrix function

* Remove print statement in __init__

* Remove print statement from doctest

* Encapsulate non-algorithmic code in __main__

* Modify algorithm to return instead of print

* Encapsulate non-algorithmic code in __main__

* Refactor data_safety_checker to return instead of print

* updating DIRECTORY.md

* updating DIRECTORY.md

* Apply suggestions from code review

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

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

* updating DIRECTORY.md

* Remove int cast and change float division to int division

* Move new-line chars

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-25 22:34:46 +02:00
Havish
450842321d
Arc Length Algorithm (#7610)
* Create decimal_conversions.py

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

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

* Create arc_length.py

* Delete decimal_conversions.py

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

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

* Removed redundant statement, fixed line overflow

* Update arc_length.py

Changed rad to radius as not to get confused with radians

* Update arc_length.py

* Update arc_length.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-10-25 21:47:52 +02:00
Caeden Perelli-Harris
393b960525
refactor: Replace doctest traceback with ... (#7558) 2022-10-23 16:36:10 +02:00
Pradyumn Singh Rahar
a3383ce3fd
Reduced Time Complexity to O(sqrt(n)) (#7429)
* Reduced Time Complexity to O(sqrt(n))

* Added testmod

* [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>
2022-10-23 17:56:40 +05:30
Arjit Arora
1bbb0092f3
Add signum function (#7526)
* Add signum function

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

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

* Add typehints for functions

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

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

* Update signum.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>
2022-10-23 13:17:30 +02:00
Caeden Perelli-Harris
a0cbc2056e
refactor: Make code more simple in maclaurin_series (#7522) 2022-10-23 13:01:51 +02:00
Akshit Gulyan
ed127032b3
Created sum_of_harmonic_series.py (#7504)
* Created sum_of_harmonic_series.py

Here in this code the formula for Harmonic sum is not used, Sum of the series is calculated by creating a list of the elements in the given Harmonic series and adding all the elements of that list !

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

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

* Update maths/sum_of_harmonic_series.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update maths/sum_of_harmonic_series.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update maths/sum_of_harmonic_series.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

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

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

* Update maths/sum_of_harmonic_series.py

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

* Update maths/sum_of_harmonic_series.py

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

* Update maths/sum_of_harmonic_series.py

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

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

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

* Update sum_of_harmonic_series.py

* Add doctests

* Update sum_of_harmonic_series.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-23 06:29:10 +02:00
Chris O
a5dd07c370
Maclaurin approximation of cos (#7507)
* renamed maclaurin_sin.py to maclaurin_series.py and included function for cos approximation

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

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

* attempt to fix pytest error

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-22 18:17:07 +02:00