Le 06/03/2020 à 19:31, kjubo a écrit :
Dear all,

consider this code:

==start of code
clc
clear

a3 =  1
a2 = -1
a1 =  0.106865
a0 = -0.002212
mode(0)
sol = roots([a3 a2 a1 a0])
isreal(sol(1))
isreal(sol(2))
isreal(sol(3))
==end of code

i get this print in console:

   sol  =

    0.8816333
    0.0907062
    0.0276605
  ans  =

   F
  ans  =

   F
  ans  =

   F

I do not understand, why the isreal return false flag, if all roots are real
with no imaginary part.

I am missing something? Or it is bug?


isreal() tests the encoding as complex, not the mathematical realness.
If you wish to test the realness, then you have to use
isreal(x, 0)
Then, isreal(,0) still looks awkward, because we expect an element-wise answer, while only one scalar boolean is returned when x is a vector or a matrix.

Samuel


_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to