Re: [Scilab-users] isreal question

2020-03-06 Thread Samuel Gougeon

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


Re: [Scilab-users] isreal question

2020-03-06 Thread Stéphane Mottelet
Hello,

This has been fixed in Scilab 6.1.

S.

> Le 6 mars 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?
> 
> using Scilab 6.0.2 x64
> 
> thank you
> 
> BR
> 
> J.K.
> 
> 
> 
> --
> Sent from: 
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> ___
> users mailing list
> users@lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

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