Why is Fricas spamming "number of primes" messages?

13 views
Skip to first unread message

Neven Sajko

unread,
Dec 9, 2021, 1:20:07 PM12/9/21
to fricas-devel
While running some of my buggy code using the Guess package, I got
spammed by many messages like so:

number of primes
100
number of primes
100
number of primes
100
number of primes
100
...

A little searching through the Fricas code base seems to indicate the
ModularHermitePade package as the culprit: in modhpsol.spad at line
1320 there's a logical branch that prints the messages:
https://github.com/fricas/fricas/blob/master/src/algebra/modhpsol.spad#L1320

It seems to me like the messages are a mere status report, so maybe
they aren't important enough to warrant spamming, maybe the lines
1320-1322 should just be removed? Not that I understand their purpose.

On the other hand, it's pretty strange how the messages seem to happen
nondeterministically: I've run the same guess calls with the same
parameters multiple times, but only now did I get any "number of
primes" message.

Thanks,
Neven

Martin R

unread,
Dec 10, 2021, 3:43:05 AM12/10/21
to FriCAS - computer algebra system
Sorry for replying late.

modhpsol uses a randomized algorithm, trying to reconstruct the solution by generating sufficiently many solutions modulo a prime number.  However, under certain circumstances, this does not work well - mostly, if the input contains very many zeros.  In this case, there are very many "fake" solutions, which only work modulo a prime or modulo a few primes, but is no solution of the original input.

Thus, this output may seve as a warning.  It may make sense to display it only when debug == true, I don't know.

Best wishes,

Martin
Reply all
Reply to author
Forward
0 new messages