Ask Your Question

Make SageMath allow for Error of Mathematica

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

JasonK gravatar image

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

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


and a sample of the code for the solve is:

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

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

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

JasonK gravatar image

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


does the trick and solve returns the solutions.

Hope this helps someone else too.


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


Asked: 2018-04-30 13:45:47 +0200

Seen: 201 times

Last updated: Apr 30 '18