# Solving system of polynomial inequalities in SageMath 8.1

Hi everyone!

I am currently trying to use SageMath for the solution of a system of polynomial inequalities. In the first place based on the documentation and because solutions were returned I used the "solve" command and the "solve_ineq" command. However, when I tried to verify the answers with the one computed by Mathematica I realised the solutions were not the same. Is this a bug in the current version?

Also, I am trying to do it the normal way by computing the CAD using QEPCAD but when I tried to replicate the example on the website I get the following error:

I am using SageMath 8.1 in Windows 7 64bit and jupyter notebook for interface that I call using the SageMath shell, if that is of any help.

The system I am referring to is the following:

sys=[0.800000000000000theta1x1 + 0.100000000000000theta2x2 - 24000, 0.100000000000000theta2x2 + 0.0500000000000000x1 - 2000, 0.100000000000000x1 + 0.360000000000000*x2 - 6000, -x1, -x2, -theta1 - 5, theta1 - 5, -theta2 - 5, theta2 - 5, -lamda1, -lamda2, -lamda3, -lamda4, -lamda5]

and using the following substitution:

sol=[x1 == 440000/(16theta1 - 1), x2 == 80000(4theta1 - 3)/(16theta1theta2 - theta2), lamda1 == 54(3theta2 - 2)/(16theta1theta2 - theta2), lamda2 == 54(32theta1 - 3theta2)/(16theta1theta2 - theta2), lamda3 == 0, lamda4 == 0, lamda5 == 0]

The output of

solve([sys[i].subs(sol)<=0 for i in range(0,len(sys))], theta1, theta2)

is

[]

Sorry for the long post but I would really appreciate and help with regards on how to solve such as system of inequalities and whether solve command has a bug?

Best, Jason

edit retag close merge delete

To display inline code, like f, use backticks.

To display blocks of code or error messages, separate them by a blank line from the rest of the text, and do one of the following (all give the same result):

• indent all code lines with 4 spaces
• select code lines and click the "code" button (the icon with '101 010')
• select code lines and hit ctrl-K

For instance, typing

If we define f by

def f(x, y):
return (x, y)

then f(2, 3) returns (2, 3) but f(2) gives:

TypeError: f() takes exactly 2 arguments (1 given)


produces:

If we define f by

def f(x, y):
return (x, y)


then f(2, 3) returns (2, 3) but f(2) gives:

TypeError: f() takes exactly 2 arguments (1 given)


( 2018-02-13 22:01:09 -0600 )edit

Sort by ยป oldest newest most voted

You need to install the optional package qepcad.

Do this by running the following in a terminal:

sage -i qepcad


Then you can follow the tutorial in the documentation page for the SageMath interface to QEPCAD.

That tutorial contains the following sentence, after a few introductory paragraphs:

The examples below require that the optional qepcad package is installed.

Possibly we should add a line right next to that comment reminding the user how to install it.

Sadly the SageMath installer for Windows currently does not support installing extra packages that require rebuilding Sage.

Under Windows, if you feel like it, you might install Cygwin and build Sage yourself under Cygwin. See the "Sage Cygwin-64 port" wiki page.

Other options include using SageDebianLive, or the SageAppliance, or CoCalc.

Example of using QEPCAD: see this CoCalc worksheet.

more

Dear Slelievre,

Thanks for the reply. I am trying to install qepcad from the Sage Shell and when I type

sage -i qepcad


make: *** No rule to make target 'all-toolchain'.  Stop.


I had a look on the forum about similar issues and I found one (here: https://ask.sagemath.org/question/34267/installing-cryptominisat/) but I still no luck. Any ideas?

Best, Jason

( 2018-02-12 05:31:46 -0600 )edit

Oh, sorry, I read your question too fast, and did not notice you were running Sage on Windows. Installation of extra packages that require building SageMath is currently not supported on Windows.

( 2018-02-13 19:50:51 -0600 )edit

It is possible that when Sage 8.2 comes out, some extra packages (possibly including qepcad) will come pre-installed if you install Sage using the SageMath installer for Windows. See sage-windows issue #14: Maybe include some "optional" packages by default.

( 2018-02-13 19:58:30 -0600 )edit

Many thanks for the reply. Is there something I could attempt to help with for this to happen?

( 2018-02-14 05:12:12 -0600 )edit