Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > a3a677d80d3c0f62bd8cfbb738fb1e85 > files > 38

octave-doc-3.2.4-1mdv2010.1.x86_64.rpm

<html lang="en">
<head>
<title>Frequently asked questions about Octave (with answers)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Frequently asked questions about Octave (with answers)">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="top" href="#Top">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<h1 class="settitle">Frequently asked questions about Octave (with answers)</h1>
<div class="node">
<a name="Top"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#What-is-Octave_003f">What is Octave?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>

</div>

<h2 class="unnumbered">Frequently asked questions about Octave (with answers)</h2>

<h2 class="unnumbered">Preface</h2>

<p><a name="index-FAQ-for-Octave_002c-latest-version-1"></a>
This is a list of frequently asked questions (FAQ) for Octave users.

   <p>We are always looking for new questions (<em>with</em> answers), better
answers, or both.  Please send suggestions to <a href="mailto:bug@octave.org">bug@octave.org</a>. 
If you have general questions about Octave, or need help for something
that is not covered by the Octave manual or the FAQ, please use the
<a href="mailto:help@octave.org">help@octave.org</a> mailing list.

   <p>This FAQ is intended to supplement, not replace, the Octave manual. 
Before posting a question to the <a href="mailto:help@octave.org">help@octave.org</a> mailing list,
you should first check to see if the topic is covered in the manual.

<ul class="menu">
<li><a accesskey="1" href="#What-is-Octave_003f">What is Octave?</a>
<li><a accesskey="2" href="#Licensing-Issues">Licensing Issues</a>
<li><a accesskey="3" href="#How-can-I-cite-Octave_003f">How can I cite Octave?</a>
<li><a accesskey="4" href="#Series-3_002e0_002eN">Series 3.0.N</a>
<li><a accesskey="5" href="#Octave-Features">Octave Features</a>
<li><a accesskey="6" href="#Learning-more-about-Octave">Learning more about Octave</a>
<li><a accesskey="7" href="#Getting-Octave">Getting Octave</a>
<li><a accesskey="8" href="#Installation">Installation</a>
<li><a accesskey="9" href="#Common-problems">Common problems</a>
<li><a href="#How-do-I-_002e_002e_002e_003f">How do I ...?</a>
<li><a href="#MATLAB-compatibility">MATLAB compatibility</a>
<li><a href="#Index">Index</a>
</ul>

<div class="node">
<a name="What-is-Octave%3f"></a>
<a name="What-is-Octave_003f"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Licensing-Issues">Licensing Issues</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Top">Top</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">1 What is Octave?</h2>

<p>Octave is a high-level interactive language, primarily intended for
numerical computations that is mostly compatible with
<span class="sc">Matlab</span>.<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>

   <p>Octave can do arithmetic for real, complex or integer-valued scalars
and matrices, solve sets of nonlinear algebraic equations, integrate
functions over finite and infinite intervals, and integrate systems of
ordinary differential and differential-algebraic equations.

   <p>Octave uses the GNU readline library to handle reading and editing
input.  By default, the line editing commands are similar to the
cursor movement commands used by GNU Emacs, and a vi-style line
editing interface is also available.  At the end of each session, the
command history is saved, so that commands entered during previous
sessions are not lost.

   <p>The Octave distribution includes a 590+ page Texinfo manual.  Access
to the complete text of the manual is available via the help command
<!-- really, the *complete* text? -->
at the Octave prompt.

<ul class="menu">
<li><a accesskey="1" href="#Who-develops-Octave_003f">Who develops Octave?</a>
<li><a accesskey="2" href="#Why-GNU-Octave_003f">Why GNU Octave?</a>
<li><a accesskey="3" href="#What-version-should-I-use_003f">What version should I use?</a>
<li><a accesskey="4" href="#On-what-platforms-does-Octave-run_003f">On what platforms does Octave run?</a>
</ul>

<div class="node">
<a name="Who-develops-Octave%3f"></a>
<a name="Who-develops-Octave_003f"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Why-GNU-Octave_003f">Why GNU Octave?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#What-is-Octave_003f">What is Octave?</a>

</div>

<h3 class="section">1.1 Who develops Octave?</h3>

<p>Discussions about writing the software that would eventually become
Octave started in about 1988 with James B. Rawlings and John W. Eaton at
the University of Texas.  John W. Eaton was the original author of
Octave, starting full-time development in February 1992.  He is still
the primary maintainer.  The community
of users/developers has in addition contributed some code and fuels the
discussion on the mailing lists <a href="mailto:help@octave.org">help@octave.org</a> (user forum),
<a href="mailto:bug@octave.org">bug@octave.org</a> (bug reports), <a href="mailto:maintainers@octave.org">maintainers@octave.org</a>
(development issues), and <a href="mailto:octave-dev@lists.sourceforge.net">octave-dev@lists.sourceforge.net</a> (all
things related to the Octave Forge repository of user-contributed
functions).

<div class="node">
<a name="Why-GNU-Octave%3f"></a>
<a name="Why-GNU-Octave_003f"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#What-version-should-I-use_003f">What version should I use?</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Who-develops-Octave_003f">Who develops Octave?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#What-is-Octave_003f">What is Octave?</a>

</div>

<h3 class="section">1.2 Why GNU Octave?</h3>

<p>The GNU Project was launched in 1984 to develop a complete Unix-like
operating system which is free software: the GNU system.

   <p>GNU is a recursive acronym for &ldquo;GNU's Not Unix&rdquo;; it is pronounced
guh-noo, approximately like canoe.

   <p>The Free Software Foundation (FSF) is the principal organizational
sponsor of the GNU Project.

   <p>Octave became GNU Octave in 1997 (beginning with version 2.0.6).  This
meant agreeing to consider Octave a part of the GNU Project and support
the efforts of the FSF.  However, Octave is not and has never been
developed by the FSF.

   <p>For more information about the GNU project, see <a href="www.gnu.org">www.gnu.org</a>.

   <p><a name="index-FSF-_005bFree-Software-Foundation_005d-2"></a><a name="index-GNU-_005bGNU_0027s-not-unix_005d-3"></a>
<div class="node">
<a name="What-version-should-I-use%3f"></a>
<a name="What-version-should-I-use_003f"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#On-what-platforms-does-Octave-run_003f">On what platforms does Octave run?</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Why-GNU-Octave_003f">Why GNU Octave?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#What-is-Octave_003f">What is Octave?</a>

</div>

<h3 class="section">1.3 What version should I use?</h3>

<p>In general, you will find the latest version on
<a href="http://www.octave.org/download.html">http://www.octave.org/download.html</a>.  It is
recommended to use the &ldquo;testing&rdquo; version of octave for general use,
and the &ldquo;development&rdquo; version if you want the latest features.

   <p>A list of user-visible changes since the last release is available in
the file <samp><span class="file">NEWS</span></samp>.  The file <samp><span class="file">ChangeLog</span></samp> in the source
distribution contains a more detailed record of changes made since the
last release.

<div class="node">
<a name="On-what-platforms-does-Octave-run%3f"></a>
<a name="On-what-platforms-does-Octave-run_003f"></a>
<p><hr>
Previous:&nbsp;<a rel="previous" accesskey="p" href="#What-version-should-I-use_003f">What version should I use?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#What-is-Octave_003f">What is Octave?</a>

</div>

<h3 class="section">1.4 On what platforms does Octave run?</h3>

<p>Octave runs on various Unices&mdash;at least Linux and Solaris, Mac OS X,
Windows and anything you can compile it on.  Binary distributions exist
at least for Debian, Suse, Fedora and RedHat Linuxes (Intel and AMD
CPUs, at least), for Mac Os X and Windows' 98, 2000 and XP.

   <p>Two and three dimensional plotting is fully supported using gnuplot.

   <p>The underlying numerical solvers are currently standard Fortran ones
like Lapack, Linpack, Odepack, the Blas, etc., packaged in a library
of C++ classes.  If possible, the Fortran subroutines are compiled
with the system's Fortran compiler, and called directly from the C++
functions.  If that's not possible, you can still compile Octave if
you have the free Fortran to C translator f2c.

   <p>Octave is also free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation.

<div class="node">
<a name="Licensing-Issues"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#How-can-I-cite-Octave_003f">How can I cite Octave?</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#What-is-Octave_003f">What is Octave?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">2 Licensing Issues</h2>

<ul class="menu">
<li><a accesskey="1" href="#GPL">If I write code using Octave do I have to release it under the GPL?</a>: <li><a accesskey="2" href="#Licensing-MEX-Files">Since the MEX interface allows plugins to be distributed under terms that are incompatible with the GPL, does this mean that you are encouraging people to to write non-free software for Octave?</a>: <li><a accesskey="3" href="#Requesting-License-Changes">I wrote a program that links with Octave libraries and I don't want to release it under the terms of the GPL.  Will you change the license of the Octave libraries for me?</a>: </ul>

<div class="node">
<a name="GPL"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Licensing-MEX-Files">Licensing MEX Files</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Licensing-Issues">Licensing Issues</a>

</div>

<h3 class="section">2.1 If I write code using Octave do I have to release it under the GPL?</h3>

<p>The answer depends on precisely how the code is written and how it works.

   <p>Code written entirely in the scripting language of Octave
(interpreted code in .m files) may be released under the terms of
whatever license you choose.

   <p>Code written using Octave's native plug-in interface (also known
as a .oct file) necessarily links with Octave internals and is
considered a derivative work of Octave and therefore must be
released under terms that are compatible with the GPL.

   <p>Code written using Octave's implementation of the Matlab MEX
interface may be released under the terms of whatever license you
choose, provided that the following conditions are met:

     <ol type=1 start=1>
<li>The plugin should not use any bindings that are specific to Octave.  In
other words, the MEX file must use the MEX interface only, and not also
call on other Octave internals.  It should be possible in principle to
use the MEX file with other programs that implement the MEX interface
(e.g., Matlab).

     <li>The MEX file should not be distributed together with Octave in such a
way that they effectively create a single work.  For example, you should
not distribute the MEX file and Octave together in a single package such
that Octave automatically loads and runs the MEX file when it starts up. 
There are other possible ways that you might effectively create a single
work; this is just one example.
        </ol>

   <p>A program that embeds the Octave interpreter (e.g., by calling the
"octave_main" function), or that calls functions from Octave's
libraries (e.g., liboctinterp, liboctave, or libcruft) is
considered a derivative work of Octave and therefore must be
released under terms that are compatible with the GPL.

<div class="node">
<a name="Licensing-MEX-Files"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Requesting-License-Changes">Requesting License Changes</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#GPL">GPL</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Licensing-Issues">Licensing Issues</a>

</div>

<h3 class="section">2.2 Since the MEX interface allows plugins to be distributed under terms that are incompatible with the GPL, does this mean that you are encouraging people to to write non-free software for Octave?</h3>

<p>No.  The original reason for implementing the MEX interface for Octave
was to allow Octave to run free software that uses MEX files (the
particular goal was to run SundialsTB in Octave).  The intent was to
liberate that software from Matlab and increase the amount of free
software available to Octave users, not to enable people to write
proprietary code for Octave.  For the good of the community, we strongly
encourage users of Octave to release the code they write for Octave
under terms that are compatible with the GPL.

<div class="node">
<a name="Requesting-License-Changes"></a>
<p><hr>
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Licensing-MEX-Files">Licensing MEX Files</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Licensing-Issues">Licensing Issues</a>

</div>

<h3 class="section">2.3 I wrote a program that links with Octave libraries and I don't want to release it under the terms of the GPL.  Will you change the license of the Octave libraries for me?</h3>

<p>No.  Instead of asking us to change the licensing terms for Octave, we
recommend that you release your program under terms that are compatible
with the GPL so that the free software community can benefit from your
work the same as you have benefitted from the work of all the people who
have contributed to Octave.

<div class="node">
<a name="How-can-I-cite-Octave%3f"></a>
<a name="How-can-I-cite-Octave_003f"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Series-3_002e0_002eN">Series 3.0.N</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Licensing-Issues">Licensing Issues</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">3 How can I cite Octave?</h2>

<p>Pointing to <a href="http://www.octave.org">http://www.octave.org</a> is good, because that gives
people a direct way to find out more.  If citation of a URL is not
allowed by a publisher, or if you also want to point to a traditional
reference, then you can cite the Octave manual:

<pre class="example">     @BOOK{eaton:2008,
       author =     "John W. Eaton and David Bateman and Søren Hauberg",
       title =      "GNU Octave Manual Version 3",
       publisher =  "Network Theory Limited",
       year =       "2008",
       isbn =       "0-9546120-6-X"
     }
</pre>
   <div class="node">
<a name="Series-3.0.N"></a>
<a name="Series-3_002e0_002eN"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Octave-Features">Octave Features</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#How-can-I-cite-Octave_003f">How can I cite Octave?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">4 What's new in version series 3.0.N and 3.1.N of Octave</h2>

<p>The 3.0.N series has enough new features to justify a major version
number change. The 3.0.N series brings

     <ul>
<li>integer types

     <li>fixed point arithmetic

     <li>sparse matrices

     <li>Linear programming code based on GLPK

     <li>64-bit compilation support

     <li>gzipped files and stream and consequently support of matlab v7 files

     <li>better support for both msvc and mingw

     <li>a fully compatible MEX interface

     <li>many many other minor features and compatibility changes

   </ul>

   <p>Here are some features that have been around since 2.1.N

     <ul>
<li>NDarrays

     <li>cells

   </ul>

   <p>The 3.1.N series is the current development release and will become a
3.2.N release in the future. This series brings the new features

     <ul>
<li>OpenGL backend

     <p>An experimental OpenGL graphics backend to replace the gnuplot

     <li>Object Orient Programming

     <li>Block comments

     <li>imwrite and imread

     <p>The functions are based on the GraphicsMagick library.

     <li>Lazy transpose

     <p>Special treatment in the parser of things like "a' * b", where the
transpose is never explicitly formed but a flag is rather passed to the
underlying LAPACK code.

     <li>Single precision type

     <li>Improved array indexing
The underlying code used for indexing of arrays has been completely
rewritten and so the indexing of arrays is now significantly faster. 
</ul>

<div class="node">
<a name="Octave-Features"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Learning-more-about-Octave">Learning more about Octave</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Series-3_002e0_002eN">Series 3.0.N</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">5 What features are unique to Octave?</h2>

<ul class="menu">
<li><a accesskey="1" href="#Functions-defined-on-the-command_002dline">Functions defined on the command-line</a>
<li><a accesskey="2" href="#Comments-with-_0023">Comments with #</a>
<li><a accesskey="3" href="#Strings-delimitted-by-double-quotes-_0022">Strings delimitted by double quotes "</a>
<li><a accesskey="4" href="#Line-continuation-by-backslash">Line continuation by backslash</a>
<li><a accesskey="5" href="#Informative-block-closing">Informative block closing</a>
<li><a accesskey="6" href="#Coherent-syntax">Coherent syntax</a>
<li><a accesskey="7" href="#Exclamation-mark-as-not-operator">Exclamation mark as not operator</a>
<li><a accesskey="8" href="#Increment-and-decrement-operators">Increment and decrement operators</a>
<li><a accesskey="9" href="#Unwind_002dprotect">Unwind-protect</a>
<li><a href="#Built_002din-ODE-and-DAE-solvers">Built-in ODE and DAE solvers</a>
</ul>

<p>This section refers to Matlab R2008b and Octave 2.1.51.

<div class="node">
<a name="Functions-defined-on-the-command-line"></a>
<a name="Functions-defined-on-the-command_002dline"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Comments-with-_0023">Comments with #</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.1 Functions defined on the command-line</h3>

<p>Functions can be defined by entering code on the command line, a
feature not supported by the other leading brand.  For example, you may
type:

<pre class="example">     octave:1&gt; function s = hello_string (to_who)
     &gt; ## Say hello
     &gt; if nargin&lt;1, to_who = "World"; end
     &gt; s = ["Hello ",\
     &gt;      to_who];
     &gt; endfunction
     octave:2&gt; hello_string ("Moon")
     ans = Hello Moon
</pre>
   <div class="node">
<a name="Comments-with-%23"></a>
<a name="Comments-with-_0023"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Strings-delimitted-by-double-quotes-_0022">Strings delimitted by double quotes &quot;</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Functions-defined-on-the-command_002dline">Functions defined on the command-line</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.2 Comments with #</h3>

<p>The pound character, &lsquo;<samp><span class="samp">#</span></samp>&rsquo;, may be used to start comments, in addition
to &lsquo;<samp><span class="samp">%</span></samp>&rsquo;.  See the previous example.  The major advantage of this is
that as &lsquo;<samp><span class="samp">#</span></samp>&rsquo; is also a comment character for unix script files, any
file that starts with a string like &lsquo;<samp><span class="samp">#! /usr/bin/octave -q</span></samp>&rsquo; will be
treated as an octave script and be executed by octave.

<div class="node">
<a name="Strings-delimitted-by-double-quotes-%22"></a>
<a name="Strings-delimitted-by-double-quotes-_0022"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Line-continuation-by-backslash">Line continuation by backslash</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Comments-with-_0023">Comments with #</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.3 Strings delimitted by double quotes "</h3>

<p>The double quote, &lsquo;<samp><span class="samp">"</span></samp>&rsquo;, may be used to delimit strings, in addition to
the single quote &lsquo;<samp><span class="samp">'</span></samp>&rsquo;.  See the previous example.  Also, double-quoted
strings include backslash interpretation (like C++, C, and Perl) while
single quoted are uninterpreted (like Matlab and Perl).

<div class="node">
<a name="Line-continuation-by-backslash"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Informative-block-closing">Informative block closing</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Strings-delimitted-by-double-quotes-_0022">Strings delimitted by double quotes &quot;</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.4 Line continuation by backslash</h3>

<p>Lines can be continued with a backslash, &lsquo;<samp><span class="samp">\</span></samp>&rsquo;, in addition to three
points &lsquo;<samp><span class="samp">...</span></samp>&rsquo;.  See the previous example.

<div class="node">
<a name="Informative-block-closing"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Coherent-syntax">Coherent syntax</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Line-continuation-by-backslash">Line continuation by backslash</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.5 Informative block closing</h3>

<p>You may close <code>function</code>, <code>for</code>, <code>while</code>, <code>if</code>,
<small class="dots">...</small> blocks with <code>endfunction</code>, <code>endfor</code>, <code>endwhile</code>,
<small class="dots">...</small> keywords in addition to using <code>end</code>.  As with Matlab, the
<code>end</code> (or <code>endfunction</code>) keyword that marks the end of a
function defined in a <samp><span class="file">.m</span></samp> file is optional.

<div class="node">
<a name="Coherent-syntax"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Exclamation-mark-as-not-operator">Exclamation mark as not operator</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Informative-block-closing">Informative block closing</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.6 Coherent syntax</h3>

<p>Indexing other things than variables is possible, as in:
<pre class="example">     octave:1&gt; [3 1 4 1 5 9](3)
     ans = 4
     octave:2&gt; cos([0 pi pi/4 7])(3)
     ans = 0.70711
</pre>
   <div class="node">
<a name="Exclamation-mark-as-not-operator"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Increment-and-decrement-operators">Increment and decrement operators</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Coherent-syntax">Coherent syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.7 Exclamation mark as not operator</h3>

<p>The exclamation mark '!' (aka &ldquo;Bang!&rdquo;) is a negation operator, just
like the tilde '~':

<pre class="example">     octave:1&gt; if ! strcmp (program_name, "octave"),
     &gt;   "It's an error"
     &gt; else
     &gt;   "It works!"
     &gt; end
     ans = It works!
</pre>
   <div class="node">
<a name="Increment-and-decrement-operators"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Unwind_002dprotect">Unwind-protect</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Exclamation-mark-as-not-operator">Exclamation mark as not operator</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.8 Increment and decrement operators</h3>

<p><a name="index-Increment-operators-4"></a><a name="index-Decrement-operators-5"></a><a name="index-Operators_002c-increment-6"></a><a name="index-Operators_002c-decrement-7"></a>
If you like the &lsquo;<samp><span class="samp">++</span></samp>&rsquo;, &lsquo;<samp><span class="samp">+=</span></samp>&rsquo; etc operators, rejoice! 
Octave includes the C-like increment and decrement operators &lsquo;<samp><span class="samp">++</span></samp>&rsquo;
and &lsquo;<samp><span class="samp">--</span></samp>&rsquo; in both their prefix and postfix forms, in addition to
&lsquo;<samp><span class="samp">+=</span></samp>&rsquo;, &lsquo;<samp><span class="samp">-=</span></samp>&rsquo;, &lsquo;<samp><span class="samp">*=</span></samp>&rsquo;, &lsquo;<samp><span class="samp">/=</span></samp>&rsquo;, &lsquo;<samp><span class="samp">^=</span></samp>&rsquo;, &lsquo;<samp><span class="samp">.*=</span></samp>&rsquo;,
&lsquo;<samp><span class="samp">./=</span></samp>&rsquo;, and &lsquo;<samp><span class="samp">.^=</span></samp>&rsquo;.

   <p>For example, to pre-increment the variable <var>x</var>, you would write
<code>++</code><var>x</var>.  This would add one to <var>x</var> and then return the new
value of <var>x</var> as the result of the expression.  It is exactly the
same as the expression <var>x</var><code> = </code><var>x</var><code> + 1</code>.

   <p>To post-increment a variable <var>x</var>, you would write <code>x++</code>. 
This adds one to the variable <var>x</var>, but returns the value that
<var>x</var> had prior to incrementing it.  For example, if <var>x</var> is equal
to 2, the result of the expression <code>x++</code> is 2, and the new
value of <var>x</var> is 3.

   <p>For matrix and vector arguments, the increment and decrement operators
work on each element of the operand.

<div class="node">
<a name="Unwind-protect"></a>
<a name="Unwind_002dprotect"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Built_002din-ODE-and-DAE-solvers">Built-in ODE and DAE solvers</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Increment-and-decrement-operators">Increment and decrement operators</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.9 Unwind-protect</h3>

<p><a name="index-Unwind_002dprotect-8"></a>
Octave supports a limited form of exception handling modelled after the
unwind-protect form of Lisp.  The general form of an
<code>unwind_protect</code> block looks like this:

<pre class="example">     unwind_protect
       <var>body</var>
     unwind_protect_cleanup
       <var>cleanup</var>
     end_unwind_protect
</pre>
   <p class="noindent">Where <var>body</var> and <var>cleanup</var> are both optional and may contain any
Octave expressions or commands.  The statements in <var>cleanup</var> are
guaranteed to be executed regardless of how control exits <var>body</var>.

   <p>The <code>unwind_protect</code> statement is often used to reliably restore
the values of global variables that need to be temporarily changed.

   <p>Matlab can be made to do something similar with their <code>OnCleanUp</code>
function that was introduced in 2008a.

<div class="node">
<a name="Built-in-ODE-and-DAE-solvers"></a>
<a name="Built_002din-ODE-and-DAE-solvers"></a>
<p><hr>
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Unwind_002dprotect">Unwind-protect</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Octave-Features">Octave Features</a>

</div>

<h3 class="section">5.10 Built-in ODE and DAE solvers</h3>

<p><a name="index-DASSL-9"></a><a name="index-LSODE-10"></a>
Octave includes LSODE and DASSL for solving systems of stiff ordinary
differential and differential-algebraic equations.  These functions are
built in to the interpreter.

<div class="node">
<a name="Learning-more-about-Octave"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Getting-Octave">Getting Octave</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Octave-Features">Octave Features</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">6 What documentation exists for Octave?</h2>

<ul class="menu">
<li><a accesskey="1" href="#Documentation">Documentation</a>
<li><a accesskey="2" href="#Getting-additional-help">Getting additional help</a>
<li><a accesskey="3" href="#User-community">User community</a>
<li><a accesskey="4" href="#Bug-reports">Bug reports</a>
</ul>

<div class="node">
<a name="Documentation"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Getting-additional-help">Getting additional help</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Learning-more-about-Octave">Learning more about Octave</a>

</div>

<h3 class="section">6.1 What documentation exists for Octave?</h3>

<p><a name="index-Octave_002c-documentation-11"></a>
The Octave distribution includes a 590+ page manual that is also
distributed under the terms of the GNU GPL. 
It is available on the web at
<a href="http://www.octave.org/docs.html">http://www.octave.org/docs.html</a> and you will also
find there instructions on how to order a paper version.

   <p>The complete text of the Octave manual is also available using the GNU
Info system via the GNU Emacs, info, or xinfo programs, or by using
the &lsquo;<samp><span class="samp">help -i</span></samp>&rsquo; command to start the GNU info browser directly from
the Octave prompt.

   <p>If you have problems using this documentation, or find that some topic
is not adequately explained, indexed, or cross-referenced, please send
a bug report to <a href="mailto:bug@octave.org">bug@octave.org</a>.

<div class="node">
<a name="Getting-additional-help"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#User-community">User community</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Documentation">Documentation</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Learning-more-about-Octave">Learning more about Octave</a>

</div>

<h3 class="section">6.2 Getting additional help</h3>

<p><a name="index-Additional-help-12"></a><a name="index-Mailing-lists_002c-help_002doctave-13"></a>
If you can't find an answer to your question, the
<a href="mailto:help@octave.org">help@octave.org</a> mailing list is available for questions related
to using, installing, and porting Octave that are not adequately
answered by the Octave manual or by this document.

<div class="node">
<a name="User-community"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Bug-reports">Bug reports</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Getting-additional-help">Getting additional help</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Learning-more-about-Octave">Learning more about Octave</a>

</div>

<h3 class="section">6.3 User community</h3>

<p>To subscribe to the list, go to <a href="www.octave.org/archive.html">www.octave.org/archive.html</a> and
follow the link to the subscription page for the list.

   <p><strong>Please do not</strong> send requests to be added or removed from the
mailing list, or other administrative trivia to the list itself.

   <p>An archive of old postings to the help-octave mailing list is maintained
on <a href="http://www.octave.org/archive.html">http://www.octave.org/archive.html</a>.

   <p>You will also find some user advice and code spread over the web.  Good
starting points are the Octave Wiki <a href="http://wiki.octave.org">http://wiki.octave.org</a> and
Octave-Forge <a href="http://octave.sourceforge.net">http://octave.sourceforge.net</a>

<div class="node">
<a name="Bug-reports"></a>
<p><hr>
Previous:&nbsp;<a rel="previous" accesskey="p" href="#User-community">User community</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Learning-more-about-Octave">Learning more about Octave</a>

</div>

<h3 class="section">6.4 I think I have found a bug in Octave.</h3>

<p><a name="index-Bug-in-Octave_002c-newly-found-14"></a>
&ldquo;I think I have found a bug in Octave, but I'm not sure.  How do I know,
and who should I tell?&rdquo;

   <p><a name="index-Manual_002c-for-Octave-15"></a>
First, see the section on bugs and bug reports in the Octave manual. 
When you report a bug, make sure to describe the type of computer you
are using, the version of the operating system it is running, and the
version of Octave that you are using.  Also provide enough code so that
the Octave maintainers can duplicate your bug.

   <p>If you have Octave working at all, the easiest way to do this is to use
the Octave function <code>bug_report</code>.  When you execute this function,
Octave will prompt you for a subject and then invoke the editor on a
file that already contains all the configuration information.  When you
exit the editor, Octave will mail the bug report for you (in a unix-like
operating system).

   <p><a name="index-Octave-bug-report-16"></a><a name="index-Mailing-lists_002c-bug_002doctave-17"></a>
If for some reason you cannot use Octave's <code>bug_report</code> function,
mail your bug report to <a href="mailto:bug@octave.org">bug@octave.org</a>.  Your message needs to
include enough information to allow the maintainers of Octave to fix the
bug.  Please read the section on bugs and bug reports in the Octave
manual for a list of things that should be included in every bug report.

<div class="node">
<a name="Getting-Octave"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Installation">Installation</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Learning-more-about-Octave">Learning more about Octave</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">7 Getting Octave</h2>

<ul class="menu">
<li><a accesskey="1" href="#Source-code">Source code</a>
<li><a accesskey="2" href="#Pre_002dcompiled-binary-packages">Pre-compiled binary packages</a>
<li><a accesskey="3" href="#Octave-for-other-platforms">Octave for other platforms</a>
</ul>

<div class="node">
<a name="Source-code"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Pre_002dcompiled-binary-packages">Pre-compiled binary packages</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting-Octave">Getting Octave</a>

</div>

<h3 class="section">7.1 Source code</h3>

<p><a name="index-Source-code-18"></a>
Source code is available on the Octave development site, where you are
sure to get the latest version.

     <ul>
<li><a href="http://www.octave.org/download.html">http://www.octave.org/download.html</a>
<li><a href="ftp://ftp.octave.org/pub/octave/">ftp://ftp.octave.org/pub/octave/</a>
</ul>

   <p>Since Octave is distrubted under the terms of the GPL, you can get
Octave from a friend who has a copy, by anonymous FTP, or by ordering
a tape or CD-ROM from the Free Software Foundation (FSF).

<div class="node">
<a name="Pre-compiled-binary-packages"></a>
<a name="Pre_002dcompiled-binary-packages"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Octave-for-other-platforms">Octave for other platforms</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Source-code">Source code</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting-Octave">Getting Octave</a>

</div>

<h3 class="section">7.2 Pre-compiled binary packages</h3>

<p><a name="index-Pre_002dcompiled-binary-packages-19"></a><a name="index-Binaries-20"></a>
The Octave project does not distribute binary packages, but other
projects do.  For an up-to-date listing of packagers, see:

     <ul>
<li><a href="http://www.octave.org/download.html">http://www.octave.org/download.html</a>
<li><a href="http://wiki.octave.org/wiki.pl?CategoryInstall">http://wiki.octave.org/wiki.pl?CategoryInstall</a>
</ul>

   <p>As of today, Octave binaries are available at least on Debian, RedHat,
Suse and Fedora Linuxes, Mac OS X, Windows' 98, 2000 and XP.

<div class="node">
<a name="Octave-for-other-platforms"></a>
<p><hr>
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Pre_002dcompiled-binary-packages">Pre-compiled binary packages</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting-Octave">Getting Octave</a>

</div>

<h3 class="section">7.3 How do I get a copy of Octave for (some other platform)?</h3>

<p><a name="index-VMS-support-21"></a><a name="index-VAX-22"></a><a name="index-MS_002dDOS-support-23"></a><a name="index-Windows-support-24"></a><a name="index-DJGPP-25"></a><a name="index-EMX-26"></a><a name="index-OS_002f2-support-27"></a>
Octave currently runs on Unix-like systems, Mac OS X, and Windows. 
It should be possible to make Octave work on other systems as well. 
If you are interested in porting Octave to other systems, please contact
<a href="mailto:bug@octave.org">bug@octave.org</a>.

<!-- @menu -->
<!-- * Octave for Unix:: -->
<!-- * Octave for other platforms:: -->
<!-- * latest versions:: -->
<!-- @end menu -->
<!-- @cindex Octave, ordering -->
<!-- @cindex Octave, getting a copy -->
<div class="node">
<a name="Installation"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Common-problems">Common problems</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Getting-Octave">Getting Octave</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">8 Installation Issues and Problems</h2>

<p><a name="index-Octave_002c-building-28"></a>
Octave 3.2 require approximately 800MB of disk storage to unpack
and compile from source (considerably less if you don't compile with
debugging symbols).  Once installed, Octave requires approximately 200MB
of disk space (again, considerably less if you don't compile with
debugging symbols).

<ul class="menu">
<li><a accesskey="1" href="#What-else-do-I-need_003f">What else do I need?</a>
<li><a accesskey="2" href="#Other-C_002b_002b-compilers_003f">Other C++ compilers?</a>
</ul>

<div class="node">
<a name="What-else-do-I-need%3f"></a>
<a name="What-else-do-I-need_003f"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Other-C_002b_002b-compilers_003f">Other C++ compilers?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Installation">Installation</a>

</div>

<h3 class="section">8.1 What else do I need?</h3>

<p><a name="index-GNU-gcc-29"></a><a name="index-GNU-g_002b_002b-30"></a><a name="index-libg_002b_002b-31"></a><a name="index-GNU-Make-32"></a><a name="index-Flex-33"></a><a name="index-GNU-Bison-34"></a>
To compile Octave, you will need a recent version of GNU Make.  You
will also need GCC 3.3 or later, although GCC 4.1 or later is
recommended.

   <p><strong>You must have GNU Make to compile octave</strong>.  Octave's Makefiles
use features of GNU Make that are not present in other versions of make. 
GNU Make is very portable and easy to install.

<div class="node">
<a name="Other-C++-compilers%3f"></a>
<a name="Other-C_002b_002b-compilers_003f"></a>
<p><hr>
Previous:&nbsp;<a rel="previous" accesskey="p" href="#What-else-do-I-need_003f">What else do I need?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Installation">Installation</a>

</div>

<h3 class="section">8.2 Can I compile Octave with another C++ compiler?</h3>

<p>Yes, but development is done primarily with GCC, so you may hit some
incompatibilities.  Octave is intended to be portable to any standard
conforming compiler.  If you have difficulties that you think are bugs,
please report them to the <a href="mailto:bug@octave.org">bug@octave.org</a> mailing list, or ask
for help on the <a href="mailto:help@octave.org">help@octave.org</a> mailing list.

<div class="node">
<a name="Common-problems"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#How-do-I-_002e_002e_002e_003f">How do I ...?</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Installation">Installation</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">9 Common problems</h2>

<p>This list is probably far too short.  Feel free to suggest additional
questions (preferably with answers!)

     <ul>
<li>Octave takes a long time to find symbols.

     <p>Octave uses the <code>genpath</code> function to recursively add directories
to the list of directories searched for function files.  Check the list
of directories with the <code>path</code> command. If the path list is very
long check your use of the <code>genpath</code> function.

     <li>When plotting Octave occasionally gives me errors like &lsquo;<samp><span class="samp">gnuplot&gt; 9 0.735604
line 26317: invalid command</span></samp>&rsquo;.

     <p>There is a known bug in gnuplot 4.2 that can cause an off by one error
while piping data to gnuplot. The relevant gnuplot bug report can be
found at <a href="http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1716556&amp;group_id=2055&amp;atid=102055">http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1716556&amp;group_id=2055&amp;atid=102055</a>

     <p>If you have obtained your copy of Octave from a distribution please file
a bug report requesting that the fix reported in the above bug report be
included.

     <li>I cannot install a package. Octave complains about a missing <code>mkoctfile</code>.

     <p>Most distributions split Octave into several packages. The script
<code>mkoctfile</code> is then part of a separate package:
          <ul>
<li>Debian/Ubuntu

          <p><code>aptitude install octave3.0-headers</code>

          <li>Fedora

          <p><code>yum install octave-devel</code>

     </ul>
     </ul>

<div class="node">
<a name="How-do-I-...%3f"></a>
<a name="How-do-I-_002e_002e_002e_003f"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#MATLAB-compatibility">MATLAB compatibility</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Common-problems">Common problems</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">10 How do I ...?</h2>

<ul class="menu">
<li><a accesskey="1" href="#How-do-I-set-the-number-of-displayed-decimals_003f">How do I set the number of displayed decimals?</a>
</ul>

<p><a name="index-Tips-and-tricks-35"></a><a name="index-How-do-I-_0040dots_007b_007d-_003f-36"></a>
<div class="node">
<a name="How-do-I-set-the-number-of-displayed-decimals%3f"></a>
<a name="How-do-I-set-the-number-of-displayed-decimals_003f"></a>
<p><hr>
Up:&nbsp;<a rel="up" accesskey="u" href="#How-do-I-_002e_002e_002e_003f">How do I ...?</a>

</div>

<h3 class="section">10.1 How do I set the number of displayed decimals?</h3>

<pre class="example">     octave:1&gt; format long
     octave:2&gt; pi
     pi = 3.14159265358979
     octave:3&gt; format short
     octave:4&gt; pi
     pi = 3.1416
</pre>
<div class="node">
<a name="MATLAB-compatibility"></a>
<p><hr>
Next:&nbsp;<a rel="next" accesskey="n" href="#Index">Index</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#How-do-I-_002e_002e_002e_003f">How do I ...?</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="chapter">11 Porting programs from <span class="sc">Matlab</span> to Octave</h2>

<p><a name="index-g_t_0040sc_007bMatlab_007d-compatibility-37"></a><a name="index-Compatibility-with-_0040sc_007bMatlab_007d-38"></a>
People often ask

   <p>&ldquo;I wrote some code for <span class="sc">Matlab</span>, and I want to get it running under
Octave.  Is there anything I should watch out for?&rdquo;

   <p>or alternatively

   <p>&ldquo;I wrote some code in Octave, and want to share it with <span class="sc">Matlab</span>
users.  Is there anything I should watch out for?&rdquo;

   <p>which is not quite the same thing.  There are still a number of
differences between Octave and <span class="sc">Matlab</span>, however in general
differences between the two are considered as bugs.  Octave might
consider that the bug is in <span class="sc">Matlab</span> and do nothing about it, but
generally functionality is almost identical.  If you find a difference
between Octave behavior and <span class="sc">Matlab</span>, then you should send a
description of this difference (with code illustrating the difference,
if possible) to <a href="mailto:bug@octave.org">bug@octave.org</a>.

   <p>Furthermore, Octave adds a few syntactical extensions to Matlab that
might cause some issues when exchanging files between Matlab and Octave
users. As both Octave and <span class="sc">Matlab</span> are under constant development the
information in this section is subject to change at anytime.

   <p>You should also look at the page
<a href="http://octave.sourceforge.net/packages.html">http://octave.sourceforge.net/packages.html</a> and
<a href="http://octave.sourceforge.net/doc/">http://octave.sourceforge.net/doc/</a> that has a function reference
that is up to date. You can use this function reference to see the
number of octave function that are available and their <span class="sc">Matlab</span>
compatibility.

   <p>The major differences between Octave 3.2.N and  <span class="sc">Matlab</span> R2008a are:

     <ul>
<li>Nested Functions

     <p>Octave doesn't yet have nested functions. That is

     <pre class="example">          function y = foo (x)
            y = bar(x)
            function y = bar (x)
              y = ...;
            end
          end
</pre>
     <p>There was discussion in Octave of having these even prior to <span class="sc">Matlab</span>,
and the decision was made not to have these in Octave at the time for
compatibility.  The above written with sub-functions functions would be

     <pre class="example">          function y = foo (x)
             y = bar(x)
          end
          function y = bar (x)
             y = ...;
          end
</pre>
     <p>Now that <span class="sc">Matlab</span> has recently introduced nested functions, Octave will
probably have them soon as well.  Until then nested functions in Octave
are treated as sub-functions with the same scoping rules as
sub-functions.

     <p>The authors of Octave consider the nested function scoping rules of
Matlab to be more problems than they are worth as they introduce
diffiult to find bugs as inadvertantly modifying a variable in a
nested function that is also used in the parent is particularly easy.

     <li>Differences in core syntax
There a few core <span class="sc">Matlab</span> syntaxes that are not accepted by Octave,
these being

          <ul>
<li>Some limitations on the use of function handles. The major difference is
related to nested function scoping rules (as above) and their use with
function handles.

          <li>Some limitations of variable argument lists on the LHS of an expression,
though the most common types are accepted.

          <li><span class="sc">Matlab</span> classdef object oriented programming is not yet supportted,
though work is underway and when development more on to Octave 3.3 this
will be included in teh development tree. 
</ul>

     <li>Differences in core functions
A large number of the <span class="sc">Matlab</span> core functions (ie those that are in
the core and not a toolbox) are implemented, and certainly all of the
commonly used ones. There are a few functions that aren't implemented,
for example <code>condest</code> or to do with specific missing Octave functionality
(gui, dll, java, activex, dde, web, and serial functions). Some of the
core functions have limitations that aren't in the <span class="sc">Matlab</span>
version.  For example the <code>sprandn</code> function can not force a
particular condition number for the matrix like <span class="sc">Matlab</span> can.

     <li>Just-In-Time compiler
<span class="sc">Matlab</span> includes a "Just-In-Time" compiler. This compiler allows the
acceleration of for-loops in <span class="sc">Matlab</span> to almost native performance with
certain restrictions. The JIT must know the return type of all functions
called in the loops and so you can't include user functions in the loop
of JIT optimized loops.  Octave doesn't have a JIT and so to some might
seem slower than <span class="sc">Matlab</span>.  For this reason you must vectorize your code as
much as possible.  The MathWorks themselves have a good document
discussing vectorization at
<a href="http://www.mathworks.com/support/tech-notes/1100/1109.html">http://www.mathworks.com/support/tech-notes/1100/1109.html</a>.

     <li>Compiler
On a related point, there is no Octave compiler, and so you can't
convert your Octave code into a binary for additional speed or
distribution.  There is an example of how to do this at
<a href="http://www.stud.tu-ilmenau.de/~rueckn/">http://www.stud.tu-ilmenau.de/~rueckn/</a>, but this is a very early
example code and would need lots of work to complete it.

     <li>Graphic Handles
Up to Octave 2.9.9 there was no support for graphic handles in Octave
itself.  In the 3.2.N versions of Octave the support for graphics
handles is converging towards full compatibility. The <code>patch</code>
function is currently limited to 2-D patches, due to an underlying
limitation in gnuplot.

     <li>GUI
There are no <span class="sc">Matlab</span> compatible GUI functions.  There are a number of
bindings from Octave to Tcl/Tk, Vtk and zenity included in the
Octave Forge project (<a href="http://octave.sourceforge.net">http://octave.sourceforge.net</a>) for example
that can be used for a GUI, but these are not <span class="sc">Matlab</span>
compatible. Work on a matlab compatible GUI is in an alpha stage in the
JHandles package (<a href="http://octave.sourceforge.net/jhandles/index.html">http://octave.sourceforge.net/jhandles/index.html</a>). 
This might be an issue if you intend to exchange Octave code with
<span class="sc">Matlab</span> users.

     <li>Simulink
Octave itself includes no Simulink support. Typically the simulink
models lag research and are less flexible, so shouldn't really be used
in a research environment.  However, some <span class="sc">Matlab</span> users that try to
use Octave complain about this lack.  There is a similar package to
simulink for the Octave and R projects available at
<a href="http://www.scicraft.org/">http://www.scicraft.org/</a>

     <li>Mex-Files
Octave includes an API to the matlab MEX interface. However, as MEX is
an API to the internals of <span class="sc">Matlab</span> and the internals of Octave
differ from <span class="sc">Matlab</span>, there is necessarily a manipulation of the data
to convert from a MEX interface to the Octave equivalent. This is
notable for all complex matrices, where <span class="sc">Matlab</span> stores complex
arrays as real and imaginary parts, whereas Octave respects the C99/C++
standards of co-locating the real/imag parts in memory.  Also due to the
way <span class="sc">Matlab</span> allows access to the arrays passed through a pointer,
the MEX interface might require copies of arrays (even non complex
ones).

     <li>Block comments
Block comments denoted by "%{" and "%}" markers are supported by
Octave with some limitations. The major limitation is that block
comments are not supported within [] or {}.

     <li>Mat-File format
There are some differences in the mat v5 file format accepted by
Octave. <span class="sc">Matlab</span> recently introduced the "-V7.3" save option which is
an HDF5 format which is particularly useful for 64-bit platforms where
the standard matlab format can not correctly save variables.. Octave
accepts HDF5 files, but is not yet compatible with the "-v7.3" versions
produced by <span class="sc">Matlab</span>.

     <p>Although Octave can load inline abd function handles saved by
<span class="sc">Matlab</span>, it can not yet save them.

     <p>Finally, Some multi-byte unicode characters aren't yet treated in
mat-files.

     <li>Profiler
Octave doesn't have a profiler. Though there is a patch for a flat
profiler, that might become a real profiler sometime in the future. see
the thread

     <p><a href="http://www.cae.wisc.edu/pipermail/octave-maintainers/2007-January/001685.html">http://www.cae.wisc.edu/pipermail/octave-maintainers/2007-January/001685.html</a>

     <p>for more details

     <li>Toolboxes
Octave is a community project and so the toolboxes that exist are
donated by those interested in them through the Octave Forge website
(<a href="http://octave.sourceforge.net">http://octave.sourceforge.net</a>). These might be lacking in certain
functionality relative to the <span class="sc">Matlab</span> toolboxes, and might not
exactly duplicate the matlab functionality or interface.

     <li>Short-circuit &amp; and | operators
The <code>&amp;</code> and <code>|</code> operators in <span class="sc">Matlab</span> short-circuit when
included in an if statemant and not otherwise.  In Octave only the
<code>&amp;&amp;</code> and <code>||</code> short circuit.  Note that this means that

     <pre class="example">            if (a | b)
              ...
            end
</pre>
     <p>and

     <pre class="example">            t = a | b;
            if t
              ...
            end
</pre>
     <p class="noindent">are different in <span class="sc">Matlab</span>. This is really a <span class="sc">Matlab</span> bug, but
there is too much code out there that relies on this behavior to change
it. Prefer the || and &amp;&amp; operators in if statements if possible.

     <p>Note that the difference is also significant when either argument is a
function with side effects or if the first argument is a scalar and the
second argument is an empty matrix.  For example, note the difference
between

     <pre class="example">            t = 1 | [];          ## results in [], so...
            if (t) 1, end        ## in if ([]), this is false.
</pre>
     <p>and

     <pre class="example">            if (1 | []) 1, end   ## short circuits so condition is true.
</pre>
     <p>Another case that is documented in the <span class="sc">Matlab</span> manuals is that

     <pre class="example">            t = [1, 1] | [1, 2, 3];          ## error
            if ([1, 1] | [1, 2, 3]) 1, end   ## OK
</pre>
     <p>Also <span class="sc">Matlab</span> requires the operands of &amp;&amp; and || to be scalar values but
Octave does not (it just applies the rule that for an operand to be
considered true, every element of the object must be nonzero or
logically true).

     <p>Finally, note the inconsistence of thinking of the condition of an if
statement as being equivalent to <code>all(X(:))</code> when <var>X</var> is a
matrix.  This is true for all cases EXCEPT empty matrices:

     <pre class="example">            if ([0, 1]) == if (all ([0, 1]))   ==&gt;  i.e., condition is false.
            if ([1, 1]) == if (all ([1, 1]))   ==&gt;  i.e., condition is true.
</pre>
     <p>However,

     <pre class="example">            if ([]) != if (all ([]))
</pre>
     <p>because <code>samp ([]) == 1</code> (because, despite the name, it is really
returning true if none of the elements of the matrix are zero, and since
there are no elements, well, none of them are zero).  But, somewhere
along the line, someone decided that if <code>([])</code> should be false. 
Mathworks probably thought it just looks wrong to have <code>[]</code> be true
in this context even if you can use logical gymnastics to convince
yourself that "all" the elements of a matrix that doesn't actually have
any elements are nonzero. Octave however duplicates this behavior for if
statements containing empty matrices.

     <li>Solvers for singular, under- and over-determined matrices

     <p>Matlab's solvers as used by the operators mldivide (\) and mrdivide (/),
use a different approach than Octave's in the case of singular, under-,
or over-determined matrices. In the case of a singular matrix, Matlab
returns the result given by the LU decomposition, even though the underlying
solver has flagged the result as erroneous. Octave has made the choice
of falling back to a minimum norm solution of matrices that have been
flagged as singular which arguably is a better result for these cases.

     <p>In the case of under- or over-determined matrices, Octave continues to
use a minimum norm solution, whereas Matlab uses an approach that is
equivalent to

     <pre class="example">          function x = mldivide (A, b)
            [Q, R, E] = qr(A);
            x = [A \ b, E(:, 1:m) * (R(:, 1:m) \ (Q' * b))]
          end
</pre>
     <p class="noindent">While this approach is certainly faster and uses less memory than
Octave's minimum norm approach, this approach seems to be inferior in
other ways.

     <p>A numerical question arises: how big can the null space component become,
relative to the minimum-norm solution? Can it be nicely bounded, or can it be
arbitrarily big? Consider this example:

     <pre class="example">          m = 10;
          n = 10000;
          A = ones(m, n) + 1e-6 * randn(m,n);
          b = ones(m, 1) + 1e-6 * randn(m,1);
          norm(A \ b)
</pre>
     <p class="noindent">while Octave's minimum-norm values are around 3e-2, Matlab's results
are 50-times larger. For another issue, try this code:

     <pre class="example">          m = 5;
          n = 100;
          j = floor(m * rand(1, n)) + 1;
          b = ones(m, 1);
          A = zeros(m, n);
          A(sub2ind(size(A),j,1:n)) = 1;
          x = A \ b;
          [dummy,p] = sort(rand(1,n));
          y = A(:,p)\b;
          norm(x(p)-y)
</pre>
     <p class="noindent">It shows that unlike in Octave, mldivide in Matlab is not invariant
with respect to column permutations. If there are multiple columns of
the same norm, permuting columns of the matrix gets you different
result than permuting the solution vector. This will surprise many
users.

     <p>Since the mldivide (\) and mrdivide (/) operators are often part of a more
complex expression, where there is no room to react to warnings or flags, it
should prefer intelligence (robustness) to speed, and so the Octave developers
are firmly of the opinion that Octave's approach for singular, under- and
over-determined matrices is a better choice that Matlab's

     <li>Octave extensions
The extensions in Octave over <span class="sc">Matlab</span> syntax are
very useful, but might cause issues when sharing with <span class="sc">Matlab</span> users. 
A list of the major extensions that should be avoided to be compatible
with <span class="sc">Matlab</span> are

          <ul>
<li>Comments in octave can be marked with &lsquo;<samp><span class="samp">#</span></samp>&rsquo;. This allows POSIX
systems to have the first line as &lsquo;<samp><span class="samp">#! octave -q</span></samp>&rsquo; and mark the script
itself executable. <span class="sc">Matlab</span> doesn't have this feature due to the
absence of comments starting with &lsquo;<samp><span class="samp">#</span></samp>&rsquo;".

          <li>Code blocks like if, for, while, etc can be terminated with block
specific terminations like "endif". <span class="sc">Matlab</span> doesn't have this and
all blocks must be terminated with "end"

          <li>Octave has a lisp like unwind_protect block that allows blocks of
code that terminate in an error to ensure that the variables that
are touched are restored. You can do something similar with
<code>try</code>/<code>catch</code> combined with &lsquo;<samp><span class="samp">rethrow (lasterror ())</span></samp>&rsquo; in
<span class="sc">Matlab</span>, however rethrow and lasterror are only available in Octave 2.9.10 and later.

          <p>Note that using <code>try</code>/<code>catch</code> combined with &lsquo;<samp><span class="samp">rethrow
(lasterror ())</span></samp>&rsquo; can not guarantee that global variables will be
correctly reset, as it won't catch user interrupts with Ctrl-C. For
example

          <pre class="example">                 global a
                 a = 1;
                 try
                   _a = a;
                   a = 2
                   while true
                   end
                 catch
                   fprintf ('caught interrupt\n');
                   a = _a;
                   rethrow (lasterror());
                 end
</pre>
          <p class="noindent">compared to

          <pre class="example">                 global a
                 a = 1;
                 unwind_protect
                   _a = a;
                   a = 2
                   while true
                   end
                 unwind_protect_cleanup
                   fprintf ('caught interrupt\n');
                   a = _a;
                 end
</pre>
          <p>Typing Ctrl-C in the first case returns the user directly to the
prompt, and the variable "a" is not reset to the saved value. In the
second case the variable "a" is reset correctly.  Therefore <span class="sc">Matlab</span>
gives no save way of temporarily changing global variables.

          <li>Indexing can be applied to all objects in Octave and not just
variable. Therefore <code>sin(x)(1:10);</code> for example is perfectly valid
in Octave but not <span class="sc">Matlab</span>. To do the same in <span class="sc">Matlab</span> you must do
<code>y = sin(x); y = y([1:10]);</code>

          <li>Octave has the operators "++", "&ndash;", "-=", "+=", "*=", etc.  As
<span class="sc">Matlab</span> doesn't, if you are sharing code these should be avoided.

          <li>Character strings in Octave can be denoted with double or single
quotes. There is a subtle difference between the two in that escaped
characters like <code>\n</code> (newline), <code>\t</code> (tab), etc are
interpreted in double quoted strings but not single quoted strings. This
difference is important on Windows platforms where the "\" character is
used in path names, and so single quoted strings should be used in
paths. <span class="sc">Matlab</span> doesn't have double quoted strings and so they should
be avoided if the code will be transfered to a <span class="sc">Matlab</span> user. 
</ul>

   </ul>

<div class="node">
<a name="Index"></a>
<p><hr>
Previous:&nbsp;<a rel="previous" accesskey="p" href="#MATLAB-compatibility">MATLAB compatibility</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>

</div>

<h2 class="appendix">Appendix A Concept Index</h2>

<ul class="index-cp" compact>
<li><a href="#index-Additional-help-12">Additional help</a>: <a href="#Getting-additional-help">Getting additional help</a></li>
<li><a href="#index-Binaries-20">Binaries</a>: <a href="#Pre_002dcompiled-binary-packages">Pre-compiled binary packages</a></li>
<li><a href="#index-Bug-in-Octave_002c-newly-found-14">Bug in Octave, newly found</a>: <a href="#Bug-reports">Bug reports</a></li>
<li><a href="#index-Compatibility-with-_0040sc_007bMatlab_007d-38">Compatibility with <span class="sc">Matlab</span></a>: <a href="#MATLAB-compatibility">MATLAB compatibility</a></li>
<li><a href="#index-DASSL-9">DASSL</a>: <a href="#Built_002din-ODE-and-DAE-solvers">Built-in ODE and DAE solvers</a></li>
<li><a href="#index-Decrement-operators-5">Decrement operators</a>: <a href="#Increment-and-decrement-operators">Increment and decrement operators</a></li>
<li><a href="#index-DJGPP-25">DJGPP</a>: <a href="#Octave-for-other-platforms">Octave for other platforms</a></li>
<li><a href="#index-EMX-26">EMX</a>: <a href="#Octave-for-other-platforms">Octave for other platforms</a></li>
<li><a href="#index-FAQ-for-Octave_002c-latest-version-1">FAQ for Octave, latest version</a>: <a href="#Top">Top</a></li>
<li><a href="#index-Flex-33">Flex</a>: <a href="#What-else-do-I-need_003f">What else do I need?</a></li>
<li><a href="#index-FSF-_005bFree-Software-Foundation_005d-2">FSF [Free Software Foundation]</a>: <a href="#Why-GNU-Octave_003f">Why GNU Octave?</a></li>
<li><a href="#index-GNU-_005bGNU_0027s-not-unix_005d-3">GNU [GNU's not unix]</a>: <a href="#Why-GNU-Octave_003f">Why GNU Octave?</a></li>
<li><a href="#index-GNU-Bison-34">GNU Bison</a>: <a href="#What-else-do-I-need_003f">What else do I need?</a></li>
<li><a href="#index-GNU-g_002b_002b-30">GNU g++</a>: <a href="#What-else-do-I-need_003f">What else do I need?</a></li>
<li><a href="#index-GNU-gcc-29">GNU gcc</a>: <a href="#What-else-do-I-need_003f">What else do I need?</a></li>
<li><a href="#index-GNU-Make-32">GNU Make</a>: <a href="#What-else-do-I-need_003f">What else do I need?</a></li>
<li><a href="#index-How-do-I-_0040dots_007b_007d-_003f-36">How do I <small class="dots">...</small> ?</a>: <a href="#How-do-I-_002e_002e_002e_003f">How do I ...?</a></li>
<li><a href="#index-Increment-operators-4">Increment operators</a>: <a href="#Increment-and-decrement-operators">Increment and decrement operators</a></li>
<li><a href="#index-libg_002b_002b-31">libg++</a>: <a href="#What-else-do-I-need_003f">What else do I need?</a></li>
<li><a href="#index-LSODE-10">LSODE</a>: <a href="#Built_002din-ODE-and-DAE-solvers">Built-in ODE and DAE solvers</a></li>
<li><a href="#index-Mailing-lists_002c-bug_002doctave-17">Mailing lists, bug-octave</a>: <a href="#Bug-reports">Bug reports</a></li>
<li><a href="#index-Mailing-lists_002c-help_002doctave-13">Mailing lists, help-octave</a>: <a href="#Getting-additional-help">Getting additional help</a></li>
<li><a href="#index-Manual_002c-for-Octave-15">Manual, for Octave</a>: <a href="#Bug-reports">Bug reports</a></li>
<li><a href="#index-g_t_0040sc_007bMatlab_007d-compatibility-37"><span class="sc">Matlab</span> compatibility</a>: <a href="#MATLAB-compatibility">MATLAB compatibility</a></li>
<li><a href="#index-MS_002dDOS-support-23">MS-DOS support</a>: <a href="#Octave-for-other-platforms">Octave for other platforms</a></li>
<li><a href="#index-Octave-bug-report-16">Octave bug report</a>: <a href="#Bug-reports">Bug reports</a></li>
<li><a href="#index-Octave_002c-building-28">Octave, building</a>: <a href="#Installation">Installation</a></li>
<li><a href="#index-Octave_002c-documentation-11">Octave, documentation</a>: <a href="#Documentation">Documentation</a></li>
<li><a href="#index-Operators_002c-decrement-7">Operators, decrement</a>: <a href="#Increment-and-decrement-operators">Increment and decrement operators</a></li>
<li><a href="#index-Operators_002c-increment-6">Operators, increment</a>: <a href="#Increment-and-decrement-operators">Increment and decrement operators</a></li>
<li><a href="#index-OS_002f2-support-27">OS/2 support</a>: <a href="#Octave-for-other-platforms">Octave for other platforms</a></li>
<li><a href="#index-Pre_002dcompiled-binary-packages-19">Pre-compiled binary packages</a>: <a href="#Pre_002dcompiled-binary-packages">Pre-compiled binary packages</a></li>
<li><a href="#index-Source-code-18">Source code</a>: <a href="#Source-code">Source code</a></li>
<li><a href="#index-Tips-and-tricks-35">Tips and tricks</a>: <a href="#How-do-I-_002e_002e_002e_003f">How do I ...?</a></li>
<li><a href="#index-Unwind_002dprotect-8">Unwind-protect</a>: <a href="#Unwind_002dprotect">Unwind-protect</a></li>
<li><a href="#index-VAX-22">VAX</a>: <a href="#Octave-for-other-platforms">Octave for other platforms</a></li>
<li><a href="#index-VMS-support-21">VMS support</a>: <a href="#Octave-for-other-platforms">Octave for other platforms</a></li>
<li><a href="#index-Windows-support-24">Windows support</a>: <a href="#Octave-for-other-platforms">Octave for other platforms</a></li>
   </ul>
<div class="contents">
<h2>Table of Contents</h2>
<ul>
<li><a name="toc_Top" href="#Top">Frequently asked questions about Octave (with answers)</a>
<li><a name="toc_Top" href="#Top">Preface</a>
<li><a name="toc_What-is-Octave_003f" href="#What-is-Octave_003f">1 What is Octave?</a>
<ul>
<li><a href="#Who-develops-Octave_003f">1.1 Who develops Octave?</a>
<li><a href="#Why-GNU-Octave_003f">1.2 Why GNU Octave?</a>
<li><a href="#What-version-should-I-use_003f">1.3 What version should I use?</a>
<li><a href="#On-what-platforms-does-Octave-run_003f">1.4 On what platforms does Octave run?</a>
</li></ul>
<li><a name="toc_Licensing-Issues" href="#Licensing-Issues">2 Licensing Issues</a>
<ul>
<li><a href="#GPL">2.1 If I write code using Octave do I have to release it under the GPL?</a>
<li><a href="#Licensing-MEX-Files">2.2 Since the MEX interface allows plugins to be distributed under terms that are incompatible with the GPL, does this mean that you are encouraging people to to write non-free software for Octave?</a>
<li><a href="#Requesting-License-Changes">2.3 I wrote a program that links with Octave libraries and I don't want to release it under the terms of the GPL.  Will you change the license of the Octave libraries for me?</a>
</li></ul>
<li><a name="toc_How-can-I-cite-Octave_003f" href="#How-can-I-cite-Octave_003f">3 How can I cite Octave?</a>
<li><a name="toc_Series-3_002e0_002eN" href="#Series-3_002e0_002eN">4 What's new in version series 3.0.N and 3.1.N of Octave</a>
<li><a name="toc_Octave-Features" href="#Octave-Features">5 What features are unique to Octave?</a>
<ul>
<li><a href="#Functions-defined-on-the-command_002dline">5.1 Functions defined on the command-line</a>
<li><a href="#Comments-with-_0023">5.2 Comments with #</a>
<li><a href="#Strings-delimitted-by-double-quotes-_0022">5.3 Strings delimitted by double quotes "</a>
<li><a href="#Line-continuation-by-backslash">5.4 Line continuation by backslash</a>
<li><a href="#Informative-block-closing">5.5 Informative block closing</a>
<li><a href="#Coherent-syntax">5.6 Coherent syntax</a>
<li><a href="#Exclamation-mark-as-not-operator">5.7 Exclamation mark as not operator</a>
<li><a href="#Increment-and-decrement-operators">5.8 Increment and decrement operators</a>
<li><a href="#Unwind_002dprotect">5.9 Unwind-protect</a>
<li><a href="#Built_002din-ODE-and-DAE-solvers">5.10 Built-in ODE and DAE solvers</a>
</li></ul>
<li><a name="toc_Learning-more-about-Octave" href="#Learning-more-about-Octave">6 What documentation exists for Octave?</a>
<ul>
<li><a href="#Documentation">6.1 What documentation exists for Octave?</a>
<li><a href="#Getting-additional-help">6.2 Getting additional help</a>
<li><a href="#User-community">6.3 User community</a>
<li><a href="#Bug-reports">6.4 I think I have found a bug in Octave.</a>
</li></ul>
<li><a name="toc_Getting-Octave" href="#Getting-Octave">7 Getting Octave</a>
<ul>
<li><a href="#Source-code">7.1 Source code</a>
<li><a href="#Pre_002dcompiled-binary-packages">7.2 Pre-compiled binary packages</a>
<li><a href="#Octave-for-other-platforms">7.3 How do I get a copy of Octave for (some other platform)?</a>
</li></ul>
<li><a name="toc_Installation" href="#Installation">8 Installation Issues and Problems</a>
<ul>
<li><a href="#What-else-do-I-need_003f">8.1 What else do I need?</a>
<li><a href="#Other-C_002b_002b-compilers_003f">8.2 Can I compile Octave with another C++ compiler?</a>
</li></ul>
<li><a name="toc_Common-problems" href="#Common-problems">9 Common problems</a>
<li><a name="toc_How-do-I-_002e_002e_002e_003f" href="#How-do-I-_002e_002e_002e_003f">10 How do I ...?</a>
<ul>
<li><a href="#How-do-I-set-the-number-of-displayed-decimals_003f">10.1 How do I set the number of displayed decimals?</a>
</li></ul>
<li><a name="toc_MATLAB-compatibility" href="#MATLAB-compatibility">11 Porting programs from <span class="sc">Matlab</span> to Octave</a>
<li><a name="toc_Index" href="#Index">Appendix A Concept Index</a>
</li></ul>
</div>

<div class="footnote">
<hr>
<a name="texinfo-footnotes-in-document"></a><h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> <span class="sc">Matlab</span> is a registered trademark of The MathWorks,
Inc.</p>

   <hr></div>

</body></html>