File Exchange

image thumbnail

Mullers method for polynmial root finding.

version (2.65 KB) by Chandan Kumar
Finds root of a polynomial numerically even if it is complex.


Updated 02 Dec 2009

View License

Müller's method uses three points, It constructs a parabola through these three points, and takes the intersection of the x-axis with the parabola to be the next approximation. The order of convergence of Müller's method is approximately 1.84. This method could be advantageous if looking for a complex roots, since any iterates can be complex even if previous ones are real.

Procedure to run the code:
Press F5 or RUN, then in command window a message would be displayed- "Polynomial function of Order "n" is of type:a[1]X^n+a[2]X^(n-1)+ ..+a[n]X^1+a[n+1]
Type Coeff as "[ 1 2 3 ...]" i.e Row vector form."
Enter the values according to above order.
If polynomial is more than 1st order, it would ask for three initial guess for iteration.
Please provide with three distinct numbers or else error message would be displayed.

Enter the coefficient in order? [1 2 3 4 5]
Give the three initial guess point [x0, x1, x2]: [-1 0 1]
or any other three distinct number,
If the range of solution is known then using a value close to that range might yield a faster result. Or if you don't have any clue about value of root then just press enter when ask for guess, and it would use default value of [1 2 3]. If you have found the desired root that you want you can terminate the process any time, writing [0 0 0] when asked for initial Guess.

Cite As

Chandan Kumar (2021). Mullers method for polynmial root finding. (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Chandan Kumar

HI Adrian,

You have rightly pointed out that the extra terms are imaginary numbers of the order e-22. You may get rid of these values by changing the following line in the code (line no -77): Delta = sqrt(abs(b^2-4*polyval(Coeff,Guess(3))*d)); (old: Delta = sqrt(b^2-4*polyval(Coeff,Guess(3))*d);) to eliminate the imaginary parts in final solution.
But, I don't know how the programs capability to calculate complex roots may be affected by changing that particular line of code to calculate only real values.

Adrian Gutierrez

When ever I try to find the roots for
f(x) = (x-3)(x-2)(x-1) = x^3-6x^2+11x-6
with initial values [-1, 2, 4], I get the following,

~ Root no 1 is 3-9.1038e-23i .
~ Root no 2 is 2+1.8208e-22i .
~ Root no 3 is 1-9.1038e-23i .

What does the extra-terms in this final answers mean? (here I am talking about 9.1038e-23i)is that I representing an imaginary number?

MATLAB Release Compatibility
Created with R14SP3
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!