Ask Your Question

JasonK's profile - activity

2020-05-08 12:40:31 -0500 received badge  Notable Question (source)
2019-12-06 03:18:55 -0500 received badge  Popular Question (source)
2018-04-30 12:13:00 -0500 received badge  Scholar (source)
2018-04-30 12:09:22 -0500 received badge  Nice Question (source)
2018-04-30 12:09:14 -0500 received badge  Nice Answer (source)
2018-04-30 09:40:55 -0500 received badge  Teacher (source)
2018-04-30 09:40:55 -0500 received badge  Self-Learner (source)
2018-04-30 08:38:34 -0500 answered a question Make SageMath allow for Error of Mathematica

Apologies for posting again but I figured out you can pass the option as a normal arguement so:

mathematica('Off[Solve::ratnz]')

does the trick and solve returns the solutions.

Hope this helps someone else too.

JasonK

2018-04-30 06:55:48 -0500 received badge  Editor (source)
2018-04-30 06:45:47 -0500 asked a question Make SageMath allow for Error of Mathematica

Hello everyone!

I am currently trying on the interface of SageMath to Mathematica for the solution of polynomial equations and inequalities. Whilst doing that I came across an instance that is typical for Mathematica when solving systems of polynomial equation and inequalities. I tried to solve the system and Mathematica returned the error

"Mathematica ERROR: Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result. "

and as a result Sage raised the error and returned no solution.

I am trying to get solutions to the system:

sys={0.500000000000000*lamda2*theta3 - 3*x1^2 + 2*lamda1 - lamda3 + 5==0,lamda1 + lamda2 - lamda4 + 3*theta1 - 6*x2==0,lamda1*(theta2 + 2*x1 + x2 - 7.50000000000000)==0,(0.500000000000000*theta3*x1 + x2 - 1.50000000000000)*lamda2==0,-lamda3*x1==0,-lamda4*x2==0}

for the variables

var={x1,x2,lamda1,lamda2,lamda3,lamda4}

and a sample of the code for the solve is:

from sage.interfaces.mathematica import mathematica
sys = mathematica(sys)
var=mathematica(var)
sys.Solve(var)

Is it possible to make an exception for specific Mathematica errors so as to get the solution?

Many thanks, Jason :)

2018-02-14 05:12:12 -0500 commented answer Solving system of polynomial inequalities in SageMath 8.1

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

2018-02-13 22:00:47 -0500 received badge  Student (source)
2018-02-12 05:31:46 -0500 commented answer Solving system of polynomial inequalities in SageMath 8.1

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

2018-02-10 10:46:45 -0500 asked a question 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:

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