Section 4.20 Sage
Until we can expand this section, get some ideas from Section 3.17. We will also collect a few items here, to be cleaned-up later.
For online output formats, sometimes the output of a Sage command can be overwhelming, and a bit complicated to parse. Many objects in Sage also have a LaTeX representation, which can be used to create a superior output format (for some purposes). Begin a cell with the “magic”:
Experiment with the following Sage code on the next line
Boom! Very nice. Try replacing
Subsection 4.20.1 Sage Cell Server Design
The ability to execute, and edit, chunks of Sage code is provided by a distinct project, the Sage Cell Server 1 . Simplifying somewhat, the Sage code a reader sees (or has edited!) is shipped out to a running instance of Sage (on a server somewhere) and the code is executed there. The results of that computation are shipped back to the reader for display below the code.
Two implications of this design are
It is not within your power to add additional packages for the supported languages.
You cannot read a (data) file hosted on your project's site.
Fortunately, there are workarounds.
Unfortunately, the ability to read files anywhere on the internet was abused, so this capability had to be restricted to a finite list of servers. These include DropBox 3 and GitHub 4 where you might find it convenient to place files supporting your code. Note that for GitHub, you likely want to use a URL which is a “raw” file such as for the PreTeXt repository README 5 file, written with Markdown.