API Reference#
Algebra#
Counting#
Number Theory#
- mathematics.number_theory.d(n, m)#
Checks if n divides m, equivalent to n|m
- mathematics.number_theory.euclidean_algorithm(a, b)#
- mathematics.number_theory.extended_euclidean_algorithm()#
- mathematics.number_theory.factors(number)#
Returns the factors of the number
- mathematics.number_theory.nth_power(repetitions, power)#
returns a list with every i from 1 to repetitions with every element raised to the power
- mathematics.number_theory.partition(n)#
Returns the partitions of n
- mathematics.number_theory.pigeon_hole(colors, number_needed)#
- mathematics.number_theory.prime_factor(number)#
Returns a list of prime factors of a number
- mathematics.number_theory.root_equivalents(modulus, square_of_root)#
number_theory_extended#
- mathematics.number_theory.number_theory_extended.addition_sums_mod_n(n)#
- mathematics.number_theory.number_theory_extended.addition_sums_mod_n_gen(start, stop)#
- mathematics.number_theory.number_theory_extended.distance(mod, number)#
- mathematics.number_theory.number_theory_extended.nth_power_mod_m(stop, m, power)#
- mathematics.number_theory.number_theory_extended.partial_sum_for_half_plus_fourth(n)#
- mathematics.number_theory.number_theory_extended.pattern_mod_n_adding(n, mod)#
- mathematics.number_theory.number_theory_extended.pattern_mod_n_adding_gen(end, start_1, start_2)#
- mathematics.number_theory.number_theory_extended.pattern_mod_n_adding_gen_primes(end, start_1, start_2)#
- mathematics.number_theory.number_theory_extended.pattern_mod_n_analytics_v1(end_1, start_1_1, start_2_1, end_2, start_1_2, start_2_2, the_function)#
- mathematics.number_theory.number_theory_extended.pattern_mod_n_multiplying(number, mod)#
- mathematics.number_theory.number_theory_extended.pattern_mod_n_multiplying_gen(end, start_1, start_2)#
- mathematics.number_theory.number_theory_extended.powers_of_x_plus_1_mod_prime(prime, x, p)#
- mathematics.number_theory.number_theory_extended.powers_of_x_plus_1_mod_prime_gen(x, prime, stop_p)#
- mathematics.number_theory.number_theory_extended.prime_mult(n)#
- mathematics.number_theory.number_theory_extended.prime_mult_gen(n)#
- mathematics.number_theory.number_theory_extended.root_equivalents(modulus, root)#
- mathematics.number_theory.number_theory_extended.sieve_numbers(num)#
- mathematics.number_theory.number_theory_extended.special_exclusion_partition(n, i)#
- mathematics.number_theory.number_theory_extended.squares_mod_m(stop, m)#
- mathematics.number_theory.number_theory_extended.sum_set(set_a, set_b)#
Adds the sets, not the same as union
number_theory.primes#
- mathematics.number_theory.primes.is_mersenne_number(n)#
- mathematics.number_theory.primes.is_prime(num)#
Uses 6k+-1
- mathematics.number_theory.primes.is_prime_fermat_little_theorem(num)#
Check for primality using fermats little theorem, faster than wilsons theorem for larger numbers, but is incorrect for any Carmicheal number
- mathematics.number_theory.primes.is_prime_wilsons_theorem(num)#
Check for primality using wilsons theorem
- mathematics.number_theory.primes.lucas_lehmer(p)#
Implements Lucas Lehmer mersenne prime test. Checks if the pth mersenne number is prime
- mathematics.number_theory.primes.lucas_lehmer_gen(start, stop)#
- mathematics.number_theory.primes.mersenne(n)#
Returns the nth mersenne number :param n: :return:
- mathematics.number_theory.primes.prime_gen(*args, **kwargs)#
Generates primes from start=>stop
Probability#
- class mathematics.probability.Probability(desired_outcomes, all_outcomes)#
Bases:
objectThis implements basic probability functions
- mathematics.probability.a_and_b_two_tries_independent(a, b)#
- mathematics.probability.a_given_b(a, b, universal_set)#
- mathematics.probability.bayes_a_given_b(a, b, universal_set)#