print - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


print

pretty-printing of expressions

 

Calling Sequence

Parameters

Description

Examples

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[0](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 123 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

printred,rouge,rot

red,rouge,rot

(1)

lprintred,rouge,rot

red, rouge, rot

varray1,2,3:

v

v

(2)

printv

?

(3)

lprintv

v

sin

sin

(4)

printsin

procx::algebraic...end proc

(5)

printsin0

0

(6)

lprintsin

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:

foo0

(7)

foox

(8)

lprintfoox

foo(x)

printfoox

(9)

See Also

alias

interface

lprint

printf

save

sort

writeto