0
$\begingroup$

I would like to use the NSolve function from Mathematica in a Python code to solve a polynomial system of equations. So my question is, whether there is an option to call this kind of function in a python code.

$\endgroup$
3
  • 1
    $\begingroup$ You have not clearly explained your work flow. What will you do with the solution in Python? Since the solution is in Mathematica syntax (even it is converted to string), which will be of no use in Python. Why can't you just use sympy in Python, that will be much easier. But it is always possible to run a mathematica script from python to solve the equations. But the question is, what will you do with the solution in Python, since you can't just use it due to different syntax. See What's the best way to call Mathematica from Python? $\endgroup$
    – Nasser
    Commented Jun 8, 2022 at 21:53
  • 1
    $\begingroup$ But if you have python code and need the translation done automatically for you, I suggest you use sagemath. Which is all python and runs python code. Then you can use its sagemath<-->Mathematica interface. This will do the translation automatically. See interfaces/mathematica ps. I have not used this interface myself, but they have lots of examples above. My guess it works better on Linux than windows. $\endgroup$
    – Nasser
    Commented Jun 8, 2022 at 21:59
  • 1
    $\begingroup$ See also how-to-use-mathematica-functions-in-python-programs for examples calling mathematica scripts from Python and example using the Python MathLink and other options. $\endgroup$
    – Nasser
    Commented Jun 8, 2022 at 22:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.