[Scilab-users] isreal question

classic Classic list List threaded Threaded
3 messages Options
kjubo kjubo
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] isreal question

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: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: isreal question

Hello,

This has been fixed in Scilab 6.1.

S.

> Le 6 mars 2020 à 19:31, kjubo <[hidden email]> 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
> [hidden email]
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: isreal question

In reply to this post by kjubo
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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users