FAQ: Difference between revisions

Jump to navigation Jump to search
m (Update internal link.)
(Put section "Common problems" more to the top.)
Line 74: Line 74:


Please read our website http://www.octave.org/bugs.html.
Please read our website http://www.octave.org/bugs.html.
=Common problems=
==I do not see any output of my script until it has finished?==
By default Octave is set to pass its screen output through a [https://en.wikipedia.org/wiki/Terminal_pager pager] (usually the default pager is "less") which allows things such as navigating through the output with arrow keys or searching for text or regular expressions within the output.  The pager only displays the output after it's finished receiving it, so when it is active you'll not be able to see anything until your script has terminated.  To change this behavior temporarily or permanently you may want to use one of the options described [http://www.octave.org/doc/interpreter/Paging-Screen-Output.html in the manual].
==When I try plotting from a script, why am I not seeing anything?==
If you are running an Octave script that includes a plotting command, the script and Octave may terminate immediately.  So the plot window does show up, but immediately closes when Octave finishes execution.  Alternatively, if using fltk, the plot window needs a readline loop to show up (the time when Octave is sitting around doing nothing waiting for interactive input).
A common solution is to put a {{manual|pause}} command at the end of your script.
==How do I get sound input or output in Windows?==
Sound input from a sound card and output to a sound card is fully supported since Octave 4.0.0 for all platforms.  If you have problems with the [http://www.octave.org/doc/interpreter/Audio-Processing.html audio I/O functions] using Octave 4.0.0 or a newer version, please report them on the [http://bugs.octave.org bug tracker].
==I have problem X using the latest Octave version==
Please be more specific about what you mean by "latest version"?
* The latest stable version is {{Release}}.  Be aware that you may still have an older version due to whatever distribution method you are using.  To get a newer stable version for your system see for example [[Octave for GNU/Linux|GNU/Linux]], [[Octave for macOS|macOS]], or [[Octave for Microsoft Windows|Windows]]).
* If you refer to the latest Mercurial revision, please specify the [https://www.mercurial-scm.org/wiki/ChangeSetID changeset ID] not the revision number, e.g. the output of <code>hg summary</code> or <code>hg id</code>.  Changeset IDs are globally unique across all repos.
If your problem truly persists with the "latest version", then please [http://bugs.octave.org/ report a bug] or ask for help at[https://lists.gnu.org/mailman/listinfo/help-octave help@octave.org].  Otherwise, don't be surprised if volunteers are less inclined to help you with a problem that only exists in an older version of Octave and is already fixed in a newer version.
==Why is Octave's floating-point computation wrong?==
Floating-point arithmetic is an approximation '''in binary''' to arithmetic on real or complex numbers.  Just like you cannot represent 1/3 exactly in decimal arithmetic (0.333333... is only a rough approximation to 1/3), you cannot represent some fractions like <math>1/10</math> exactly in base 2.  In binary, the representation to one tenth is <math>0.0\overline{0011}_b</math> where the bar indicates that it repeats infinitely (like how <math>1/6 = 0.1\overline{6}_d</math> in decimal).  Because this infinite repetition cannot be represented exactly with a finite number of digits, rounding errors occur for values that appear to be exact in decimal but are in fact approximations in binary, such as for example how 0.3 - 0.2 - 0.1 is not equal to zero.
In addition, some advanced operations are computed by approximation and are not guaranteed to be accurate, see [https://en.wikipedia.org/wiki/Rounding#Table-maker.27s_dilemma Table-maker's dilemma].  Their results are system-dependent.
This isn't an Octave bug.  It happens with any program that uses [https://en.wikipedia.org/wiki/IEEE_754 IEEE 754 floating-point arithmetic].  To be fair, IEEE 754 also specifies decimal floating-point arithmetic, which has never seen wide adoption.  The reason why Octave and other programs using IEEE 754 binary floating-point numbers is that they are ''fast'', because they are implemented in hardware or system libraries.  Unless you are using very exotic hardware, Octave will use your computer's processor for basic floating-point arithmetic.
Another approach to deal with rounding errors is interval arithmetic with the [[Interval package]] or symbolic computatons with the [[Symbolic package]].  These approaches are likely to be slower, since not all operations can be performed on Hardware like pure floatin-point arithmetic.
To learn more about floating-point arithmetic, consult the [https://en.wikipedia.org/wiki/Floating-point_arithmetic Wikipedia article] or the classical reference by David Goldberg [http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html What Every Computer Scientist Should Know About Floating-Point Arithmetic].
==Missing lines when printing under Windows with OpenGL toolkit and Intel integrated GPU==
Some windows users with integrated Intel GPUs have reported missing lines when printing with an OpenGL toolkit like FLTK or Qt. {{bug|42534}}
Users with this kind of problem should try to install/update their Intel OpenGL drivers for Windows or consider installing Mesa drivers from http://qt-project.org/wiki/Cross-compiling-Mesa-for-Windows .
See also https://www.opengl.org/wiki/FAQ#Why_is_my_GL_version_only_1.4_or_lower.3F .
==Plot hangs and makes the GUI unresponsive==
If the Qt graphics toolkit is used and "plot" is used for the first time, the fontconfig scanner searches the font directory to build a font cache. This can take up to 3min on slow CPUs. See {{bug|45458}}
==Error message about invalid call to script or invalid use of script in index expression==
If Octave shows an error message about {{Codeline|invalid call to script .../close.m}} or {{Codeline|invalid use of of script .../close.m in index expression}}, it means that you have created a script called close.m that is overriding the built-in Octave function {{Codeline|close}}. Octave functions and scripts share the samem global namespace. It is best to avoid creating your own scripts or functions that have the same name as an Octave function.


=Licensing issues=
=Licensing issues=
Line 443: Line 499:
   corr    corrcoef
   corr    corrcoef


=Common problems=
==I do not see any output of my script until it has finished?==
By default Octave is set to pass its screen output through a [https://en.wikipedia.org/wiki/Terminal_pager pager] (usually the default pager is "less") which allows things such as navigating through the output with arrow keys or searching for text or regular expressions within the output.  The pager only displays the output after it's finished receiving it, so when it is active you'll not be able to see anything until your script has terminated.  To change this behavior temporarily or permanently you may want to use one of the options described [http://www.octave.org/doc/interpreter/Paging-Screen-Output.html in the manual].
==When I try plotting from a script, why am I not seeing anything?==
If you are running an Octave script that includes a plotting command, the script and Octave may terminate immediately.  So the plot window does show up, but immediately closes when Octave finishes execution.  Alternatively, if using fltk, the plot window needs a readline loop to show up (the time when Octave is sitting around doing nothing waiting for interactive input).
A common solution is to put a {{manual|pause}} command at the end of your script.
==How do I get sound input or output in Windows?==
Sound input from a sound card and output to a sound card is fully supported since Octave 4.0.0 for all platforms.  If you have problems with the [http://www.octave.org/doc/interpreter/Audio-Processing.html audio I/O functions] using Octave 4.0.0 or a newer version, please report them on the [http://bugs.octave.org bug tracker].
==I have problem X using the latest Octave version==
Please be more specific about what you mean by "latest version"?
* The latest stable version is {{Release}}.  Be aware that you may still have an older version due to whatever distribution method you are using.  To get a newer stable version for your system see for example [[Octave for GNU/Linux|GNU/Linux]], [[Octave for macOS|macOS]], or [[Octave for Microsoft Windows|Windows]]).
* If you refer to the latest Mercurial revision, please specify the [https://www.mercurial-scm.org/wiki/ChangeSetID changeset ID] not the revision number, e.g. the output of <code>hg summary</code> or <code>hg id</code>.  Changeset IDs are globally unique across all repos.
If your problem truly persists with the "latest version", then please [http://bugs.octave.org/ report a bug] or ask for help at[https://lists.gnu.org/mailman/listinfo/help-octave help@octave.org].  Otherwise, don't be surprised if volunteers are less inclined to help you with a problem that only exists in an older version of Octave and is already fixed in a newer version.
==Why is Octave's floating-point computation wrong?==
Floating-point arithmetic is an approximation '''in binary''' to arithmetic on real or complex numbers.  Just like you cannot represent 1/3 exactly in decimal arithmetic (0.333333... is only a rough approximation to 1/3), you cannot represent some fractions like <math>1/10</math> exactly in base 2.  In binary, the representation to one tenth is <math>0.0\overline{0011}_b</math> where the bar indicates that it repeats infinitely (like how <math>1/6 = 0.1\overline{6}_d</math> in decimal).  Because this infinite repetition cannot be represented exactly with a finite number of digits, rounding errors occur for values that appear to be exact in decimal but are in fact approximations in binary, such as for example how 0.3 - 0.2 - 0.1 is not equal to zero.
In addition, some advanced operations are computed by approximation and are not guaranteed to be accurate, see [https://en.wikipedia.org/wiki/Rounding#Table-maker.27s_dilemma Table-maker's dilemma].  Their results are system-dependent.
This isn't an Octave bug.  It happens with any program that uses [https://en.wikipedia.org/wiki/IEEE_754 IEEE 754 floating-point arithmetic].  To be fair, IEEE 754 also specifies decimal floating-point arithmetic, which has never seen wide adoption.  The reason why Octave and other programs using IEEE 754 binary floating-point numbers is that they are ''fast'', because they are implemented in hardware or system libraries.  Unless you are using very exotic hardware, Octave will use your computer's processor for basic floating-point arithmetic.
Another approach to deal with rounding errors is interval arithmetic with the [[Interval package]] or symbolic computatons with the [[Symbolic package]].  These approaches are likely to be slower, since not all operations can be performed on Hardware like pure floatin-point arithmetic.
To learn more about floating-point arithmetic, consult the [https://en.wikipedia.org/wiki/Floating-point_arithmetic Wikipedia article] or the classical reference by David Goldberg [http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html What Every Computer Scientist Should Know About Floating-Point Arithmetic].
==Missing lines when printing under Windows with OpenGL toolkit and Intel integrated GPU==
Some windows users with integrated Intel GPUs have reported missing lines when printing with an OpenGL toolkit like FLTK or Qt. {{bug|42534}}
Users with this kind of problem should try to install/update their Intel OpenGL drivers for Windows or consider installing Mesa drivers from http://qt-project.org/wiki/Cross-compiling-Mesa-for-Windows .
See also https://www.opengl.org/wiki/FAQ#Why_is_my_GL_version_only_1.4_or_lower.3F .
==Plot hangs and makes the GUI unresponsive==
If the Qt graphics toolkit is used and "plot" is used for the first time, the fontconfig scanner searches the font directory to build a font cache. This can take up to 3min on slow CPUs. See {{bug|45458}}
==Error message about invalid call to script or invalid use of script in index expression==
If Octave shows an error message about {{Codeline|invalid call to script .../close.m}} or {{Codeline|invalid use of of script .../close.m in index expression}}, it means that you have created a script called close.m that is overriding the built-in Octave function {{Codeline|close}}. Octave functions and scripts share the samem global namespace. It is best to avoid creating your own scripts or functions that have the same name as an Octave function.


=Differences between Octave and Matlab=
=Differences between Octave and Matlab=