GNU Octave
Encyclopedia
GNU Octave is a high-level language, primarily intended for numerical computations
. It provides a convenient command-line interface
(CLI) for solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with MATLAB
. It may also be used as a batch-oriented
language.
As part of the GNU Project
, it is free software
under the terms of the GNU General Public License
(GPL).
in 1992. The first alpha release dates back to January 4, 1993 and on February 17, 1994 version 1.0 was released. Version 3.0 was released on December 21, 2007.
The program is named after Octave Levenspiel
, a former professor of the principal author who was known for his ability to perform quick back-of-the-envelope calculation
s.
computer at Pittsburgh supercomputing center to find vulnerability related to guessing social security numbers.
) and supports many common C standard library
functions, and also certain UNIX
system calls and functions. However, it does not support passing arguments by reference.
Octave programs consist of a list of function calls or a script.
The syntax is matrix
-based and provides various functions for matrix operations. It is not object-oriented
, but it does support various data structure
s.
Its syntax is very similar to MATLAB, and careful programming of a script will allow it to run on both Octave and MATLAB.
Because Octave is made available under the GNU General Public License
, it may be freely changed, copied and used. The program runs under most Unix
and Unix-like
operating system
s including Mac OS X
, and Microsoft Windows
.
are evaluated in a short-circuit fashion (like the corresponding operators in the C
language), in contrast to the element-by-element operators '
'
Also augmented assignment
.
modelled after the '
As a general rule, GNU Octave recognizes as termination of a given '
The cleanup part of the block is always executed. In case an exception is raised by the body part, cleanup is executed immediately before propagating the exception outside the block '
GNU Octave also supports another form of exception handling (compatible with the MATLAB language):
This latter form differs from an '
MATLAB compatibility
Octave has been built with MATLAB
compatibility in mind, and shares many features with MATLAB:
There are a few purposeful, albeit minor, differences:
See also
External links
Further reading
Numerical analysis
Numerical analysis is the study of algorithms that use numerical approximation for the problems of mathematical analysis ....
. It provides a convenient command-line interface
Command-line interface
A command-line interface is a mechanism for interacting with a computer operating system or software by typing commands to perform specific tasks...
(CLI) for solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with MATLAB
MATLAB
MATLAB is a numerical computing environment and fourth-generation programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages,...
. It may also be used as a batch-oriented
Batch processing
Batch processing is execution of a series of programs on a computer without manual intervention.Batch jobs are set up so they can be run to completion without manual intervention, so all input data is preselected through scripts or command-line parameters...
language.
As part of the GNU Project
GNU Project
The GNU Project is a free software, mass collaboration project, announced on September 27, 1983, by Richard Stallman at MIT. It initiated GNU operating system development in January, 1984...
, it is free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...
under the terms of the GNU General Public License
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
(GPL).
History
The project was conceived around 1988. At first it was intended to be a companion to a chemical reactor design course. Real development was started by John W. EatonJohn W. Eaton
For other people named John Eaton, see John Eaton .John W. Eaton is the initial and main author of Octave, a system for numerical computations with a language that is mostly compatible with MATLAB, but is free software....
in 1992. The first alpha release dates back to January 4, 1993 and on February 17, 1994 version 1.0 was released. Version 3.0 was released on December 21, 2007.
The program is named after Octave Levenspiel
Octave Levenspiel
Octave Levenspiel is an Emeritus professor of chemical engineering at Oregon State University. His principal interest has been chemical reaction engineering, a branch of chemical engineering studying the application of chemical reaction kinetics and physics to the design of chemical reactors.He...
, a former professor of the principal author who was known for his ability to perform quick back-of-the-envelope calculation
Back-of-the-envelope calculation
A back-of-the-envelope calculation is a rough calculation, typically jotted down on any available scrap of paper such as the actual back of an envelope...
s.
Deployments
In addition to use on desktops for personal scientific computing, Octave is used in academia and industry. For example, Octave was used on a massive parallelParallel computing
Parallel computing is a form of computation in which many calculations are carried out simultaneously, operating on the principle that large problems can often be divided into smaller ones, which are then solved concurrently . There are several different forms of parallel computing: bit-level,...
computer at Pittsburgh supercomputing center to find vulnerability related to guessing social security numbers.
Technical details
- Octave is written in C++C++C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
using the Standard Template LibraryStandard Template LibraryThe Standard Template Library is a C++ software library which later evolved into the C++ Standard Library. It provides four components called algorithms, containers, functors, and iterators. More specifically, the C++ Standard Library is based on the STL published by SGI. Both include some...
(STL). - Octave uses an interpreterInterpreter (computing)In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
to execute the Octave scripting language. - Octave is extensible using dynamically loadable modules.
- Octave interpreter works with gnuplotGnuplot- License :Despite gnuplot's name, it is not part of or related to the GNU system and it is not distributed under the GNU General Public License .However, some GNU packages do use gnuplot....
and GraceGrace (plotting tool)Grace is a free WYSIWYG 2D graph plotting tool, for Unix-like operating systems. The package name stands for "GRaphing, Advanced Computation and Exploration of data." Grace uses the X Window System and Motif for its GUI. It has been ported to VMS, OS/2, and Windows 9*/NT/2000/XP...
software to create plots, graphs, and charts, and to save or print them.
Octave, the language
The Octave language is an interpreted programming language. It is a structured programming language (similar to CC (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
) and supports many common C standard library
C standard library
The C Standard Library is the standard library for the programming language C, as specified in the ANSI C standard.. It was developed at the same time as the C POSIX library, which is basically a superset of it...
functions, and also certain UNIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...
system calls and functions. However, it does not support passing arguments by reference.
Octave programs consist of a list of function calls or a script.
The syntax is matrix
Array programming
In computer science, array programming languages generalize operations on scalars to apply transparently to vectors, matrices, and higher dimensional arrays....
-based and provides various functions for matrix operations. It is not object-oriented
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
, but it does support various data structure
Data structure
In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...
s.
Its syntax is very similar to MATLAB, and careful programming of a script will allow it to run on both Octave and MATLAB.
Because Octave is made available under the GNU General Public License
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
, it may be freely changed, copied and used. The program runs under most Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
and Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
s including Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...
, and Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
.
Command and variable name completion
Typing a TAB character on the command line causes Octave to attempt to complete variable, function, and file names (similar to Bash's tab completion). Octave uses the text before the cursor as the initial portion of the name to complete.Command history
When running interactively, Octave saves the commands typed in an internal buffer so that they can be recalled and edited.Data structures
Octave includes a limited amount of support for organizing data in structures. For instance:
octave:1> x.a = 1; x.b = [1, 2; 3, 4]; x.c = "string";
octave:2> x.a
ans = 1
octave:3> x.b
ans =
1 2
3 4
octave:4> x.c
ans = string
octave:5> x
x =
{
a = 1
b =
1 2
3 4
c = string
}
Short-circuit boolean operators
Octave's '&&
' and '||
' logical operatorsOperator (programming)
Programming languages typically support a set of operators: operations which differ from the language's functions in calling syntax and/or argument passing mode. Common examples that differ by syntax are mathematical arithmetic operations, e.g...
are evaluated in a short-circuit fashion (like the corresponding operators in the C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
language), in contrast to the element-by-element operators '
&
' and '|
'.Increment and decrement operators
Octave includes the C-like increment and decrement operatorsIncrement and decrement operators
Increment and decrement operators are unary operators that add or subtract one from their operand, respectively. They are commonly implemented in imperative programming languages...
'
++
' and '--
' in both their prefix and postfix forms.Also augmented assignment
Augmented assignment
Augmented assignment is the name given to certain operators in certain programming languages...
.
Unwind-protect
Octave supports a limited form of exception handlingException handling
Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution....
modelled after the '
unwind_protect
' of Lisp. The general form of an unwind_protect block looks like this:As a general rule, GNU Octave recognizes as termination of a given '
block
' either the keyword 'end
' (which is compatible with the MATLAB language) or a more specific keyword 'end_block
'. As a consequence, an 'unwind_protect
' block can be terminated either with the keyword 'end_unwind_protect
' as in the example, or with the more portable keyword 'end
'.The cleanup part of the block is always executed. In case an exception is raised by the body part, cleanup is executed immediately before propagating the exception outside the block '
unwind_protect
'.GNU Octave also supports another form of exception handling (compatible with the MATLAB language):
This latter form differs from an '
unwind_protect
' block in two ways. First, exception_handling is only executed when an exception is raised by body. Second, after the execution of exception_handling the exception is not propagated outside the block (unless a 'rethrow( lasterror )
' statement is purposely inserted within the exception_handling code).Variable-length argument lists
Octave has a real mechanism for handling functions that take an unspecified number of arguments without explicit upper limit. To specify a list of zero or more arguments, use the special argumentvarargin
as the last (or only) argument in the list.Variable-length return lists
A function can be set up to return any number of values by using the special return valuevarargout
. For example:C++ integration
It is also possible to execute Octave code directly in a C++ program. For example, here is a code snippet for callingrand([10,1])
:MATLAB compatibility
Octave has been built with MATLAB
MATLAB
MATLAB is a numerical computing environment and fourth-generation programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages,...
compatibility in mind, and shares many features with MATLAB:
- Matrices as fundamental data type.
- Built-in support for complex numbers.
- Powerful built-in math functions and extensive function libraries.
- Extensibility in the form of user-defined functions.
There are a few purposeful, albeit minor, differences:
- Comment lines can be prefixed with the # character as well as the % character
- Various C-based operators ++, --, +=, *=, /= are supported
- Elements can be referenced without creating a new variable, e.g. [1:10](3)
- Strings can be defined with the " character as well as the ' character
See also
- List of numerical analysis software
- Comparison of numerical analysis softwareComparison of numerical analysis softwareThe following tables provide a comparison of numerical analysis software.- General :- Operating system support :The operating systems the software can run on natively .- Language features :Colors indicate features available as...
- List of statistical packages
- List of numerical libraries
External linksComparison of numerical analysis software
The following tables provide a comparison of numerical analysis software.- General :- Operating system support :The operating systems the software can run on natively .- Language features :Colors indicate features available as...
- Octave.org Home Page
Documentation
- Online documentation.
- Octave wiki (Click twice – page redirects cause some browsers to time out).
- Reviewed entry in the Free Software DirectoryFree Software DirectoryThe Free Software Directory is a project of the Free Software Foundation . It catalogs free software that runs under free operating systems - particularly GNU and Linux. The project was formerly co-run by UNESCO....
. - GNU Octave FAQ Wiki with new plotting commands
- Mailing List Archives on Nabble – Search all Octave mailing listsMailing listA mailing list is a collection of names and addresses used by an individual or an organization to send material to multiple recipients. The term is often extended to include the people subscribed to such a list, so the group of subscribers is referred to as "the mailing list", or simply "the...
. - Mailing List Archives on Gmane – Search all Octave mailing lists.
- Italian Octave Community.
Numerical packages and libraries interfacing with GNU Octave
GNU Octave is also powered by third-party tools and libraries, mostly providing general or domain-specific abstractions for scientific computing. Those tools may be categorized according whether their contributions are more oriented toward computational modelling or toward enhancing visual analysis.Numerical tools
- Octave-forge community development page – Free software toolboxes for various problems from independent developers. A Windows installer for both GNU Octave and the toolboxes is also available.
- Mastrave project – Cross-language library (GNU GPLv3+ covered) compatible with GNU Octave and Matlab, to ease environmental modellingScientific modellingScientific modelling is the process of generating abstract, conceptual, graphical and/or mathematical models. Science offers a growing collection of methods, techniques and theory about all kinds of specialized scientific modelling...
with general purpose semantic array programmingArray programmingIn computer science, array programming languages generalize operations on scalars to apply transparently to vectors, matrices, and higher dimensional arrays....
utilities. - Neuroimaging Analysis Kit – Library (MIT LicenseMIT LicenseThe MIT License is a free software license originating at the Massachusetts Institute of Technology . It is a permissive license, meaning that it permits reuse within proprietary software provided all copies of the licensed software include a copy of the MIT License terms...
covered) to process neuroimagingNeuroimagingNeuroimaging includes the use of various techniques to either directly or indirectly image the structure, function/pharmacology of the brain...
data within GNU Octave or Matlab, particularly functional magnetic resonance images. It also offers a Pipeline system to handle multi-stage processing. - Parallel Matlab Toolbox – Matlab language data structures and functions which implement distributed Matlab arrays. It is released under MIT license.
- MPI Toolbox for Octave (MPITB) – Parallel Computing for Octave using MPI.
Plotting tools
- PLPlotPLplotPLplot is a library of functions that are often used to make scientific plots in compiled languages such as C, C++, D, Fortran, Ada, OCaml and Java. PLplot can also be used interactively by interpreted languages such as Octave, Python, Perl and Tcl. The current version was written primarily by...
– A replacement of the traditional gnuplotGnuplot- License :Despite gnuplot's name, it is not part of or related to the GNU system and it is not distributed under the GNU General Public License .However, some GNU packages do use gnuplot....
in GNU Octave, licensed under the GNU LGPL. - OctPlot – High quality 2D graphics (postscript and screen graphics). Released under GNU GPL.
- Octave graphics add-on – 3D visualization system for Octave.
- Octaviz – 3D visualization system for GNU Octave (wrapper that makes VTK classes accessible from within GNU Octave). It also provides high-level functions for 2D visualization. (Note: Their site says, "Unfortunately, Octaviz is no longer in development. The latest release (0.4.7) was quite usable and stable when built against vtk-5.0.")
User interfaces
Current versions of Octave do not come with a graphical user interface (GUI)/integrated development environment (IDE) by default. However, an official graphical interface based on Qt has now been migrated to the main source repository and will likely be released with Octave 4.0. Several 3rd-party graphical front-ends have been developed:Matlab-like IDEs
- GUIOctave (Windows; closed source) Under active development as of 2011.
- Xoctave (Windows, Linux; GPL3) Under active development as of 2011.
- QtOctave Graphical User Interface (Windows, Linux; GPL2) Official development ceased June 2011.
- Kalculus (Linux) Matlab like UI for GNU Octave and YacasYacasYacas is a general-purpose computer algebra system. The name is an acronym for Yet Another Computer Algebra System.Released under the GNU General Public License, Yacas is free software....
written in Qt4Qt (toolkit)Qt is a cross-platform application framework that is widely used for developing application software with a graphical user interface , and also used for developing non-GUI programs such as command-line tools and consoles for servers...
with RubyRuby (programming language)Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...
bindings. Last updated Jun 2008.
Other GUIs
- CantorCantor (software)Cantor is a free software mathematics application for scientific statistics and analysis. It is part of the KDE Software Compilation 4, and was introduced with the 4.4 release as part of the KDE Education Project's kdeedu package.- Features :...
(Linux, Windows; GPL2) A KDE mathematics application, with backends for R, Maxima, Octave, Scilab, Sage, KAlgebra, and Qalculate. Under active development as of 2011. - OctaveNB (Linux, Windows, OS X; GPL2) NetBeans IDE integration for GNU Octave. Last updated Apr 2009.
Web-based user interfaces (WUI)
- Online LaTeX and Octave Editor - Online Octave/Matlab editor with plotting and storage capabilities.
- Online access to Octave – Allows you to perform simple Octave calculations online.
- MathCloud – Share Matlab/Octave scripts and data and do your computations in the cloud.
Further reading
- Hansen, Jesper (June 2011). GNU Octave Beginner's Guide. Packt Publishing.