Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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. Is it possible to make an exception for specific Mathematica errors so as to get the solution?

Many thanks, Jason :)

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 :)