Python/maths
Tianyi Zheng 84cca2119c
Rewrite maths/fibonacci.py (#5734)
* Rewrite parts of Vector and Matrix methods

* Refactor determinant method and add unit tests

Refactor determinant method to create separate minor and cofactor
methods.
Add respective unit tests for new methods.
Rename methods using snake case to follow Python naming conventions.

* Reorganize Vector and Matrix methods

* Update linear_algebra/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Fix punctuation and wording

* Apply suggestions from code review

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Deduplicate euclidean length method for Vector

* Add more unit tests for Euclidean length method

* Fix bug in unit test for euclidean_length

* Remove old comments for magnitude method

* Rewrite maths/fibonacci.py

* Rewrite timer and add unit tests

* Fix typos in fib_binet unit tests

* Fix typos in fib_binet unit tests

* Clean main method

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-01 18:06:35 +01:00
..
images Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
series Hexagonal number sequence (#5640) 2021-10-29 09:39:32 +02:00
__init__.py pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
3n_plus_1.py Change occurrences of str.format to f-strings (#4118) 2021-02-23 11:23:49 +05:30
abs_max.py bugfix: Add abs_max.py & abs_min.py empty list detection (#4844) 2021-10-06 22:06:49 +08:00
abs_min.py bugfix: Add abs_max.py & abs_min.py empty list detection (#4844) 2021-10-06 22:06:49 +08:00
abs.py some pytest on math folder (#1405) 2019-10-21 22:36:33 +02:00
add.py Rename math/add.py to maths/add.py (#1857) 2020-04-13 07:50:46 +02:00
aliquot_sum.py Optimization and fix bug (#2342) 2020-08-21 14:39:03 +08:00
allocation_number.py Fixed allocation_number (#2768) 2020-10-05 09:17:46 +05:30
area_under_curve.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
area.py Add doctest for exception (#5629) 2021-10-27 18:30:03 +02:00
armstrong_numbers.py [mypy] Fix type annotations for maths (#4617) 2021-08-18 12:45:07 +02:00
average_mean.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
average_median.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
average_mode.py Mistake in maths/average_mode.py fixed. (#4464) 2021-06-04 15:16:32 -05:00
bailey_borwein_plouffe.py refactor: Remove default value of exponential_term (#4308) 2021-04-04 09:32:36 +05:30
basic_maths.py basic_maths input check (#4486) 2021-06-16 08:34:32 +02:00
binary_exp_mod.py Added binary exponentiaion with respect to modulo (#1428) 2019-12-24 07:23:15 +01:00
binary_exponentiation_2.py move-files-and-2-renames (#4285) 2021-03-22 10:52:26 +01:00
binary_exponentiation_3.py move-files-and-2-renames (#4285) 2021-03-22 10:52:26 +01:00
binary_exponentiation.py Improved readability (#1615) 2019-12-07 06:39:59 +01:00
binomial_coefficient.py Added binomial coefficient (#1467) 2019-10-26 11:18:28 +02:00
binomial_distribution.py Added a binomial distribution formula calculator algorithm (#2197) 2020-07-13 22:18:37 +02:00
bisection.py Fixes black failures from Previous PR (#1751) 2020-02-13 02:19:41 +05:30
ceil.py Update ceil and floor function (#3710) 2020-10-26 00:02:24 +08:00
check_polygon.py [mypy] check polygon and corrections (#5419) 2021-10-21 21:13:42 +08:00
chudnovsky_algorithm.py Fix some warnings from LGTM (#2420) 2020-09-13 10:11:27 +02:00
collatz_sequence.py from __future__ import annotations (#2464) 2020-09-23 13:30:13 +02:00
combinations.py Made improvements to combinations.py (#3681) 2020-10-26 14:48:06 +08:00
decimal_isolate.py Added decimal_isolate.py (#3700) 2020-10-30 23:10:44 +01:00
double_factorial_iterative.py Double factorial iterative (#4760) 2021-09-19 03:22:47 +02:00
double_factorial_recursive.py Adding the double factorial algorithm (#4550) 2021-08-03 08:03:22 +02:00
entropy.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
euclidean_distance.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
euclidean_gcd.py move-files-and-2-renames (#4285) 2021-03-22 10:52:26 +01:00
euler_method.py [mypy] Fix type annotation in euler_method.py (#5649) 2021-10-28 22:31:32 +02:00
euler_modified.py Fix documentation (#5311) 2021-10-15 12:33:39 +02:00
eulers_totient.py Code for Eulers Totient function (#1229) 2019-12-01 06:58:25 +01:00
extended_euclidean_algorithm.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
factorial_iterative.py Fix factorial issues (#5496) 2021-10-21 15:06:32 +08:00
factorial_recursive.py Create factorial_iterative.py (#1693) 2020-01-18 14:06:48 +01:00
factors.py Factors of a number (#1493) 2019-10-29 23:54:30 +01:00
fermat_little_theorem.py Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
fibonacci.py Rewrite maths/fibonacci.py (#5734) 2021-11-01 18:06:35 +01:00
find_max_recursion.py bugfix: Add empty list detection for find_max/min (#4881) 2021-10-07 23:20:32 +08:00
find_max.py bugfix: Add empty list detection for find_max/min (#4881) 2021-10-07 23:20:32 +08:00
find_min_recursion.py bugfix: Add empty list detection for find_max/min (#4881) 2021-10-07 23:20:32 +08:00
find_min.py bugfix: Add empty list detection for find_max/min (#4881) 2021-10-07 23:20:32 +08:00
floor.py Update ceil and floor function (#3710) 2020-10-26 00:02:24 +08:00
gamma_recursive.py Physics new code (#4709) 2021-09-06 23:57:18 +02:00
gamma.py isort --profile black . (#2181) 2020-07-06 09:44:19 +02:00
gaussian.py Correcting the Gaussian Formula (#2249) 2020-07-29 21:32:36 +02:00
greatest_common_divisor.py math/greatest_common_divisor: add support for negative numbers (#2628) 2020-10-29 12:47:26 +05:30
greedy_coin_change.py Fix mypy error at maths (#4613) 2021-08-15 21:15:53 +02:00
hardy_ramanujanalgo.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
integration_by_simpson_approx.py move-files-and-2-renames (#4285) 2021-03-22 10:52:26 +01:00
is_ip_v4_address_valid.py Update and rename check_valid_ip_address.py to is_ip_v4_address_valid.py (#4665) 2021-09-23 02:03:11 +08:00
is_square_free.py from __future__ import annotations (#2464) 2020-09-23 13:30:13 +02:00
jaccard_similarity.py adding jaccard similarity (#1270) 2019-10-04 09:59:45 +02:00
kadanes.py Fix astar (#1966) 2020-05-10 20:49:40 +05:30
karatsuba.py psf/black code formatting (#1421) 2019-10-22 19:13:48 +02:00
krishnamurthy_number.py Python Program to Check Krishnamurthy Number (#2248) 2020-07-29 10:54:05 +02:00
kth_lexicographic_permutation.py Optimized recursive_bubble_sort (#2410) 2020-09-10 10:31:26 +02:00
largest_of_very_large_numbers.py LargestOfVeryLargeNumbers (#818) 2019-07-30 08:47:54 +02:00
largest_subarray_sum.py move-files-and-2-renames (#4285) 2021-03-22 10:52:26 +01:00
least_common_multiple.py More efficient least common multiple. (#2281) 2020-08-05 12:39:15 +02:00
line_length.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
lucas_lehmer_primality_test.py Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
lucas_series.py Fixed LGTM and typehint (#3970) 2020-11-28 22:42:30 +08:00
matrix_exponentiation.py Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
max_sum_sliding_window.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
median_of_two_arrays.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
miller_rabin.py mandelbrot.py: Commenting out long running tests (#5558) 2021-10-23 18:15:30 +02:00
mobius_function.py isort --profile black . (#2181) 2020-07-06 09:44:19 +02:00
modular_exponential.py Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
monte_carlo_dice.py fix(ci): Update pre-commit hooks and apply new black (#4359) 2021-04-26 07:46:50 +02:00
monte_carlo.py Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
newton_raphson.py Optimized recursive_bubble_sort (#2410) 2020-09-10 10:31:26 +02:00
number_of_digits.py fix number_of_digits bug (#2301) 2020-08-12 18:32:35 +02:00
numerical_integration.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
perfect_cube.py Fix syntax for flake8 passing (#2096) 2020-06-12 06:51:47 +02:00
perfect_number.py Python Program to Check Krishnamurthy Number (#2248) 2020-07-29 10:54:05 +02:00
perfect_square.py Perfect square using binary search (#2351) 2020-08-25 21:26:11 +02:00
pi_monte_carlo_estimation.py Wrap lines that go beyond GitHub Editor (#1925) 2020-05-01 23:36:35 +02:00
pollard_rho.py Add Pollard's Rho algorithm for integer factorization (#5598) 2021-10-29 01:53:39 +02:00
polynomial_evaluation.py Update our pre-commit dependencies (#4273) 2021-03-20 10:42:17 +05:30
power_using_recursion.py Added Finding Exponent Program (#2238) 2020-07-27 11:33:13 +02:00
prime_check.py Add doctests to prime_check function (#5503) 2021-10-23 01:14:27 +08:00
prime_factors.py from __future__ import annotations (#2464) 2020-09-23 13:30:13 +02:00
prime_numbers.py Improved prime_numbers.py (#5592) 2021-10-26 09:21:44 +02:00
prime_sieve_eratosthenes.py Fix all errors mentioned in pre-commit run (#2512) 2020-09-30 10:38:00 +02:00
primelib.py move-files-and-2-renames (#4285) 2021-03-22 10:52:26 +01:00
proth_number.py Add Proth number to maths (#5246) 2021-10-14 16:30:52 +02:00
pythagoras.py pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
qr_decomposition.py psf/black code formatting (#1421) 2019-10-22 19:13:48 +02:00
quadratic_equations_complex_numbers.py Change occurrences of str.format to f-strings (#4118) 2021-02-23 11:23:49 +05:30
radians.py Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
radix2_fft.py Avoid mutable default arguments (#4691) 2021-08-31 06:56:15 +02:00
relu.py from __future__ import annotations (#2464) 2020-09-23 13:30:13 +02:00
runge_kutta.py psf/black code formatting (#1421) 2019-10-22 19:13:48 +02:00
segmented_sieve.py psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
sieve_of_eratosthenes.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
sigmoid.py Add Maths / Sigmoid Function (#3880) 2020-11-15 09:14:40 +05:30
simpson_rule.py Create codespell.yml (#1698) 2020-01-18 13:24:33 +01:00
softmax.py Optimized recursive_bubble_sort (#2410) 2020-09-10 10:31:26 +02:00
square_root.py Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
sum_of_arithmetic_series.py Add GitHub action for pre-commit (#2515) 2020-09-30 15:23:34 +02:00
sum_of_digits.py Update sum_of_digits.py (#2319) 2020-08-16 20:31:06 +02:00
sum_of_geometric_progression.py Optimized recursive_bubble_sort (#2410) 2020-09-10 10:31:26 +02:00
sylvester_sequence.py Add Sylvester's sequence to maths (#5171) 2021-10-10 20:02:44 +02:00
test_prime_check.py Add maths/test_prime_check.py (#1125) 2019-08-13 11:50:13 +02:00
trapezoidal_rule.py Create codespell.yml (#1698) 2020-01-18 13:24:33 +01:00
triplet_sum.py Fix mypy error at maths (#4613) 2021-08-15 21:15:53 +02:00
two_pointer.py move-files-and-2-renames (#4285) 2021-03-22 10:52:26 +01:00
two_sum.py Fix mypy error at maths (#4613) 2021-08-15 21:15:53 +02:00
ugly_numbers.py Created ugly_numbers.py in Python/maths (#2366) 2020-08-29 16:57:34 +02:00
volume.py Sphere intersection and spherical cap volumes (#5579) 2021-10-27 00:28:26 +02:00
zellers_congruence.py Optimized recursive_bubble_sort (#2410) 2020-09-10 10:31:26 +02:00