Generating Unstructured Output
The functions described in "Textual Input and Output Overview"
expressions should be formatted when they are printed, but they do not actually cause anything to be printed.
In the most common way of using Mathematica
you never in fact explicitly have to issue a command to generate output. Usually, Mathematica
automatically prints out the final result that it gets from processing input you gave. Sometimes, however, you may want to get Mathematica
to print out expressions at intermediate stages in its operation. You can do this using the function Print
|Print[expr1,expr2,...]||print the expri, with no spaces in between, but with a newline (line feed) at the end|
prints its arguments, with no spaces in between, but with a newline (line feed) at the end.
simply takes the arguments you give, and prints them out one after the other, with no spaces in between. In many cases, you will need to print output in a more complicated format. You can do this by giving an output form as an argument to Print
This prints the matrix in the form of a table.
Here the output format is specified using StringForm
also allows mixing of text and graphics.
The output generated by Print
is usually given in the standard Mathematica
output format. You can however explicitly specify that some other output format should be used.
This prints output in Mathematica
You should realize that Print
is only one of several mechanisms available in Mathematica
for generating output. Another is the function Message
described in "Messages,"
used for generating named messages. There are also a variety of lower-level functions described in "Streams and Low-Level Input and Output"
which allow you to produce output in various formats both as part of an interactive session, and for files and external programs.
Another command which works exactly like Print
, but only shows the printed output until the final evaluation is finished, is PrintTemporary