From ScientificComputing
Jump to: navigation, search

Note that in batch mode, Mathematica notebooks can not be used, because the Mathematica kernel expects a plain text file with Mathematica commands. These plain text files are called script file and their name ends with .m (for instance input.m). The output has then to be redirected to an output file. In interactive mode, you type an expression, and the result is immediately displayed on your screen. In batch mode you have ensure that Mathematica writes labels and results to your output file. Therefore you need to assign your expression to a variable and use afterwards the Print[] command.

a = ... [expression] ...
Print["a = "]           -> prints a label
Print[a]                -> prints the value of a

You can also use graphical commands as Plot or Display in the batch mode. This is discussed below, but first it is explained, how to use Mathematica in batch mode, when no graphical commands are involved.