How to install SageMath in Ubuntu Linux?


SageMath is a free and open-source software for mathematical computation. It is built on top of many existing open-source libraries which include NumPy, SciPy, Matplotlib, SymPy, Maxima, etc.

SageMath provides a command-line interface, browser-based notebooks, and tools for embedding formulas in other documents. Its syntax is similar to Python.

In this article, I will discuss how to install and use SageMath on Ubuntu Linux.

Features of SageMath

The key features of SageMath are –

  • Free and opensource
  • Provides a browser-based notebook for review and reuse of previous input and output
  • provides a command-line interface using IPython
  • Supports parallel processing
  • Include libraries for linear algebra, calculus, multivariate statistics, etc
  • Graph theory visualization and analysis tool
  • Supports complex numbers
  • Provides interface to some third-party software including Maple, Mathematica, R, Magma, etc.
  • Offers an automated test suite

How to install SageMath on Ubuntu

SageMath is available in the default Ubuntu repository so you can install it from Ubuntu Software or by using the apt command in your terminal.

Before installing a package make sure the apt package repository is updated –

sudo apt update

Next, use the following command to install SageMath on your system –

sudo apt install sagemath

Press y and then enter if it asks for your confirmation.

You can verify the installation by using –

sage -v

sagemath version

How to use SageMAth on Ubuntu

Once the package installation is completed you can launch SageMath from the Ubuntu activities dashboard. Search SageMath and click on the icon when it appears as you can see in the image below.

launch sagemath

This will open Jupyter Notebook in your default browser.

jupyter notebook sagemath

Here click on New and select SageMath 9.0 as highlighted in the image below.

julia

This will open the notebook in another tab where you can start typing SageMath commands, some examples of using SageMath are given in the image below.

usage of sagemath

If you are a beginner you can find the complete SageMath tutorials here.

How to remove SageMath from Ubuntu

For any reason, if you want to remove SageMath from your system then use the following command in your terminal –

sudo apt remove sagemath

Remove any unused dependencies that are left in your system by using –

sudo apt autoremove

Conclusion

Now we hope you have set up SageMath successfully on your Ubuntu system. If you have a query or feedback then write us in the comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.