Ask Your Question

Revision history [back]

As said by the documentation (type show?), show is an alias for pretty_print which choses the "best" output supported by the user interface, and while view computes a LaTeX representation of the object (and possibly compiles the result from mathjax in the notebook or LaTeX from the command line), hence it is more specific.

For your matrix, you can see a difference if you use Sage command line:

sage: show(A);
\newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr}
0 & 1 & 0 \\
0 & 1 & 0 \\
2 & \frac{1}{2} & 0
\end{array}\right)

sage: view(A)
# this will open a pdf viewer with the matrix inside a pdf, created by LaTeX.

You can also see a difference as follows:

sage: G = graphs.PetersenGraph()
sage: show(G)
# Launch png viewer, not created by LaTeX
sage: view(G)
# show a graph drawn by LaTeX inside a pdf viewer

As said by the their respective documentation (type show? and view?), show is an alias for pretty_print which choses the "best" output supported by the user interface, and while view computes a LaTeX representation of the object (and possibly compiles the result from mathjax in the notebook or LaTeX from the command line), hence it is more specific.

For your matrix, you can see a difference if you use Sage command line:

sage: show(A);
\newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr}
0 & 1 & 0 \\
0 & 1 & 0 \\
2 & \frac{1}{2} & 0
\end{array}\right)

sage: view(A)
# this will open a pdf viewer with the matrix inside a pdf, created by LaTeX.

You can also see a difference as follows:

sage: G = graphs.PetersenGraph()
sage: show(G)
# Launch png viewer, not created by LaTeX
sage: view(G)
# show a graph drawn by LaTeX inside a pdf viewer