Hi, All: Is there a simple way to detect complex conjugates in the roots returned by 'polyroot'? The obvious comparison of each root with the complex conjugate of the next sometimes produces roundoff error, and I don't know how to bound its magnitude:
(tst <- polyroot(c(1, -.6, .4))) tst[-1]-Conj(tst[-2]) [1] 3.108624e-15+2.22045e-16i abs(tst[-1]-Conj(tst[-2]))/abs(tst[-1]) 1.971076e-15 .Machine$double.neg.eps 1.110223e-16 Testing (abs(tst[-1]-Conj(tst[-2]))/abs(tst[-1]) < (20*.Machine$double.neg.eps)) would catch this example, but it might not catch others. The 'polyroot' help page says, "See Also ... the 'zero' example in the demos directory." Unfortunately, I've so far been unable to find that. Any suggestions? Thanks in advance. Spencer Graves ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.