5.0 | 2 ratings Rate this file 17 Downloads (last 30 days) File Size: 1.63 KB File ID: #25375

Polynomials with multiple roots solved



21 Sep 2009 (Updated )

Solving multiple roots polynomial, using simple elementary arithematic operations mostly.

| Watch this File

File Information

A given polynomial having multiple roots is solved by the routine
              Z = poly_roots(p)
            Input p: polynomial coefficient vector
            Output Z: root-multiplicity pairs

The MATLAB source code is very simple and compact (fewer then 50 lines) and amazingly gives the expected results for any test polynomials of very high degree and multiplicities.

In this simple routine 'poly_roots.m', except for a MATLAB built-in function 'roots.m', all the required computations involve only simple elementary arithematic operations (such
as additions, subtractions, multiplications, divisions, and integer exponations), without applying any high mathematics. The only routine 'roots.m' is used here mainly to solve a simple roots polynomial (not any multiple roots polynomials).

Most of the calculations in this routine involve elementary arithematic operations, therefore, it is fairly easy to improve the expected results from the existing double precision to vpi' multiple precision.
For detail description, please refer to
F.C. Chang, "Solving multple-root polynomials" IEEE Antennas and Propagation Magazine, Vol.51, No.6, pp. 151-155, Dec. 2009.


Gcd Of Polynomials, Multiple Root Polynomial Solved By Partial Fraction Expansion, and Polynomial Coefficient Vector Derived From Sub Polynomial Factors inspired this file.

This file inspired Solving Multiple Root Polynomials.

MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
14 May 2014 Bor Plestenjak

The correction works for the reported problem, but, there is more. For instance, for p=[3e-04 1e-09 1e-09 5e-08 2e+04] results are wrong and in addition multiplicities appear as complex numbers.

14 May 2014 Feng Cheng Chang

Reply to Bor Plestenjak:

Thank you for your pinpoint the bug.

It should be OK if the file is correct as follows: In line 15, change
" if npo == 1, return, end;"
" if npo == 0, return, end;"

I will update this file later. But please try again now!

14 May 2014 Bor Plestenjak

There seems to be a bug when it comes to linear polynomials (which of course can not have multiple zeros). poly_roots([1 2]) does not return a zero and poly_roots([1 1 0 0 0]) returns just the triple zero 0.

29 Apr 2012 John D'Errico

Well done.

27 Apr 2012 Andrew Mendelsohn

Nice little file finds multiple roots much more accurately than built in routine. Used it in an inverse Laplace transform application.

23 Oct 2009 Feng Cheng Chang

Self comment:

Amazingly, the revised routine can find the desired roots of test polynomials p(x) -- expanded, such as
p(x) = (x+987654321)^N,
where N=any positive integers, such as 10, 100, 1000, 10000, ....

For example, find the roots of the following polynomial expanded
p(x) = (x+987654321)^12345.

>> format long g
>> p = poly([-987654321*ones(1,12345)]);
>> Z = poly_roots(p)
Z =
-987654321 12345

It takes about 2 min total time. Most is to create polynomial coefficient vector p, and only 0.5 sec to get the desired root-multiplicity pairs Z.

Of course, any numerical algorithm is not fool prove, neither is mine.

Foe example,it does work for p(x)=(9876x+12345)^70, but fails for p(x)=(9876x+12345)^80.

I hope someone would like to try it for some other existing test polynomials, and give me any valuable comments.

23 Oct 2009

Update the m-file, the very small roots can thus be solved.

04 Jan 2010

Update m-file -- improve help description

26 Feb 2010

Update the m-file to speed up operations. Also present 17 typical examples for test polynomials in MATLAB script file.

09 Mar 2010

add some examples

21 May 2012

Update the original source code. It involves only simple elementary operations, except 'roots.m'. It may easily convert into multiple precision later.

22 May 2012

Minor correction to poly_roots.m

15 May 2014

Correct a tiny bug, pinpointed by a reader.

Contact us