[Scilab-users] bug in degree and polynomials comparison ?

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

[Scilab-users] bug in degree and polynomials comparison ?

Hi,

while upgrading one of my toolboxes I discovered a strange error in
polynomial comparisons. The error appeared during automatic unit tests,
a " assert_checkequal(P1,P2)" was expected to be True and was in fact
False. After some investigations It looks like there is an error in
degree so that   P1==P2 can be False  while  P1-P2==0.

Can someone confirm the bug in scilab-6.0.1  before I fill in a report
on bugzilla. Run the following commands :

X=poly(0,'x')
A=(X-1)^3
B=(X+1)^2
R=20 +12*X
Q=(A-R*X^3)/B;
Q=Q.num

A,(B*Q+R*X^3) // equal
A-(B*Q+R*X^3)  //=0
A==(B*Q+R*X^3)  // %F !!!!
coeff((B*Q+R*X^3))
coeff(A)
degree((B*Q+R*X^3)) // =4 !!
degree(A)  // = 3

and compare with the expected result thereafter

Sincerly yours,

Philippe

--> A,B,Q,R
 A  =

            2   3
  -1 +3x -3x  +x

 B  =

           2
   1 +2x +x

 Q  =

             2
  -1 +5x -12x

 R  =


   20 +12x


--> A,(B*Q+R*X^3)
 A  =

            2   3
  -1 +3x -3x  +x

 ans  =

            2   3
  -1 +3x -3x  +x


--> A-(B*Q+R*X^3)
 ans  =


   0


--> A==(B*Q+R*X^3)
 ans  =

  F


--> coeff((B*Q+R*X^3))
 ans  =

  -1.   3.  -3.   1.   0.


--> coeff(A)
 ans  =

  -1.   3.  -3.   1.


--> degree((B*Q+R*X^3))
 ans  =

   4.


--> degree(A)
 ans  =

   3.

_______________________________________________
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: bug in degree and polynomials comparison ?

Hello Philippe,

This is fixed in Scilab 6.0.2-. Please see mainly
http://bugzilla.scilab.org/14701
http://bugzilla.scilab.org/14708

Regards
Samuel

Le 20/08/2018 à 17:27, philippe a écrit :

> Hi,
>
> while upgrading one of my toolboxes I discovered a strange error in
> polynomial comparisons. The error appeared during automatic unit tests,
> a " assert_checkequal(P1,P2)" was expected to be True and was in fact
> False. After some investigations It looks like there is an error in
> degree so that   P1==P2 can be False  while  P1-P2==0.
>
> Can someone confirm the bug in scilab-6.0.1  before I fill in a report
> on bugzilla. Run the following commands :
>
> X=poly(0,'x')
> A=(X-1)^3
> B=(X+1)^2
> R=20 +12*X
> Q=(A-R*X^3)/B;
> Q=Q.num
>
> A,(B*Q+R*X^3) // equal
> A-(B*Q+R*X^3)  //=0
> A==(B*Q+R*X^3)  // %F !!!!
> coeff((B*Q+R*X^3))
> coeff(A)
> degree((B*Q+R*X^3)) // =4 !!
> degree(A)  // = 3
>
> and compare with the expected result thereafter
>
> Sincerly yours,
>
> Philippe
>
> --> A,B,Q,R
>   A  =
>
>              2   3
>    -1 +3x -3x  +x
>
>   B  =
>
>             2
>     1 +2x +x
>
>   Q  =
>
>               2
>    -1 +5x -12x
>
>   R  =
>
>
>     20 +12x
>
>
> --> A,(B*Q+R*X^3)
>   A  =
>
>              2   3
>    -1 +3x -3x  +x
>
>   ans  =
>
>              2   3
>    -1 +3x -3x  +x
>
>
> --> A-(B*Q+R*X^3)
>   ans  =
>
>
>     0
>
>
> --> A==(B*Q+R*X^3)
>   ans  =
>
>    F
>
>
> --> coeff((B*Q+R*X^3))
>   ans  =
>
>    -1.   3.  -3.   1.   0.
>
>
> --> coeff(A)
>   ans  =
>
>    -1.   3.  -3.   1.
>
>
> --> degree((B*Q+R*X^3))
>   ans  =
>
>     4.
>
>
> --> degree(A)
>   ans  =
>
>     3.
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

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

Re: bug in degree and polynomials comparison ?

Le 20/08/2018 à 17:50, Samuel Gougeon a écrit :
> Hello Philippe,
>
> This is fixed in Scilab 6.0.2-. Please see mainly
> http://bugzilla.scilab.org/14701
> http://bugzilla.scilab.org/14708

thanks Samuel, I missed those reports on bugzilla

Best regards,

Philippe

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users