How to Install Octave on Ubuntu 20.04

Wondering how to install Octave on Ubuntu 20.04 LTS? 

If you are someone with a basic know-how of Computer Science, chances are, you’ve at least heard of a programming language as they are the foundation of nearly all software applications today. 

Programming languages are typically designed to cater to specific fields in mind. For example, Python is seen as a go-to language for Data Scientists, while Javascript is often used for web pages, etc.

Similarly, there are also applications with programming languages made specifically for handling complex mathematical computations. A great example of such software is Octave, an open-source program that was developed by GNU.

Octave provides a syntax similar to Matlab and provides all the tools that are needed for the computation and visualization of mathematical data. With advantages like these, this software becomes a must-have for the mathematical programming enthusiasts out there.

If you wish to install Octave on Ubuntu 20.04 LTS, then you’ve come to the right place. Just follow the steps and you’ll be using it in no time.

With that said, let’s begin!

Method 1: Installing Octave Using apt install Command.

The first method of installing Octave is to use the Command Terminal as you’ll have to run the $apt install command in Ubuntu.

Note that we’ll be using Ubuntu 20.04 LTS in this guide. However, the installing method shouldn’t be any different for other versions of Ubuntu.

To install Octave using the Command Terminal, follow these steps:

  1. Start by opening the Command Terminal on your keyboard. You can achieve this by pressing Ctrl + Alt + T on your keyboard.
  2. Next, type the following command:
$ sudo apt update

This will update the packages and repositories to the latest version available.

  1. Once the repositories are done updating, type the following in the Terminal:
$ sudo apt install octave

This will begin to install Octave on your system.

When the steps are followed correctly, you should now have GNU Octave installed on your system. If this method doesn’t work out for you, don’t worry. There’s an alternative method available.

Method 2: Installing Octave Using Flatpak Repository.

Alternatively, you can try using the Flatpak repository, which are helpful in installing the available packages for Linux in a fast and efficient manner.

Follow these steps to install Octave using the Flatpak repository:

  1. First, open the Command Terminal. You can achieve this by typing Ctrl + Alt + T on your keyboard.
  2. Next, type the following in the Terminal:
$ sudo apt update 
  1. Once that’s done, check if Flatpak is installed on your system by typing the following:
$ flatpak --version

If you don’t encounter any error when executing this command, flatpak is installed on your system and you can skip step 4.

  1. In case flatpak isn’t installed on your system, then type the following in the Command Terminal:
$ sudo apt install flatpak

This should install flatpak on your system. If you type the command in Step 3, you should see an output similar to the one in the image below.

  1. Next, restart your computer by typing the following via the Terminal:
$ sudo reboot
  1. Once the system restarts, open the Command Terminal and type the following:
$ flatpak install flathub org.octave.Octave

If you followed the steps correctly then congratulations! You have learned how to install Octave on Ubuntu 20.04 LTS. The next part of this guide will cover some basic startup tips for Octave.

Getting Started With Octave.

Now that you’ve successfully installed Octave on your system, it’s time to give it a go.

To launch Octave using the Command Terminal, type the following:

$ octave-cli

Alternatively, you can launch the Graphical User Interface version of Octave as well. You can do this by typing ‘Octave‘ in the search bar of your Ubuntu desktop.

When you launch Octave for the first time, you’ll be prompted with a welcome screen. 

Click on Next and proceed through the questions as per your preferences. Click Finish once you’re done.

You should see a window similar to the one in the image below.

If you’re someone who has experience using Matlab, you shouldn’t have any trouble navigating through the interface. If not, then we’ve prepared an example to help you get started.

In the Octave command window, type the following command:

$ x = 0:0.1:5;

This will define a row vector having values from 0 to 5 with increments of 0.1

Now, type the following command:

$ plot(x, sin(x));

The output should give a sine wave plot similar to the image below.

If you’d like to learn about the different commands that are available with Octave, you can check out their official manual

Uninstalling Octave.

In case you don’t need Octave anymore or are switching to another application, you can uninstall Octave to save up resources on your system.

Follow these steps to uninstall Octave.

  1. Start by opening the Command Terminal.
  2. Next, type the following command:
$ sudo apt-get remove octave

If you wish to remove the flatpak version, type the following:

$ flatpak uninstall org.octave.Octave

With this, Octave should be removed from your system.

While working with Octave, it is recommended to use scripts as they allow you to use certain commands in a sequence. They can also be saved, shared, and edited according to your need.

Although Octave provides its own script editor, using a text editor is also a good option. For this purpose, we’d recommend Emacs text editor. Besides being a text editor, Emacs is a perfect coding environment, so we suggest you give it a try.

This concludes our guide on how to install Octave on Ubuntu 20.04 LTS. If you have any questions or suggestions, let us know in the comment section down below.

If this guide helped you, please share it. 🙂

Author

Leave a Reply

Your email address will not be published. Required fields are marked *