Skip to main content
https://img.shields.io/pypi/v/mathslib.svg Documentation Status

mathslib is a compilation of Mathematical Functions and Algorithms. Unless credit was given all of the functions were written by me. Relevant articles are also linked where the implementation is complex.

I have used most of these for Project Euler.

See my website ivl-projecteuler.com for their implementation

See the full documentation here

Breakdown

numtheory.py

  • phi(x)

  • phi_sieve(x)

  • phi_sum(x)

  • mobius(x)

  • mobius_k_sieve(limit, k)

  • count_k_free(n, k)

  • pythagorean_triples(limit, non_primitive)

  • count_primitive_pythagorean_triples(n)

  • k_smooth_numbers(max_prime, limit)

  • k_powerful(k, limit, count)

  • legendre_factorial(x)

  • tonelli_shanks(a, p)

  • chinese_remainder_theorem(a1, a2, n1, n2)

  • generalised_CRT(a1, a2, n1, n2)

  • frobenius_number(*integers)

  • continued_fraction(x)

  • overall_fraction(x)

  • partition(x, L, show)

primes.py

  • prime_sieve(limit, block_size, segment, values)

  • prime_sieve_in_range(low_limit, upp_limit, values)

  • is_prime(x)

  • prime_factors(x)

  • spf_sieve(x)

  • primepi(x)

  • primepi_sieve(x)

  • sum_of_primes(x)

  • fermat_primality_test(x)

  • miller_primality_test(n, millerrabin, numoftests)

divisors.py

  • divisors(x, proper)

  • divisor(x, n)

  • divisor_sieve(x, n)

linalg.py

  • gauss_jordan_elimination(matrix, augmentedpart)

  • solve(M, b)

  • inverse(matrix)

  • determinant(matrix)

  • matrix_addition(A, B, subtract)

  • identity(l, val)

  • concatenate(A, B)

  • argmax(alist)

  • fillmatrix(size, val)

  • matrix_mul(A, B)

  • matrix_pow(A, n)

fib.py

  • fibonacci(n, m)

  • fib_till(limit)

  • zeckendorf_representation(x)

algorithms.py

  • prims_algorithm(matrix)

  • dijkstras_algorithm(graph, start_node, INFINITY)

  • floyd_warshall_algorithm(graph, INFINITY)

  • knap_sack(values, weights, n, W, no_values)

  • knap_sack_values(values, weights, n, W, no_values)

  • BFS(g, start_node, end_node)

  • DFS(g, start_node, end_node)

  • convex_hull_gift_wrapping(pts)

  • convex_hull_DC(pts)

gaussianint.py

  • GI

  • conj(self)

  • norm_sq(self)

  • prime_fac(self)

  • rem(x, y)

  • gcd(x, y)

simple.py

  • bin_exp(a, b, c, n, m)

  • number_to_base(n, b)

  • extended_euclidean_algorithm(n, b)

  • lcm(a_list)

  • mod_division(a, b, m)

  • binom(n, k, p)

  • bisect(alist, goal)

  • is_clockwise(a, b, c)

Metadata

Release files for mathslib 3.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mathslib 3.3.0
File Size Uploaded
mathslib-3.3.0.tar.gz 27.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mathslib 3.3.0
File Interpreter ABI Platform
mathslib-3.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 60.9 kB

Release files / mathslib-3.3.0.tar.gz

Download URL mathslib-3.3.0.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
da2c614ad461fbacbd98679c3190b7b1a18452d9418432d37309cf54739679be
BLAKE2b-256 checksum
How to use checksums
314940012a872ea7bc4f7791f079a452705771f2535253db13b312bd742b1d0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.5

Release files / mathslib-3.3.0-py3-none-any.whl

Download URL mathslib-3.3.0-py3-none-any.whl
Size 33.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0aa9fa7f6952310fba30a7372d957ff6adfa97ba630fd77e81a39e70e75a28b7
BLAKE2b-256 checksum
How to use checksums
f276f7ec04c2ae11256376b286e9f839b798fa32906e8e731571976a7ea748ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.5

Release history Release notifications | RSS feed

This release

3.3.0 This release

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.9.0

2 release files

2.8.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page