Octave Programming Tutorial

(Redirected from Octave Programming)

From the Octave website:

Octave is a high-level language, primarily intended for numerical computations. It provides a convenient command line interface 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.

Octave has extensive tools for solving common numerical linear algebra problems, finding the roots of non-linear equations, integrating ordinary functions, manipulating polynomials, and integrating ordinary differential and differential-algebraic equations. It is easily extensible and customizable via user-defined functions written in Octave's own language, or using dynamically loaded modules written in C++, C, Fortran, or other languages.

The purpose of this collection of tutorials is to get you through most (and eventually all) of the available Octave functionality from a basic level.

A longer and more advanced Wikibook related to Octave Programming is the MATLAB Programming Wikibook. Those familiar with MATLAB that want to jump into Octave should consult MATLAB Programming/Differences between Octave and MATLAB.

Indeed, Octave is often viewed as a system for numerical computations with a language that is mostly compatible with Matlab, but that is available as free software under the GNU GPL, and that can replace it in many circumstances. This is why only one advanced programming Wikibook is being written; but therein the differences between MATLAB and Octave languages are presented.

How can you share your Octave experience ? edit

  • Explain the syntax of a command
  • Compare the different ways of performing each task using Octave.
  • Try to make unique examples based on fake data (i.e. simulated data sets or data sets that can be generated with Octave commands).
  • As with any Wikibook please feel free to make corrections, expand explanations, and make additions where necessary.

Implementation centric perspective edit

Some recommendation:

  • Put the name of functions/commands in the code environment: <code>lm()</code>
  • Put the name of packages in bold : '''stats'''
  • Except for the default packages, put the name of the package in parentheses after each function : <code>optim()</code> ('''optim''')
  • Put examples in the source environment with argument lang="octave" : <syntaxhighlight lang="octave"></syntaxhighlight>
  • Use references to package documentations, academic literature and wikipedia.
  • Use the citations templates to make citations : Template:Cite book, Template:Cite web, Template:Cite journal
  • If you want to add a graph, you should load it on Commons and add the tag {{Created with R}} and, if it is applicable, [[Category:Images with R source code]].

Mathematical View edit

The available tutorials are

Complete beginners should follow the suggested roadmap:

  1. Getting started
  2. Vectors and matrices
  3. Plotting
  4. Text and file output
  5. General mathematical functions
  6. Loops and conditions
  7. Writing functions
  8. Vectorization

Thereafter, you can do the more specialized sections

in any order.

Authors edit

  • Henri Amuasi (updated by Carl Scheffler and Mike Pickles)

See also edit

References edit