Strange poly() results

Kevin McCoy kevinm at aavatech.com
Mon Apr 30 16:39:24 CEST 2012


When I run the following:

clean(coeff(poly(roots(poly([1 1 1],"x","c")),"x","r")))     I get ...

ans  =
 
    1. + 0.4330127i    1.    1. 

But I'm expecting ...

ans  =
 
    1.    1.    1. 

Am I doing something wrong?   The documentation says that roots() and poly()
are inverse functions, that is, if I construct a polynomial (using
poly(pr,"x","r"), where pr are the roots of a polynomial), then I should get
back that original polynomial.

Here are some other outputs:

clean(coeff(poly(roots(poly([1 1],"x","c")),"x","r"))) -->   1.    1.  
[correct]

clean(coeff(poly(roots(poly([1 0 1],"x","c")),"x","r"))) -->  1.    0.    1.   
[correct]

clean(coeff(poly(roots(poly([1 0 0 1],"x","c")),"x","r"))) -->  0.625 +
0.2165064i    0.4330127i    0    1.  [incorrect]

clean(coeff(poly(roots(poly([1 1 2],"x","c")),"x","r"))) --> 0.5 +
0.1653595i    0.5    1.  [incorrect]

What am I doing wrong?

Thanks!





--
View this message in context: http://mailinglists.scilab.org/Strange-poly-results-tp3950884.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list