File Exchange

image thumbnail

Computing multiple roots of polynomials with improved accuracy.

version (2.03 KB) by Mauricio Martinez-Garcia
Algorithm to improve the accuracy of the MATLAB 'roots' function with multiple roots.


Updated 28 Apr 2016

View License

Polynomials with multiple roots are a challenge for traditional root finding algorithms, as their accuracy and numerical stability can be severely affected.
This problem can be reduced by dividing the polynomial of interest, by the greatest common divisor or itself and its derivative. One can easily show that this results in a polynomial with non-multiple roots.
The proposed algorithm works as follows:

1. Divide the input polynomial by the greatest common factor of itself and its first derivative.
2. Find roots of resulting polynomial.
3. Finally, determine multiplicity of each root.

Cite As

Mauricio Martinez-Garcia (2021). Computing multiple roots of polynomials with improved accuracy. (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Dominic Diston

Excellent result. Well done.

Joe Nagar

I'm working on a numerical electromagnetics code in MATLAB and the built-in roots wasn't accurate enough for what I needed. This was exactly what I needed, it's much more numerically stable.

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!