3 releases (stable)

1.1.0 Jul 1, 2023
1.0.0 Jul 17, 2022
0.1.0 Apr 11, 2022

#357 in Math

Download history 259/week @ 2023-12-19 1/week @ 2023-12-26 105/week @ 2024-01-02 97/week @ 2024-01-09 54/week @ 2024-01-16 95/week @ 2024-01-23 252/week @ 2024-01-30 251/week @ 2024-02-06 162/week @ 2024-02-13 130/week @ 2024-02-20 369/week @ 2024-02-27 200/week @ 2024-03-05 117/week @ 2024-03-12 276/week @ 2024-03-19 177/week @ 2024-03-26 132/week @ 2024-04-02

734 downloads per month
Used in automatica

GPL-3.0-only

175KB
4K SLoC

Polynomen - Polynomial Library

Home page and software specification

Repository

Crate registry

Documentation

Polynomial creation from coefficients or roots.
Polynomial evaluation with Horner method.
(Mutable) Indexing of polynomial coefficients.
Polynomials addition, subtraction and division.
Polynomials multiplication with convolution and fast fourier transform.
Polynomial and scalar addition, subtraction, multiplication and division.
Polynomial roots finding (real and complex).
Polynomial differentiation and integration.

Examples

#[macro_use] extern crate polynomen;
use polynomen::Poly;
let p1 = poly!(1, 2, 3);
let p2 = Poly::new_from_coeffs(&[1, 2, 3]);
assert_eq!(p1, p2);

Examples of library usage can be found in the examples/ folder.


lib.rs:

Polynomials Library

Polynomial implementation

  • builder from coefficients or roots
  • degree
  • extend by adding 0 coefficients to higher order terms
  • transformation to monic form
  • rounding to zero for small coefficients
  • coefficient indexing
  • zero and unit polynomials
  • arithmetic operations between polynomials (addition, subtraction, multiplication, division, reminder, negation)
  • arithmetic operations with floats (addition, subtraction, multiplication, division)
  • multiplication using fast fourier transform
  • polynomial exponentiation
  • differentiation and integration
  • polynomial evaluation
  • evaluation of polynomial ratios that reduces overflows
  • greatest common divisor between two polynomials
  • polynomial norms (l1, l2, l∞)
  • roots finding (real and complex) using eigenvalues of the companion matrix or iterative method

Dependencies

~1.5MB
~25K SLoC