21 releases

0.5.1 Apr 11, 2025
0.5.0 Nov 26, 2022
0.4.7 Jul 18, 2022
0.4.3 Feb 13, 2022
0.1.1 Apr 5, 2020

#153 in Math

Download history 103/week @ 2025-01-20 133/week @ 2025-01-27 185/week @ 2025-02-03 152/week @ 2025-02-10 197/week @ 2025-02-17 101/week @ 2025-02-24 82/week @ 2025-03-03 89/week @ 2025-03-10 98/week @ 2025-03-17 97/week @ 2025-03-24 83/week @ 2025-03-31 233/week @ 2025-04-07 126/week @ 2025-04-14 116/week @ 2025-04-21 105/week @ 2025-04-28 62/week @ 2025-05-05

443 downloads per month
Used in 7 crates

AGPL-3.0-or-later

25KB
519 lines

Polynomial Ring

A polynomial implementation.

use num::Rational64;
use polynomial_ring::Polynomial;

let f = Polynomial::new(vec![3, 1, 4, 1, 5].into_iter().map(|x| Rational64::from_integer(x)).collect());
let g = Polynomial::new(vec![2, 7, 1].into_iter().map(|x| Rational64::from_integer(x)).collect());
let mut r = f.clone();
let q = r.division(&g);
assert_eq!(f, q * g + r);
let f = Polynomial::new(vec![3, 1, 4, 1, 5].into_iter().map(|x| rug::Rational::from(x)).collect());
let g = Polynomial::new(vec![2, 7, 1].into_iter().map(|x| rug::Rational::from(x)).collect());
let mut r = f.clone();
let q = r.division(&g);
assert_eq!(f, q * g + r);

The Add, Sub, Mul, Div, and Rem traits are implemented for polynomials. Polynomials also support computing derivative, square free, pseudo division, and resultant.

Licence

AGPL-3.0-or-later

Dependencies

~2MB
~44K SLoC