polynomial-roots 1.0.0

Find the real roots of huge polynomials in milliseconds
Documentation
  • Coverage
  • 40.91%
    9 out of 22 items documented0 out of 12 items with examples
  • Size
  • Source code size: 16.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.82 MB 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: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • TiagoCavalcante/polynomial-roots
    4 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • TiagoCavalcante

polynomial-roots

Find the real roots of huge polynomials in milliseconds

How to compile?

cargo build --release

How to use?

The coefficients are in degree-ascending order, that is: $x0 + x1 + x2 + x3 + \cdots$
The coefficients are passed space-separated, therefore to solve the polynomial $3 - 9x + x^3$ you need to run the program the following way:

$ cargo install polynomial-roots
$ polynomial-roots
3 -9 0 1
{ -3.154523; 0.33760893; 2.816914; }

(note: don't forget the zero coefficients)

How it works?

The roots are found using the linear formula ($\dfrac{-b}{a}$), the quadratic formula ($\dfrac{-b \pm \sqrt{b^2 - 4 a c}}{2 a}$), or the false position method over the Cauchy's bound. It can solve polynomials of any degree.

I'm not getting all the roots, what should I do?

If you aren't getting all the roots you should modify the constants from the file src/constants.rs. You can DECREASE PARTITION_SIZE and INCREASE ITERATIONS. That will make the program slower, but with the right tweaks it can solve any polynomial.