msolve icon indicating copy to clipboard operation
msolve copied to clipboard

random wrong number of real roots

Open gastineau opened this issue 4 months ago • 0 comments

Hello,

Real root isolation seems return a wrong result on the following input. Most of the time it returns 6 roots, but sometimes it returns only 5 roots.

The system is:

(x-2)*(y-3)*(z-4)
(x-6)*(y-7)*(z-5)
(x-4)*(y-11)*(z-3)

expressed in msolve format:

z,y,x
0
-24+6*z+8*y-2*y*z+12*x-3*x*z-4*x*y+x*y*z,
-210+42*z+30*y-6*y*z+35*x-7*x*z-5*x*y+x*y*z,
-132+44*z+12*y-4*y*z+33*x-11*x*z-3*x*y+x*y*z

When you run the following command multiple times (usually less than 40), you will get sometimes 5 roots instead 6.

./msolve -v 2 -f  prog3.ms -o out1

An example of invalid result:

[0, [1,
[[[4, 4], [11, 11], [6, 6]], [[3, 3], [3, 3], [6, 6]], [[1361129467683753853853498429727072845823 / 2^128, 1361129467683753853853498429727072845825 / 2^128], [2381976568446569244243622252022377480191 / 2^128, 2381976568446569244243622252022377480193 / 2^128], [1361129467683753853853498429727072845823 / 2^128, 1361129467683753853853498429727072845825 / 2^128]], [[383640684963666669797379522915633877259 / 2^126, 1534562739854666679189518091662535509037 / 2^128], [426175980828783977730301348844604903691 / 2^125, 3409407846630271821842410790756839229529 / 2^128], [680564733841876926926749214863536422911 / 2^128, 680564733841876926926749214863536422913 / 2^128]], [[1701411834604692317316873037158841057279 / 2^128, 1701411834604692317316873037158841057281 / 2^128], [1020847100762815390390123822295304634367 / 2^128, 1020847100762815390390123822295304634369 / 2^128], [1361129467683753853853498429727072845823 / 2^128, 1361129467683753853853498429727072845825 / 2^128]]]
]]:

I attach the log file

log.txt

To find easily when the bug occurs, run the following command. The last line becomes "Number of real roots: 5" and you will get the logs in log.txt

 msolve -v 2 -f prog3.ms -o out1 2>&1 | tee log.txt | grep Number

I reproduce this bug on :

  • arm macos (macos 15): msolve=0.9.0, flint=3.3.1 (very frequent)
  • arm linux ( fedora:rawhide ) : msolve=0.9.0, flint=3.3.1 (very frequent)
  • arm linux ( fedora:42 ) : msolve=0.8.0, flint=3.2.2 (very frequent)
  • x64 linux ( fedora:rawhide ) : msolve=0.9.0, flint=3.3.1 (less frequent)

The problem occurs more frequently on ARM processors than on Intel processors.

To reproduce the bug on fedora:rawhide with podman or docker:

docker run -i -t fedora:rawhide /bin/bash
dnf install -y msolve 
cat >prog3.ms <<__EOF
z,y,x
0
-24+6*z+8*y-2*y*z+12*x-3*x*z-4*x*y+x*y*z,
-210+42*z+30*y-6*y*z+35*x-7*x*z-5*x*y+x*y*z,
-132+44*z+12*y-4*y*z+33*x-11*x*z-3*x*y+x*y*z

__EOF
# execute this line multiples times until the rumber of real roots changes
msolve -v 2 -f prog3.ms -o out1 2>&1 | tee log.txt | grep Number

gastineau avatar Aug 11 '25 15:08 gastineau