Ask Your Question
2

Make SageMath allow for Error of Mathematica

asked 2018-04-30 13:45:47 +0100

JasonK gravatar image

updated 2018-04-30 13:55:48 +0100

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-04-30 15:38:34 +0100

JasonK gravatar image

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

edit flag offensive delete link more

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-04-30 13:45:47 +0100

Seen: 327 times

Last updated: Apr 30 '18