[scilab-Users] Strange poly() results

Serge Steer serge.steer at inria.fr
Tue May 1 21:24:48 CEST 2012


PLease can you provide more information (Operating system, Scilab version,...)

On my Linux box with Scilab-5.3.3  I got
-->clean(coeff(poly(roots(poly([1 1 1],"x","c")),"x","r"))) 
 ans  =
 
    1.    1.    1.  
 Serge Steer
INRIA

----- Mail original -----
> De: "Kevin McCoy" <kevinm at aavatech.com>
> À: users at lists.scilab.org
> Envoyé: Lundi 30 Avril 2012 16:39:24
> Objet: [scilab-Users] Strange poly() results
> 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.
> 
> --
> To unsubscribe from this mailing-list, please send an empty mail to
> users-unsubscribe at lists.scilab.org
> To check the archives of this mailing list, see
> http://mailinglists.scilab.org/



More information about the users mailing list