Code Monkey home page Code Monkey logo

mathslib's Introduction

Overview

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)

mathslib's People

Contributors

igorvanloo avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.