 print - Maple Help

# Online Help

###### All Products    Maple    MapleSim

print

pretty-printing of expressions Calling Sequence print(e1, e2, ...) print[n](e1, e2, ...) Parameters

 e1, e2, ... - any expressions n - optional override for prettyprint interface variable Description

 • The function print displays the values of the expressions appearing as arguments and returns NULL as the function value. The expressions printed are separated by a comma and a space. Note that print('') prints a blank line. The ditto commands, %, %%, and %%% do not recall the output of the print command, since the return value of the function is NULL.
 • The following user interface variables control the format. See interface for setting user interface variables.
 • The user interface variable prettyprint is checked to determine the format in which the expressions are to be printed. For details, see interface.
 • The user interface variable verboseproc is checked to determine how the body of Maple procedures (that is, the code) is to be displayed. It can be displayed in full, with indentation, or abbreviated to simply ...''. By default user procedures are displayed in full, and Maple library procedures are abbreviated.
 • The user interface variable screenwidth specifies the number of characters that fit on the output device being used. The default value is 79.
 • The user interface variable labelling (or labeling) enables the use of %N variables to reduce the size of the output. These %N labels identify common subexpressions (those appearing more than once) in the output.
 • Calling print[N] instead of print where N is an integer between -2 and 3, temporarily overrides the prettyprint interface variable. For example, print(expr) is equivalent to lprint(expr).
 • The evaluation of arrays, tables, procedures, and operators is different from other objects in that when assigned to a name, they normally print with simply the name. For example, if the name A has been assigned $\left[\begin{array}{ccc}1& 2& 3\end{array}\right]$ then A; displays A. To print the array object in full use print(A); (when prettyprint >= 0) or eval(A);.
 • There is a limited facility for user-defined formatting of functions. For example, if the user assigns

 print/complex := proc(real,imag) real + 'j'*imag end

 then during output of the value complex(2, 3), the print/complex procedure is called with the arguments 2, 3 resulting in the value $2+3j$, which is displayed as $2+3j$. Note that arguments are formatted first, and alias substitutions take place after formatting is completed. Examples

 > $\mathrm{print}\left(\mathrm{red},\mathrm{rouge},\mathrm{rot}\right)$
 ${\mathrm{red}}{,}{\mathrm{rouge}}{,}{\mathrm{rot}}$ (1)
 > $\mathrm{lprint}\left(\mathrm{red},\mathrm{rouge},\mathrm{rot}\right)$
 red, rouge, rot
 > $v≔\mathrm{array}\left(\left[1,2,3\right]\right):$
 > $v$
 ${v}$ (2)
 > $\mathrm{print}\left(v\right)$
 $\left[\begin{array}{ccc}{1}& {2}& {3}\end{array}\right]$ (3)
 > $\mathrm{lprint}\left(v\right)$
 v
 > $\mathrm{sin}$
 ${\mathrm{sin}}$ (4)
 > $\mathrm{print}\left(\mathrm{sin}\right)$
 ${\mathbf{proc}}\left({x}{::}{\mathrm{algebraic}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (5)
 > $\mathrm{print}\left(\mathrm{sin}\left(0\right)\right)$
 ${0}$ (6)
 > $\mathrm{lprint}\left(\mathrm{sin}\right)$
 sin

When called within the output process, the result of print/foo is not prettyprinted automatically. You must explicitly call the corresponding routine for prettyprinting Matrices using print/rtable or print_preprocess.

 > print/foo:=proc(x)  print/rtable(Matrix([[x,0],[0,1]])) end proc:
 > $\mathrm{foo}\left(0\right)$
 ${\mathrm{foo}}{}\left({0}\right)$ (7)
 > $\mathrm{foo}\left(x\right)$
 ${\mathrm{foo}}{}\left({x}\right)$ (8)
 > $\mathrm{lprint}\left(\mathrm{foo}\left(x\right)\right)$
 foo(x)
 > $\mathrm{print}\left(\mathrm{foo}\left(x\right)\right)$
 ${\mathrm{foo}}{}\left({x}\right)$ (9)
 > 

 See Also