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

  • divisors_of(x, include_x)

  • divisors(x, n)

  • continued_fraction(x)

  • overall_fraction(x)

  • phi(x)

  • phi_sieve(x)

  • phi_sum(x)

  • mobius(x)

  • mobius_k_sieve(limit, k)

  • count_k_free(n, k)

  • ppt(limit, non_primitive)

  • 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)

prime.py

  • prime_sieve(limit, block_size, segment, values)

  • is_prime(x)

  • prime_factors(x)

  • primepi(x)

  • primepi_sieve(x)

  • sum_of_primes(x)

  • fermat_primality_test(x)

  • miller_primality_test(n, millerrabin, numoftests)

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)

fib.py

  • fibonacci(n)

  • 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

  • n_choose_r(n, r)

  • 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-2.9.0.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

mathslib-2.9.0-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mathslib-2.9.0.tar.gz
Algorithm Hash digest
SHA256 26058430e166a98d42c8dbb5f68df75489ab1fb497d699f6cb12820ad3b3d6ab
MD5 2304632b87d61c05fb6ec560eb6b6e44
BLAKE2b-256 b91818c1a1ddd16806396cd80205e1569813a1a4e4be23228651721ddcec7837

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mathslib-2.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ede732b31d33a1b339cc7714c56818b259eb827b104e0bef0c132e11444172cd
MD5 7799aed1341507abaf6d753e459cfb9c
BLAKE2b-256 57bf83fa624eb6c888d32d53e13c9186609549ce95e661f8e0ac31a96c30f4b9

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