# Polynomial roots Classic List Threaded 3 messages Open this post in threaded view
|

## Polynomial roots

 Hello,I want to compare roots of a polynomial with a number. But it gives error. Consider a simple e.g.,a = [2 3];s = %s;x = s^2 - 5*s + 6;r = roots(x); r1 = [roots(x)]';t1 = type(a);t2 = type(r);a > 2r > 2It does the comparison for a (done for verification) but gives the following error for r and r1, though their types are same,Undefined operation for the given operandscheck or define function %s_2_s for overloadingI tried in versions 4.1 and 4.1.2. Please guide. Thanks.Sincerely,Inderpreet -->real(r) > 2   ans  =    F    T Francois Inderpreet Arora said on 10/01/2009 18:33: > Hello, > I want to compare roots of a polynomial with a number. But it gives > error. Consider a simple e.g., > > a = [2 3]; > s = %s; > x = s^2 - 5*s + 6; > r = roots(x); r1 = [roots(x)]'; > t1 = type(a); > t2 = type(r); > a > 2 > r > 2 > > It does the comparison for a (done for verification) but gives the > following error for r and r1, though their types are same, > > Undefined operation for the given operands > check or define function %s_2_s for overloading > > I tried in versions 4.1 and 4.1.2. Please guide. Thanks. > > Sincerely, > Inderpreet
 Thanks. Now, I could figure out that it is stored with an (eventually zero) imaginary part (Help: Description of isreal function).-->isreal(r) ans  =  F  -->isreal(a) ans  =  T Sincerely,Inderpreet--- On Sat, 1/10/09, François Vogel <[hidden email]> wrote:From: François Vogel <[hidden email]>Subject: Re: [scilab-Users] Polynomial rootsTo: [hidden email]Date: Saturday, January 10, 2009, 6:05 PM```-->real(r) > 2 ans = F TFrancoisInderpreet Arora said on 10/01/2009 18:33:> Hello,> I want to compare roots of a polynomial with a number. But it gives error.Consider a simple e.g.,> > a = [2 3];> s = %s;> x = s^2 - 5*s + 6;> r = roots(x); r1 = [roots(x)]';> t1 = type(a);> t2 = type(r);> a > 2> r > 2> > It does the comparison for a (done for verification) but gives thefollowing error for r and r1, though their types are same,> > Undefined operation for the given operands> check or define function %s_2_s for overloading> > I tried in versions 4.1 and 4.1.2. Please guide. Thanks.> > Sincerely,> Inderpreet```