A working (or studying) mathematician's guide to getting your hands on SageMath
Here is a description of various possibilities to get access to SageMath. There are two main ways of using this software:
Below we explain how to get access to either of these formats. Once this is accomplished, you can read e.g. here for a quick introduction to some of the functions available in SageMath (described for using it in a Terminal) or see e.g. this guide on how to use the Jupyter notebook.
- in a Terminal (or console), executing one command after the other. Once you start SageMath (often by typing "sage" + Enter in a command prompt), you can type "1+2" + Enter, to do your first computation.
- in a Jupyter notebook (a file ending on .ipynb), where you can have cells with different bits of code together with nicely formatted text, pictures etc. When creating a new notebook you should select a SageMath kernel. Then you can type "1+2" in the first cell and press Shift+Enter to see the result.
If you have an internet connection and want to perform a short computation, you can go to the website of SageMathCell. Enter the lines of code you want to run and click a button to see the result. Or you just try it out directly below!
For longer computations and projects, you can got to the website of Cocalc and create a free account. Then you can create a new project, and add either a Terminal or a Jupyter notebook as a new file (or upload an existing notebook). Use them as explained above.
Local SageMath installation
The most convenient way to work with SageMath is to install it on your computer. You can have a look at the official installation guide. Here is the short version for the most important operating systems:
If you still have some older version of SageMath installed on your computer, note that starting with Version 9.0 it switched from Python 2 to Python 3 so some older code might no longer work as expected.
- Linux If you are using Linux, you are probably used to multiple-step guides involving use of a console, so you should just follow the section of the installation guide above. Or maybe you are working on a university computer, where SageMath is already installed. In either case, open a terminal and type
sage to run SageMath in a console, or
sage -n jupyter to work with a Jupyter notebook in your browser.
- Windows Go to the GitHub release page of SageMath for Windows to download the latest SageMath-XX-Installer-YY.exe and run it. This should install SageMath on your computer, and you can run the program "SageMath X.Y" to use it in a console, or run "SageMath X.Y Notebook" to access a Jupyter notebook.
- MacOS Installing SageMath here can be slightly tricky, but many people had good experiences with this inofficial guide for installation and usage of SageMath.
For students of my course
SageMath will (hopefully) be installed on the computers of the Mathematical Institute once the semester starts. Thus you can log onto them (or use ThinLinc on your own computer) and open the program Terminal. Then you can type
sage-9.4 to start SageMath in the terminal, or use
sage-9.4 -n jupyter --browser=google-chrome to open a Jupyter notebook. We will mostly use the second option in our course. You should then navigate with the Jupyter notebook to the place where you saved the files for the lecture (like "01 Introduction.ipynb") and open them with a click.
Note that in the process above you will be asked for your password approximately \(N\) times (for \(N \to \infty\)) and probably you will always use your standard password for logging into the computers of the Mathematical Institute.
LaTeX formulas on this site powered by MathJax
Back to Johannes Schmitt's homepage