Ask Your Question
1

Solving system of polynomial inequalities in SageMath 8.1

asked 2018-02-10 07:58:03 -0500

JasonK gravatar image

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:

RuntimeError: unable to start QEPCAD

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 flag offensive close merge delete

Comments

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)

Please edit your question to do that.

slelievre gravatar imageslelievre ( 2018-02-13 22:01:09 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-02-10 10:53:16 -0500

slelievre gravatar image

updated 2018-02-13 22:00:25 -0500

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.

edit flag offensive delete link more

Comments

Dear Slelievre,

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

sage -i qepcad

I receive and error saying:

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

JasonK gravatar imageJasonK ( 2018-02-12 05:31:46 -0500 )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.

slelievre gravatar imageslelievre ( 2018-02-13 19:50:51 -0500 )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.

slelievre gravatar imageslelievre ( 2018-02-13 19:58:30 -0500 )edit

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

JasonK gravatar imageJasonK ( 2018-02-14 05:12:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-02-10 07:58:03 -0500

Seen: 121 times

Last updated: Feb 13