More Flexible Sorting and Multiplicity of Roots of a Polynomial

More Flexible Sorting and Multiplicity of Roots of a Polynomial
Updated 15 Jul 2005

No License

Imagine a function that can pair the Complex Conjugate Roots of a Polynomial, and also tell us how many Roots are Real, and how many are Complex ; imagine further, that this function should also be able to give us the multiplicity of the roots ; and imagine further, that this function should be able to do all this even if not all the Complex Roots of the Polynomial are Conjugate Pairs.
Information about multiplicity of roots is important when we need to raise a Polynomial to Fractional Powers.

One (feeble) immediate answer could be that MATLAB's standard cplxpair could do (part of) the functions. But, I have observed that as the degree of a Polynomial increases, the results obtained by Matlab's roots has so much variation that the standard cplxpair will result in an error !
The standard Matlab roots () function does not return n exactly identical roots if the input Polynomial has n Repeated Roots, specially when n is above 10.

So, firstly, we need to modify the tolerances of cplxpair.
My cplxpair_Mod.m is a modified version of the Standard R14 Matlab's cplxpair.m.

So, in addition to computing the number of Real and Complex Roots, and their multiplicities, we also need this new function to be able to perform the foll additional fns :
a) optionally reverse the listing order of the roots
b) List the Pure Real Roots in the beginning, and then the Complex (Conjugate-Paired) Roots for both the NORmal and the REVerse sorting cases.

Such a function is this Programme cmplx_roots_sort_Det.m.
This function makes calls to the lighter version cmplx_roots_sort.m, to Real_Roots_Multicty.m and to cplxpair_Mod.m.
When cplxpair_Mod.m throws up an error as in the case of the presence of Non-Conjugate Complex Roots, the case is dealt with in the catch block of code by considering individual roots.

An other Programme of mine, Poly_POWER.m, uses cmplx_roots_sort_Det.m to get the multiplicity of roots.

Cite As

Sundar Krishnan (2024). More Flexible Sorting and Multiplicity of Roots of a Polynomial (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Polynomials in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes