Hi guys! Thank you for posting about the way of calling Mathematica from Python. However, I am very new in building interprogram communication codes.
May I request for a more detailed explanation on how to make it happen? My platform is Windows XP.
First of all, in what kind of format should I save the codes? *.m or *.py?
2) Is this line applicable to Windows platform as well?
Or shall I change it to where my python is installed?
#!/C:/Python27/python.exe
3) What do these two lines exactly mean? Does it mean that I should write my Mathematica codes here?
e.g. value =
ToExpression[ $ScriptCommandLine[[2]]
]; Print[value
];
example from: http://mathematica.stackexchange.com/questions/4643/how-to-use-mathematica-functions-in-python-programs
# Create temporary file and write your Mathematica code to it
do_stuff()
4) Does the
'math' here mean
MathKernel in Windows? Should I then write it in this way:
'C:\Program Files\Wolfram Research\Mathematica\9.0\MathKernel.exe'? What are, then,
'-script' and
the_file mean? What should I replace them with?
call(['math', '-script', the_file])
Sorry, I know that I am as if asking too much, but I just don't know where I should be starting from in order to call Mathematica in Python.. The reason I need to know this badly is to utilize the more powerful Mathematica solvers in solving a large nonlinear system of equations which takes input from a third-party Python module called CoolProp. Could someone please assist me? Thank you in advance!
P/s: Merry Christmas and Happy New Year 2014!