Expand description

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

Modules

Arithmetic module for polynomials

Macros

Macro shortcut to crate a polynomial from its coefficients.

Structs

Polynomial object

Traits

Absolute value trait

Constants trait

Cosine of a number trait

Epsilon trait

Reciprocal of a number trait

Logarithm of a number trait

Maximum of two numbers trait

Type conversion

Multiplicative identity trait

Exponent of a number trait

Sign of a number trait

Sine of a number trait

Square root of a number trait

Additive identity trait

Functions

Calculate the complex roots of the quadratic equation x^2 + b*x + c = 0.

Evaluate the ratio between to polynomials at the given value. This implementation avoids overflow issues when evaluating the numerator and the denominator separately.

Calculate the real roots of the quadratic equation x^2 + b*x + c = 0.