Skip to main content

Library of Mathematical functions and Algorithms

Project description

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)

primes.py

  • prime_sieve(limit, block_size, segment, 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)

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)

  • bisect(alist, goal)

  • is_clockwise(a, b, c)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mathslib-3.1.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

mathslib-3.1.0-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file mathslib-3.1.0.tar.gz.

File metadata

  • Download URL: mathslib-3.1.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for mathslib-3.1.0.tar.gz
Algorithm Hash digest
SHA256 14be475b6094c6b2e10c19a91f054590ca1e902e6bd4323788edde9e71918af4
MD5 00f7222190a018bc3e85a83305f66b8f
BLAKE2b-256 07c4f8e5e18a3b2b8bfdf2df1832edb03b8d177df0f038fdc5541b8154ee5bd6

See more details on using hashes here.

File details

Details for the file mathslib-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: mathslib-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for mathslib-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fc654afc90cf670ce22b5b6e45d31951c773c2e5d0ce4dda2ff5dddb3870f5e
MD5 66305968d0ffd67b82f530dcdfd3ef40
BLAKE2b-256 0ddd53b47c7e9195baaf96d8d7442a7bbc281082334a4483a5117b6343b5b612

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page