#prime-field #prime #modulo #algebra

algebraic-equation-over-finite-prime-field

solve algebraic equation over finite prime field

3 unstable releases

0.2.1 Aug 4, 2021
0.2.0 Aug 4, 2021
0.1.0 May 5, 2021

#1840 in Math

AGPL-3.0-or-later

21KB
516 lines

Find roots of polynomial in modulo prime.

use algebraic_equation_over_finite_prime_field::{find_all_roots_over_mod_p, PolynomialOverP};
// (x^2+2)(x-1)(x-3)≡x^4+x^3+2x+1 (mod 5)
let p = PolynomialOverP::<i32>::new(vec![1, 2, 0, 1, 1], 5);
let mut v = find_all_roots_over_mod_p::<i32>(p);
v.sort();
assert_eq!(vec![1, 3], v);

Licence

AGPL-3.0-or-later


lib.rs:

Find roots of polynomial in modulo prime.

use algebraic_equation_over_finite_prime_field::{find_all_roots_over_mod_p, PolynomialOverP};
// (x^2+2)(x-1)(x-3)≡x^4+x^3+2x+1 (mod 5)
let p = PolynomialOverP::<i32>::new(vec![1, 2, 0, 1, 1], 5);
let mut v = find_all_roots_over_mod_p::<i32>(p);
v.sort();
assert_eq!(vec![1, 3], v);

Dependencies

~3.5MB
~64K SLoC