Install GNU Octave in Ubuntu 22.04

In this article, we would discuss how to install GNU Octave in Ubuntu 22.04 release.

GNU Octave is a high-level programming language. It is mainly used to solve linear and non-linear problems. It was first released on January 04, 1993. And, at the time of writing, v6.4.0 is its latest stable release.

We have the flexibility of using either a Graphical User Interface (GUI) or Command-line Interface (CLI).

Note: Following operations would require you to have superuser privileges. In case you don’t have one then, we advise you to contact your System Administrator for assistance.

Install GNU Octave in Ubuntu 22.04

Since the package is available through standard Ubuntu repository. Therefore, we will first update the repository. This will help us get the latest version of the package. Hence, open a terminal and issue the following –

sudo apt update

Next, to install GNU Octave –

sudo apt install octave

Now, we can launch the application from our Systems’ main menu. Or, it can be launched through terminal –

octave-cli

In conclusion, we have discussed how to install GNU Octave in Ubuntu 22.04 release.

Additional Info –

In this section, we would see how we can use GNU Octave using a simple example. We are basically adding two matrices.

So, lets say we have A and B matrices.

Values for A – [1,2 ; 3,4]
Values for B – [5,6 ; 7,8]

Launch GNU Octave –

And, in the interface issue the following –

>> A=[1,2;3,4]

and Enter. It would display the output –

A =

    1   2
    3   4

Similarly,

>> B=[5,6;7,8]

It would display the output –

B =

    5    6
    7    8

And, do

>> A+B

We get the following output –

ans =

    6    8
    10   12