Print large matrices
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
doprint(object1, object2, …
)
doprint
serves for displaying large matrices
on the screen. In fact, doprint(object)
displays
any MuPAD^{®} object like print(object)
. The only
difference is that large matrices contained in the object are printed,
too.
Matrices of type matrix
or
of the more general type Dom::Matrix(R)
with some
coefficient ring R
are not willing to print themselves
on the screen if they are large.
An m×n matrix A
is
printed like a formatted twodimensional array only if m n ≤ printMaxSize,
where the default value of printMaxSize
is 500.
(You can change the printMaxSize
value to any other
integer value m
by calling A::dom::setPrintMaxSize(m)
).
For larger matrices, a warning is issued and some symbolic dummy object without the matrix entries is printed.
This serves to avoid output problems when printing is invoked accidentally (the output for large formatted arrays is very expensive concerning time and memory).
If you do insist on printing large matrices on the screen, the
function doprint
can be used to create a sparse
table like output of the matrix.
Note:
With 
doprint
allows to print arbitrary MuPAD objects.
It behaves like print
for
all objects apart from matrices contained in the object.
For small matrices, it switches off the formatted array like
output and replaces it by a sparse table like output. For large matrices,
it suppresses warnings such as "This matrix is too large
for display. ..."
and prints matrices using the sparse table
like output.
doprint
is sensitive to the environment variables DIGITS
, PRETTYPRINT
,
and TEXTWIDTH
,
and to the output preferences Pref::floatFormat
, Pref::keepOrder
, and Pref::trailingZeroes
.
Small matrices are printed like formatted arrays:
A := matrix(5, 5, [i $ i = 1..30], Diagonal)
Calling doprint
, this matrix is printed in
a different way:
doprint(A)
We create a larger diagonal matrix of dimension 30 ×30:
A := matrix(30, 30, [i $ i = 1..30], Diagonal):
If we had not suppressed the output by the colon terminating the command above, the following warning would have been issued by the output system:
A
Warning: This matrix is too large for display. To see all nonzero entries of a matrix A, use 'A::dom::doprint(A)'. [(Dom::Matrix(Dom::ExpressionField()))::print]
Warning: This matrix is too large for display. If you want to see all nonzero entries of a matrix, say A, then call 'A::dom::doprint(A)'. [(Dom::Matrix(Dom::ExpressionField()))::print]
Warning: This matrix is too large for display. If you want to see all nonzero entries of a matrix, say A, then call 'A::dom::doprint(A)'. [(Dom::Matrix(Dom::ExpressionField()))::print]
Since the matrix is extremely sparse, it does make sense to
print the matrix. Calling doprint
, we obtain a
print output of all nonzero elements:
doprint(A)
delete A:
We compute a numerical QR factorization of a zero matrix of dimension 30×30. Since the command is not terminated by a colon, the output system tries to print the list with the factors Q and R. Both matrices send a warning:
[Q, R] := numeric::factorQR(matrix(30, 30, [])): Q, R
Warning: This matrix is too large for display. To see all nonzero entries of a matrix A, use 'A::dom::doprint(A)'. [(Dom::Matrix(Dom::ExpressionField()))::print]
Warning: This matrix is too large for display. To see all nonzero entries of a matrix A, use 'A::dom::doprint(A)'. [(Dom::Matrix(Dom::ExpressionField()))::print]
Warning: This matrix is too large for display. If you want to see all nonzero entries of a matrix, say A, then call 'A::dom::doprint(A)'. [(Dom::Matrix(Dom::ExpressionField()))::print]
Warning: This matrix is too large for display. If you want to see all nonzero entries of a matrix, say A, then call 'A::dom::doprint(A)'. [(Dom::Matrix(Dom::ExpressionField()))::print]
Warning: This matrix is too large for display. If you want to see all nonzero entries of a matrix, say A, then call 'A::dom::doprint(A)'. [(Dom::Matrix(Dom::ExpressionField()))::print]
Warning: This matrix is too large for display. If you want to see all nonzero entries of a matrix, say A, then call 'A::dom::doprint(A)'. [(Dom::Matrix(Dom::ExpressionField()))::print]
We can enforce a sparse output via doprint
.
The matrix factor Q is
the identity matrix, the matrix factor R is
zero:
doprint([Q, R])
delete Q, R:

Any MuPAD objects 
doprint
returns the void object null()
of
type DOM_NULL
.
DIGITS
 expose
 expr2text
 fprint
 Pref::floatFormat
 Pref::keepOrder
 Pref::trailingZeroes
 PRETTYPRINT
 print
 protocol
 strprint
 TEXTWIDTH
 write