, , , ,

Mathematica

From Camilo's web
Jump to: navigation, search
Mountain View

Mathematica

Mathematica is the software that I use most frequently for my research. Occasionally, when I know that the code will be running for days, I translate it to Python, because they run faster. However, for the most part of my work, Mathematica is just fine.

Running a Mathematica code from the mac terminal

You will need to save the script as an .m file. The command to run the script is

/Applications/Mathematica.app/Contents/MacOS/MathKernel -run "<<name_of_the_script.m" > log_file &

The first part, /Applications/Mathematica.app/Contents/MacOS/MathKernel, is there to tell the terminal that you want to run the program with a Mathematica kernel. Of course, you could also write an alias for this part, so that you don't have to remember such a long command to execute your scripts.

The final part, log_file, is where the output (and also, importantly, the errors) generated by the script are going to be saved.