use-polynomial 0.0.5

Small polynomial primitives and operations for RustUse
Documentation
  • Coverage
  • 100%
    22 out of 22 items documented1 out of 20 items with examples
  • Size
  • Source code size: 20.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 480.83 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 19s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-math
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-polynomial

Install

[dependencies]
use-polynomial = "0.0.5"

What belongs here

use-polynomial owns concrete polynomial representation and direct polynomial operations over f64 coefficients. It provides construction, degree handling, evaluation, derivatives, integrals, arithmetic, and small real-root helpers for degree 1 and 2 workflows.

Coefficient ordering is explicit: coefficients[i] is the coefficient for x^i, so 3 + 2x + x^2 is stored as vec![3.0, 2.0, 1.0].

The zero polynomial is represented as an empty coefficient vector. That keeps degree() and leading_coefficient() explicit by returning None for the zero polynomial.

Neighboring crates

Crate Responsibility
use-polynomial Polynomial representation and direct polynomial operations
use-equation Equation-solving workflows built on polynomial expressions
use-numerical Iterative numerical methods and higher-degree root finding
use-calculus Calculus concepts and function-based derivative workflows
use-complex Complex numbers and complex roots
use-algebra Algebraic structures and law checking
use-real Real-number wrappers and real-specific policy
use-optimization Optimization routines that may consume polynomial models

use-polynomial intentionally does not define symbolic algebra, interpolation frameworks, arbitrary-precision arithmetic, or complex roots in v1.

Examples

Construct, inspect, and evaluate

use use_polynomial::Polynomial;

let p = Polynomial::new(vec![3.0, 2.0, 1.0]);

assert_eq!(p.degree(), Some(2));
assert_eq!(p.evaluate(2.0), 11.0);

Differentiate a polynomial

use use_polynomial::Polynomial;

let p = Polynomial::new(vec![3.0, 2.0, 1.0]);
let derivative = p.derivative();

assert_eq!(derivative.coefficients(), &[2.0, 2.0]);

Solve a quadratic with real roots

use use_polynomial::quadratic_roots;

let roots = quadratic_roots(1.0, -3.0, 2.0);

assert_eq!(roots, vec![1.0, 2.0]);

Status

use-polynomial is a concrete pre-1.0 crate in the RustUse math workspace. The API stays small and explicit so adjacent equation, numerical, calculus, algebra, complex, geometry, real-number, and optimization crates can build on a single focused polynomial surface.