[Scilab-users] bug in degree and polynomials comparison ?
philippe
rouxph.22 at gmail.com
Mon Aug 20 17:27:31 CEST 2018
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.
More information about the users
mailing list