Starting up with SageMath

Working with CoCalc.

CoCalc is the easiest way to start working with SageMath. (Though, if you are feeling more adventurous, you could also install Sage on your computer following directions here. Once you get it running, you should be able to start a jupyter notebook just as with CoCalc.)

Steps to get going with CoCalc:

Please let me know if any of these steps are incorrect or if the descriptions could use improvement.
  1. You need to be using an up-to-date browser. Google Chrome, Safari and Firefox should work. Recent versions of Firefox will work, but if Firefox is at version 62 or earlier, there might be issues. (As of this moment, Firefox is up to version 65.)
  2. Create an account on https://cocalc.com/. You just need your name, email address and a password.
  3. You should now be brought to a page where you can create a new project (which is like a folder on the server for storing your work with SAGE). You may need to click the "Projects" button in the top left corner of the browser window. Click "Create New Project" and enter a title such as "Dynamics Class". Click "Create Project". You will be brought to the Project page.
  4. It should create your project and start it, which might take a few moments. Then click the title of your project to enter it.
  5. Let's create a SageMath notebook and do some simple work in it. Click the button "Create or Upload Files...". Enter a name for the file e.g., "first_notebook" then click "Jupyter notebook". CoCalc should open a notebook tab for you.
  6. Observe that in the top right corner of the notebook, it says SageMath (stable). This seems to be the default. (You can also write notebooks that work in other languages e.g., Python and a number of other languages. The choices can be seen by clicking on the "Kernel" menu item.)
  7. Playing around with this first notebook:
    • There should be a line which reads In [ ]: and a text box after it. Click on the text box and type 2+3. Then hold down Shift and press enter. A line reading Out[1]: 5 should appear.
    • We'll now create the function $f(x)=x^2$. Enter f(x) = x^2 in the next textbox (after In [ ]: ). Then hold down Shift and press enter. The In [ ]: should change to In [2]: to let you know the command was run, but there is no output this time since we were just defining a function.
    • In the next textbox type f(2) and press Shift+Enter. You should see something like Out[3]: 4.
    • Now type plot(f,0,1). You should see a graph appear:
      plot of x goes to x^2
      To find out more about the plot function, you can type plot? and hit Shift+Enter.
  8. If you feel motivated to play around more with the basics of Sage, take A Guided Tour. The following topics seem especially useful for this course:
  9. To do something related to the course, you can visit the Orbits and Rotations notebook I created. You can not edit or manipulate this page. But, you can copy the notebook to your project and then manipulate it. Click the link "Open in CoCalc" in the upper right hand corner. It give you another view of the document which you also can not edit. Now click on "Files" near the top left of the page. You should see a list of files including "Orbits_and_rotations.ipynb". To the left of the name there is a button which reads "Copy". Then select the project (e.g. "Dynamics Class") you would want to copy to from the first drop down list, and click "Copy 1 item". Then you can switch to this project by clicking "Projects" in the top left, then clicking your project name. Now you should see a file named "Orbits_and_rotations.ipynb". Clicking this file name opens up the Jupyter notebook. Now you can edit the notebook and use Shift+Enter to run commands. Feel free to mess around. If you mess things up, you can always get a new copy of the file.
Course webpage | Course Information for SageMath
Last modified on April 13, 2022.
[check html] [check css]