I've now got laguere implemented as LaguerreMethod but I keep on getting "too many iterations". I changed the throw to just output the message to console so that I can continue.
For
z^5 + z^4 + z^3 + z^2 + z + 1 = 0
========
Laguerre
========
(-0.5,0.866025403784439)
(-0.5,-0.866025403784439)
(-0.621744414124811,0.440596998965663)
(0.5,0.866025403784439)
2.83554605884655e-12
too many iterations in LaguerreMethod
(0.12174441412198,-1.30662240275026)
----------
(1.11022302462516e-16,-1.66533453693773e-16)
(2.22044604925031e-16,-1.66533453693773e-16)
(0,5.55111512312578e-17)
(0,0)
(0,0)
----------
(0.5,-0.866025403784439)
(0.5,0.866025403784439)
(-0.5,0.866025403784439)
(-0.5,-0.866025403784439)
(-0.5,0.866025403784439)
The first set of five values are the unpolished values out of laguere (the number before the "too many iterations message is the absoulute difference between the final two values of the "root"), the middle five values are the polished roots plugged back into the polynomial and the final set are the polished roots. There are only 3 distinct values in the five roots, does anybody know if these are correct?
I also tried
6z^5 + 5z^4 + 4z^3 + 3z^2 + 2z + 1 = 0
this produced
Laguerre
========
(-0.37569519922526,0.570175161011412)
(-0.663279565832258,0.22112299756456)
(-0.232299697642872,-0.569492124305167)
(0.10671690809259,0.986823103537636)
2.70791049882879e-12
too many iterations in LaguerreMethod
(0.331224221271789,-1.20862913780804)
3.59210439948278e-88
too many iterations in LaguerreMethod
----------
(0.294194556360142,-0.668367097443301)
(0.294194556360142,0.668367097443301)
(-0.37569519922526,-0.570175161011412)
(-0.670332047603097,0)
(-0.37569519922526,0.570175161011412)
----------
(-2.22044604925031e-16,0)
(-2.22044604925031e-16,0)
(1.11022302462516e-16,-5.55111512312578e-17)
(0,0)
(0,5.55111512312578e-17)
Note the second "too may iterations" message, that occurred when polishing the fourth root. Note: I've moved the replacement of very small imaginary values to after the polishing of the values. Curiously the best root found is the one that produced the "too many iterations" messages.
Finally I tried
5z^4 + 4z^3 + 3z^2 + 2z + 1 = 0
========
Laguerre
========
(-0.53783227490299,0.358284686345128)
(-0.646905558112761,-0.318596356712242)
(0.14518558903178,1.08792289420352)
2.49093028900545e-12
too many iterations in LaguerreMethod
(0.239552243981517,-1.12761122383684)
----------
(0.13783227490299,-0.678154389105336)
(0.13783227490299,0.678154389105336)
(-0.53783227490299,-0.358284686345128)
(-0.53783227490299,0.358284686345128)
----------
(0,2.77555756156289e-16)
(0,-2.77555756156289e-16)
(0,-1.66533453693773e-16)
(-2.22044604925031e-16,-5.55111512312578e-17)
Again there is the "too many iterations" message, the roots found here match the roots I found using Newton-Raphson and trial and error for the initial values.