Computer Languages A to Z: Octave

by Gary L. Ratliff Sr. (eronstuc)

A Little Unfinished Business

In the last installment, I implied that I would be covering Oberon-2, which like Pascal and Modula-2, was created by Nicklas Wirth. However, on investigation, I learned that Oberon, which he named after one of the moons of Saturn, was essentially a stripped down version of Modula-2. Essentially, it removes any command which he regarded as being able to be dangerous. Later, some simple extensions to allow primitive OOP were added to create Oberon-2.

The XDS package, which was released to the open source community, is able to compile both Modula-2 and Oberon-2 files. If the file ends in "file.mod," then the Modula-2 compiler is used, while if the ending is "file.ob2," then the Oberon-2 compiler is used. The system for Linux comes in two versions. One compiles to ANSI C code, and could then be compiled with a C compiler such as gcc. The other version compiles to native code. Both are obtained from the XDS site. A simple Google search for xds will provide the info. The files would be extracted to the users home directory using the command tar zxf whatever.tar.gz, depending upon if you downloaded the C version or the native version.

So now that we've tidies up our loose ends, let's explore GNU Octave, a high-level language that is primarily intended for numerical computations. It is completely unrelated to Modula-2 or Oberon-2.

Obtaining Octave

Octave is available in the PCLinuxOS repositories. However, I could not get the system to install on my KDE version. The system wants to use Gnuplot, which seems to come with the default install of the Gnome version for producing graphs and plots. To install, use Synaptic and search for octave. Select octave, octave-doc and koctave3 for installing. The system will most likely require you to also install many other libraries with these items. So simply approve of these additions, and click the apply icon.

pic

Here you see the Synaptic screen after we have marked the items octave octave-doc and koctave3 for install. The system will also install many other libraries which will be required to use this system. One thing to note is that you will also need to install the info package, if it is not already installed on your system.

Once installed, the system is launched by entering the command "octave" at a command prompt in a terminal session. Or, you may also click on the Applications menu, select Programming and then select the GNU Octave item displayed.

Most likely, the first order of business would be to learn to use the product. So you would enter the command "doc" to view the documentation, as shown in the next screen:

pic

Once the doc command has been processed, you will see that there is quite a bit to learn, as you will be shown from the following screen:

pic

Just as in APL, the main unit is the matrix. Octave is very much like the commercial Mathlab system. The main difference is that it is free under the terms of the GPL license. As you will see, it is able to perform differential equations and integration of functions, which you may have learned back in the days you were sweating out your Calculus classes.

You have a vast language at your disposal, for which you may design functions and explore the world of advanced mathematical operations.

There is also a 575 page manual for Octave, available online at http://www.octave.org. However, this currently covers version 2.9.12+, while the version installed from the PCLinuxOS repositories is version 3.2.2.

The problem of getting the system to install on the KDE version was resolved by updating the system. Now, there is a graphic interface to the Octave system, called Koctave3. This would install on the Gnome version, but would crash after being opened. Because the KDE version of PCLinuxOS has all the features of KDE, and Koctave 3 is specifically a GUI interface for the KDE desktop, I thought that I would try and see if this worked or crashed on the KDE version. Below is a screen shot of the system using both of the windows provided by the Koctave3 package:

pic

Here, the command doc has been entered into the Graphical interface, and the contents of your files are shown by also selecting the browser window.

pic

In this view, the browser window has been closed and the contents presented after the doc command has been run are shown. To view the item presented in the doc file, just move the cursor down to the item of interest and press the Enter key.

So, if you need to do some high powered math, or perhaps your children need to verify their advanced math course homework, you have a powerful tool.