From mavip1@inet.polyu.edu.hk  Tue Nov 28 05:25:26 2000
From: mavip1@inet.polyu.edu.hk (mavip1@inet.polyu.edu.hk)
Date: Tue, 28 Nov 2000 06:25:26 +0100 (MET)
Subject: [Rd] BUG: polyroot() (PR#751)
Message-ID: <200011280525.GAA06952@pubhealth.ku.dk>

I have found that the polyroot()
function in R-1.1.1(both solaris
and Win32 version) gives totally
incorrect result. Here is the offending
code:

# Polyroot bug report:
# from R-1.1.1
> sort(abs(polyroot(c(1, -2,1,0,0,0,0,0,0,0,0,0,-2,5,-2,0,0,0,0,0,0,0,0,0,1,-2,1))))
 [1] 0.8758259 0.9486499 0.9731015 1.5419189 1.7466214 1.7535362 1.7589484
 [8] 2.0216317 2.4421509 2.5098488 2.6615572 2.7717724 2.8444048 2.9147685
[15] 2.9302278 2.9757159 3.2037151 3.2052962 3.2498510 3.2815881 3.3250881
[22] 4.6593700 4.7048556 5.2738258 5.7369920 5.9017094
# from Splus 2000
> sort(abs(polyroot(c(1, -2,1,0,0,0,0,0,0,0,0,0,-2,5,-2,0,0,0,0,0,0,0,0,0,1,-2,1))))
 [1] 0.8038812 0.8038812 0.8758259 0.8758259 0.9235722
 [6] 0.9235722 0.9439788 0.9439788 0.9536692 0.9536692
[11] 0.9582403 0.9582403 0.9596028 1.0420978 1.0435796
[16] 1.0435796 1.0485816 1.0485816 1.0593458 1.0593458
[21] 1.0827524 1.0827524 1.1417794 1.1417794 1.2439649
[26] 1.2439649

>From mathematical theory I know that the Splus result
is correct while the R result is wrong. I would have
checked the source if I had the time.



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] BUG: polyroot() (PR#751)
mavip1@inet.polyu.edu.hk