How to install Octave 5 on Ubuntu 18.04?

On this old question How to install Octave 4.0.0 in Ubuntu 14.04 they say to use this:

sudo add-apt-repository ppa:octave/stable
sudo apt-get update
sudo apt-get install octave

But when I run this command on Ubuntu 18.04:

$ sudo add-apt-repository ppa:octave/stable
[sudo] password for linux:         
HTTP Error 404: Not Found
Cannot add PPA: ''This PPA does not support bionic''.

The latest updated release from PPA is Xenial (16.04), this explain why you get Cannot add PPA: ''This PPA does not support bionic''. error.

GNU has distributed Octave as Flatpak package, and they do offer version 5—precisely 5.1.0 → https://flathub.org/apps/details/org.octave.Octave

Install flatpak, then add flathub repository.

sudo apt-get install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

You can proceed to install Octave now.

flatpak install flathub org.octave.Octave
flatpak run org.octave.Octave

Use Ubuntu Software Center(or the Snap store), the latest version is available, officially from GNU Octave.

sudo snap install octave

Here's a link if you need specs https://snapcraft.io/octave

Also, don't use apt, as it contains a 4.x version, and the GUI is ancient.

@Liso I'd prefer avoiding flatpak as it takes a huge amount of space, even for trivial stuff.