Thursday, 19 April 2018

Sage Reference Manual

I first made a reference to SageMath in a previous blogpost on the 4th January 2017. At that time I installed it but, after tinkering with it a little, I forgot about it until recently. However, my interest has been rekindled and I've installed the latest version (8.1) on my laptop running macOS High Sierra 10.13.3. The online reference manual is located here but instead of a single PDF file, there is an assortment of 70+ PDF files. Because I'm travelling overseas shortly and may not always have Internet access, I wanted to download all the PDF files to have on my laptop for reference.

Fortunately, there is an extension for Chrome called Batch File Downloader that lets you download many links from a  website easily. Here is what the interface looks like:


As the name says, the extension created a batch file that allowed me to download all the *.pdf files in the online directory that it was pointed at. The total size of all files is a little over 80 MB with plotting.pdf (44.9 MB) and plot3d.pdf (20.8 MB) being the two largest. Most of the others are around 1 MB in size. 

Since SageMath uses Python, I also installed the Python  programming language on my laptop. However, my focus will be on getting more proficient at using SageMath. It's tedious to find in Python that most of the basic mathematical functions are missing. For example, if in SageMath one inputs factor(25217), then 151 * 167 is received as output. However, in Python the code must be created:

x, y = 25217, int(25217/2)
for i in range(2, y):
     if x % i == 0:
     print(i)

So the adventure begins. In the meantime, I've come across an interesting site created by a mathematics professor called Gregory V. Bard who writes:
The beauty of Sage is that it works through the internet. There is almost never any reason to do a local install of Sage on your laptop or home computer. This is good news, because it saves a lot of headaches and hassles (especially for students), that you would have to suffer if you were using Mathematica, Maple, Matlab, or Magma. The exception is if you have limited or no internet access, such as in rural areas. 
Internet access involves using the SageMathCell Server which as Professor Bard says is a competitor to WolframAlpha and up until recently was called Sage-Aleph. This is the interface:

Professor Bard has written a book called Sage for Undergraduates that is available as a zipped pdf file by clicking on the link. His site is up-to-date but is "preserving the look-and-feel of the World Wide Web as it was, in 1998".

Using SageMath, I'll be able to wean myself off WolframAlpha which, up until now, I've relied on completely for the factorisation of the number corresponding to my diurnal age and, if the factors are supportive, determining how this number can be expressed as a sum of two squares. Now, using SageMathCell or my own notebook, I can determine both.

Code that is created in SageMathCell can be shared via temporary or permanent links and also by a QR code which conveniently encodes the permalink. The permalink can be quite long and ugly because it encodes the entire block of code. Here is QR code that I generated:

If the QR code is scanned with a QR code reader, you will be taken to the SageMathCell Server where the following code should appear:



No comments:

Post a Comment