#polynomial #algebra #ring #rational64

polynomial-ring

A polynomial implementation

20 releases

0.5.0 Nov 26, 2022
0.4.7 Jul 18, 2022
0.4.4 Jun 25, 2022
0.4.3 Feb 13, 2022
0.1.1 Apr 5, 2020

#1745 in Math

Download history 83/week @ 2024-07-21 81/week @ 2024-07-28 71/week @ 2024-08-04 78/week @ 2024-08-11 74/week @ 2024-08-18 88/week @ 2024-08-25 91/week @ 2024-09-01 81/week @ 2024-09-08 70/week @ 2024-09-15 124/week @ 2024-09-22 96/week @ 2024-09-29 76/week @ 2024-10-06 74/week @ 2024-10-13 79/week @ 2024-10-20 79/week @ 2024-10-27 66/week @ 2024-11-03

309 downloads per month
Used in 2 crates

AGPL-3.0-or-later

24KB
514 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
~42K SLoC