Ask Your Question
2

What is the difference between show() and view() in sage?

asked 2016-12-18 17:56:30 +0200

daviddgl gravatar image

updated 2016-12-18 17:59:12 +0200

What is the difference between show() and view() in sage?

A=matrix([v1,v2,v3]);show(A); view(A)

looks like the same... is there any difference between these two?

For the screen shot click here.

image description

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2016-12-18 18:46:44 +0200

tmonteil gravatar image

updated 2016-12-18 18:47:41 +0200

As said by 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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-18 17:56:30 +0200

Seen: 3,360 times

Last updated: Dec 18 '16