Bug in qepcad?

110 views
Skip to first unread message

Peter Mueller

unread,
Jul 11, 2022, 11:33:11 AM7/11/22
to sage-support
When running

var('p1', 'p2', 'p3', 'q1', 'q2', 'q3')
qf = qepcad_formula
# q1 = p1
l = [p1+q1 == 1, 0 < p1, p1 < 1,
     0 <= p2, p2 <= 1, 0 <= q2, q2 <= 1,
     p2 + p1*q1 + q2 == 1,
     0 <= p3, p3 <= 1, 0 <= q3, q3 <= 1,
     p3 + p2*q1 + p1*q2 + q3 == 1]
F = qepcad_formula.and_(l)
qepcad(F, solution='any-point')

I get the wrong answer

ValueError: input formula is false everywhere

However, this set of inequalities has solutions. In fact, if there were no solution, this should hold even more if we remove the comment in

# q1 = p1

above. However, doing that produces a correct solution

{'p1': 1/2, 'p2': 0, 'p3': 0, 'q2': 3/4, 'q3': 5/8}.

Am I doing something wrong? If it is a bug, then I don't know if comes from the interface to qepcad, or qepcad itself.

I've tried the above example in Sage versions 9.6 and 9.7.beta3 on a linux machine.

-- Peter Mueller

Dima Pasechnik

unread,
Jul 11, 2022, 11:40:11 AM7/11/22
to sage-support


On Mon, 11 Jul 2022, 16:33 'Peter Mueller' via sage-support, <sage-s...@googlegroups.com> wrote:
When running

var('p1', 'p2', 'p3', 'q1', 'q2', 'q3')
qf = qepcad_formula
# q1 = p1
l = [p1+q1 == 1, 0 < p1, p1 < 1,
     0 <= p2, p2 <= 1, 0 <= q2, q2 <= 1,
     p2 + p1*q1 + q2 == 1,
     0 <= p3, p3 <= 1, 0 <= q3, q3 <= 1,
     p3 + p2*q1 + p1*q2 + q3 == 1]
F = qepcad_formula.and_(l)
qepcad(F, solution='any-point')

I get the wrong answer

ValueError: input formula is false everywhere

However, this set of inequalities has solutions. In fact, if there were no solution, this should hold even more if we remove the comment in

# q1 = p1

above. However, doing that produces a correct solution

{'p1': 1/2, 'p2': 0, 'p3': 0, 'q2': 3/4, 'q3': 5/8}.

Am I doing something wrong? If it is a bug, then I don't know if comes from the interface to qepcad, or qepcad itself.

you can try running qepcad standalone, at 
   ./sage -sh
prompt, and try reproducing...



I've tried the above example in Sage versions 9.6 and 9.7.beta3 on a linux machine.

-- Peter Mueller

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/826d7ed3-969c-4604-b703-bb0215a2ede5n%40googlegroups.com.

Peter Mueller

unread,
Jul 11, 2022, 12:04:44 PM7/11/22
to sage-support
Thanks for the suggestion, I wasn't aware of this feature. However, here it results in "Error HELPFRD: Could not open ~/local/sage/local/bin/qepcad/share/qepcad/qepcad.help". Unfortunately, the binary of qepcad is the file ~/local/sage/local/bin/qepcad, so I cannot symlink the existing help page (at ~/local/sage/local/share/qepcad/qepcad.help) to the place where qepcad is looking for it.

Dima Pasechnik

unread,
Jul 11, 2022, 1:11:08 PM7/11/22
to sage-support


On Mon, 11 Jul 2022, 17:04 'Peter Mueller' via sage-support, <sage-s...@googlegroups.com> wrote:
Thanks for the suggestion, I wasn't aware of this feature. However, here it results in "Error HELPFRD: Could not open ~/local/sage/local/bin/qepcad/share/qepcad/qepcad.help". Unfortunately, the binary of qepcad is the file ~/local/sage/local/bin/qepcad, so I cannot symlink the existing help page (at ~/local/sage/local/share/qepcad/qepcad.help) to the place where qepcad is looking for it.

you can move ~/local/sage/local/bin/qepcad 
somewhere (e.g. rename it) and create the necessary link.


Peter Mueller

unread,
Jul 11, 2022, 3:24:00 PM7/11/22
to sage-support
OK, calling "sage -sh" and setting "export qe="~/local/sage/local" allows to start qepcad without relocating files. However, qepcad fails for this rather small example , telling "Failure occurred in:    GCSI (final check) Reason for the failure: Too few cells reclaimed." So either (i) qepcad has a bug here, or (ii) qepcad's abilities are rather limited, or (iii) I'm not using it the right way. If (i) or (ii) applies, there is little hope for improvements, since the project seems to have abandoned in 2012.  

Dima Pasechnik

unread,
Jul 12, 2022, 8:06:50 AM7/12/22
to sage-support
On Mon, Jul 11, 2022 at 8:24 PM 'Peter Mueller' via sage-support
<sage-s...@googlegroups.com> wrote:
>
> OK, calling "sage -sh" and setting "export qe="~/local/sage/local" allows to start qepcad without relocating files. However, qepcad fails for this rather small example , telling "Failure occurred in: GCSI (final check) Reason for the failure: Too few cells reclaimed." So either (i) qepcad has a bug here, or (ii) qepcad's abilities are rather limited, or (iii) I'm not using it the right way. If (i) or (ii) applies, there is little hope for improvements, since the project seems to have abandoned in 2012.

qepcad is certainly too old to be saved. One ought to implement
cylindrical algebraic decomposition (CAD)
in a modern way, e.g. in Sage...

On a practical side of things, I'd have converted your system into a
system of equations (using squares etc
to model inequalities) and then looked for real solutions only (e.g.
using msolve).

HTH
Dima
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/3ec4c1a7-a7fd-4b1e-8726-9ba305b17c54n%40googlegroups.com.

Peter Mueller

unread,
Jul 12, 2022, 10:00:30 AM7/12/22
to sage-support
Dear Dima,

thanks for your input. Three additions: (i) I had overlooked that, but in fact one can directly call the qepcad shell within sage by 'qepcad_console()'. (ii) The described error results from the frontend, it apparently misinterprets the result returned by the qepcad backend if it fails due to low memory. (iii) Indeed, I know msolve and it looks very promising. The system I sent is not the one I actually wanted to study, it resulted from reducing a bigger system which shows the unexpected behavior.

-- Peter Mueller

Reply all
Reply to author
Forward
0 new messages