vorot / roots

Library of well known algorithms for numerical root finding.
BSD 2-Clause "Simplified" License
50 stars 18 forks source link

Fix#25 : find_roots_eigen Not Working for Polynomial of Degree 4 or More #26

Closed sebedard13 closed 1 year ago

sebedard13 commented 1 year ago

I found an error in the creation of the matrix of the polynomial. It reverses the order of the coefficients. I have corrected it and now it works correctly. I specify in the function documentation the order of the coefficients like find_roots_sturm.

There were multiple tests with bad results. It seems to be due to the same error, so I corrected them.

On the other hand, I did personally some benchmarks of eigen and sturm to compare. Sturm is faster by a factor of 10 in my case without a loss of accuracy. I think it doesn't make sense to use the eigen function for real roots, but the eigen function could be useful to find the complex roots. Maybe changing the output should be a good idea.

sebedard13 commented 1 year ago

25