You are on page 1of 6

Page 1 of 6

GNU Octave
From Wikipedia, the free encyclopedia

Octave is a free computer program for GNU Octave


performing numerical computations which is
mostly compatible with MATLAB. It is part
of the GNU Project.

Contents
„ 1 History
„ 2 Technical details
„ 3 Octave, the language
„ 4 Notable features
„ 5 MATLAB compatibility
„ 6 See also
„ 7 External links
„ 7.1 Documentation
„ 7.2 Graphical User Interfaces
„ 7.3 Web Interfaces
„ 7.4 Add-ons
„ 8 References GNU Octave

Developed John
C++
W. Eaton
Written
History by
in
Initial 1988
The project was conceived around 1988. At Platform Cross-platform
release
first it was intended to be a companion to a Available ?
chemical reactor design course. Real Stable 3.0.3 (http://en.wikipedia.org/w/index.php?
in
development was started by John W. Eaton release title=Template:Latest_stable_software_release/GNU_Octave&action=edit) (October 10,
in 1992. The first alpha release dates back to Type Scientific
2008) computing
[+/− (http://en.wikipedia.org/w/index.php?
January 4, 1993 and on February 17, 1994 License GNU General Public License
title=Template:Latest stable software release/GNU Octave&action=edit&preload=Template:LSR/syntax)]
version 1.0 was released. Version 3.0 was Preview 3.0.1 (http://en.wikipedia.org/w/index.php?
released on December 21, 2007. Website http://www.gnu.org/software/octave/
release title=Template:Latest_preview_software_release/GNU_Octave&action=edit) (April 21,

file://C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\CSR2P3NS.htm 12/26/2008
Page 2 of 6

It should be noted that the name has nothing


to do with musical octaves. Octave is named
after a former professor of the principal
author, who was known for his ability to
perform quick back-of-an-envelope
calculations. [1]

Technical details
„ Octave is written in C++ using STL
libraries.
„ Octave uses an interpreter to execute
the Octave language.
„ Octave is extensible using dynamically loadable modules.
„ Octave interpreter works in tandem with gnuplot and Grace 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 C) and supports many
common C standard library constructs, and can be extended to support 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 structures.

Its syntax is very similar to MATLAB, and carefully programming 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 copied and used. The program runs under most
Unix and Unix-like operating systems, as well as Microsoft Windows.

Notable features
Command and variable name completion

file://C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\CSR2P3NS.htm 12/26/2008
Page 3 of 6

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
x.a = 1
octave:3> x.b
x.b =

1 2
3 4

octave:4> x.c
x.c = string

Short-circuit boolean operators

Octave's `&&' and `||' logical operators are evaluated in a short-circuit fashion (like the corresponding operators in the C language), in contrast
to the element-by-element operators `&' and `|'.

Increment and decrement operators

Octave includes the C-like increment and decrement operators `++' and `--' in both their prefix and postfix forms.

Unwind-protect

Octave supports a limited form of exception handling modeled after the unwind-protect form of Lisp. The general form of an unwind_protect
block looks like this:

file://C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\CSR2P3NS.htm 12/26/2008
Page 4 of 6

unwind_protect
body
unwind_protect_cleanup
cleanup
end_unwind_protect

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 argument varargin as the last (or only) argument in the list.

function s = plus (varargin)


if (nargin==0)
s = 0;
else
s = varargin{1} + plus (varargin{2:nargin});
endif
endfunction

Variable-length return lists

A function can be set up to return any number of values by using the special return value varargout. For example:

function varargout = multiassign (data)


for k=1:nargout
varargout{k} = data(:,k);
endfor
endfunction

C++ Integration

It is also possible to execute Octave code directly in a C++ program. For example, here is a code snippet for calling rand([9000,1]):

#include <octave/oct.h>
...
ColumnVector NumRands(2);
NumRands(0) = 9000;
NumRands(1) = 1;
octave_value_list f_arg, f_ret;

file://C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\CSR2P3NS.htm 12/26/2008
Page 5 of 6

f_arg(0) = octave_value(NumRands);
f_ret = feval("rand",f_arg,1);
Matrix unis(f_ret(0).matrix_value());

MATLAB compatibility
Octave has been built with MATLAB compatibility in mind. It therefore shares many features with MATLAB:

1. Matrices as fundamental data type.


2. Built-in support for complex numbers.
3. Powerful built-in math functions and extensive function libraries.
4. Extensibility in the form of user-defined functions.

See also
„ List of numerical analysis software
„ Comparison of numerical analysis software Free software portal

External links
„ Octave.org (http://www.gnu.org/software/octave/) Home Page

Documentation

„ Online documentation (http://www.gnu.org/software/octave/docs.html)


„ Octave wiki (http://wiki.octave.org/) (click twice—page redirects cause some browsers to time out)
„ Octave FAQ Wiki with new plotting commands (http://www.aims.ac.za/wiki/index.php/Octave:Questions)
„ Mailing List Archives on Nabble (http://www.gnu.org/software/octave/archive.html) - Search all Octave mailing lists.
„ Mailing List Archives on Gmane (http://dir.gmane.org/gmane.comp.gnu.octave.general) - Search all Octave mailing lists.

Graphical User Interfaces

„ QtOctave Graphical User Interface (http://qtoctave.wordpress.com/what-is-qtoctave/) - Matlab counterpart. Under heavy Development.
„ Octave Workshop: an Octave IDE (http://www.unige.ch/math/folks/loisel/www.math.mcgill.ca/loisel/octave-workshop/) - Development
stopped in 2006

file://C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\CSR2P3NS.htm 12/26/2008
Page 6 of 6

„ kOctave: Graphical User Interface (http://athlone.ath.cx/~matti/kde/koctave/) - for the KDE Desktop (base for Octave Workshop)
Development stopped in 2003

Web Interfaces

„ Web Interface to Octave (http://hara.mimuw.edu.pl/weboctave) - Computing using GNU Octave in webbrowser


„ Online access to Octave (http://www.online-utility.org/math/math_calculator.jsp) - Allows you to perform simple Octave calculation
online.

Add-ons

„ Octave-forge community development page (http://octave.sourceforge.net/) - Toolboxes for various problems from independent
developers.
„ OctPlot (http://octplot.sourceforge.net/) - High quality 2D graphics.
„ Octave graphics add-on (http://www.grafickenadstavbyoctave.wz.cz/) - 3D visualization system for Octave.
„ Octaviz (http://octaviz.sourceforge.net/) - 3D visualization system for Octave.
„ MPI Toolbox for Octave (MPITB) (http://atc.ugr.es/javier-bin/mpitb) - Parallel Computing for Octave using MPI.

References
1. ^ Eaton, John. "About Octave (http://www.gnu.org/software/octave/about.html)". Retrieved on 2008-10-14.

Retrieved from "http://en.wikipedia.org/wiki/GNU_Octave"


Categories: GNU project | Data analysis software | GNU project software | Numerical programming languages | Free mathematics software |
Free software programmed in C++ | Linux numerical analysis software | Array programming languages | Cross-platform software
Hidden categories: Articles lacking in-text citations | All articles with unsourced statements | Articles with unsourced statements since
November 2008 | Articles with unsourced statements since October 2008

„ This page was last modified on 7 December 2008, at 00:37.


„ All text is available under the terms of the GNU Free Documentation License. (See Copyrights for details.)
Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a U.S. registered 501(c)(3) tax-deductible nonprofit charity.

file://C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\CSR2P3NS.htm 12/26/2008

You might also like