Home |  deutsch | Legals |  Mathematics | KIT
Numerical Analysis Group

Office
Allianz-Gebäude (05.20)
Room 3C-09 (3rd floor)

Address
Karlsruhe Institute of Technology
Institute for Applied and Numerical Mathematics 1
Kaiserstr. 89-93
76133 Karlsruhe
Germany

Office hours:
Monday to Friday 10:00-11:00

Contact:

Phone: +49 721 608-42061
Fax: +49 721 608-43767
Email:na-sek@math.kit.edu

Octave

GNU Octave is a high-level language which is mostly compatible with Matlab and primarily intended for numerical computations. GNU Octave is freely redistributable software under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation.

Octave is available for systems running under Linux or Windows 95/98/ME/2000/NT:
  • Linux: Binaries for Linux distributions are generally available with the distribution (Debian, Red Hat, SuSE, and others have packages).

  • Windows: A collection of hints and facts for Octave running under Windows can be found on Philip Nienhuis' website. There are essentially two methods to install Octave:

    Method 1: Installing an Octave binary for Windows
    Download a binary and see if works on your machine. However, you might have troubles if you use the German edition of Windows. If so, try the second and more cumbersome method.

    Method 2: Building Octave for Windows yourself
    Either read Philip Nienhuis' description on which the following is based or proceed step by step as described below. What follows is a description of two installations of Octave 2.0.16 by Bertold Nöckel and me on two notebooks with Intel PII and PIII processors running under SuSE Linux 7.2/Windows 98 and SuSE Linux 7.0/Windows ME, respectively.

    • Make sure that there's about 300-400 MB (depending on your file system) space available on your hard disk.
    • Download the file setup.exe from Red Hat.
    • Execute (double click) setup.exe and choose "Download from Internet".
    • Choose a mirror (ftp.inf.tu-dresden.de, for example).
    • From the list of packages that appears, select (by repeatedly clicking on the leftmost symbol under the "New" column) the following packages (and do not download the source code packages; deselect the relevant tick boxes) and download them:
      • Archive: unzip, zip
      • Base: ash, bash, cygwin, fileutils, gzip, login, ncurses, sh-utils, tar, which, zlib
      • Devel: autoconf, automake, binutils, gcc, gettext, make, mingw
      • Interpreters: gawk, python
      • Libs: w32api
      • Shells: rxvt
      • Text: groff, less, texinfo
      • Utils: mt
      • Web: lynx, wget
    • Depending on your internet connection, downloading these files may take up to 1 or even 2 hours.
    • Execute setup.exe again and select "Install from local directory". Install Cygwin to "c:\cygwin", choose "DOS" as the default text file, and click through the menus.
    • Download octave-2.0.16.tar.gz to c:\cygwin\src\octave.
    • Execute c:\cygwin\cygwin.bat and you'll see a bash terminal (Cygwin window) on your Windows desktop.
    • Unpack Octave, i.e. type
      cd /src/octave
      tar -xvzf octave-2.0.16.tar
      cd octave-2.0.16
    • Install Octave, i.e. type
      ./configure
      make
      make install

      This may take up to two hours depending on your machine. So be patient and don't bother about the last messages about "...not being found".
    • To start Octave the first time, type
      cd /usr/local/bin
      octave

      You should see a welcome message and the Octave prompt now. To see if Octave has been installed correctly, type
      eig([1 2;3 4])'
      The answer should be ans = 5.37228 -0.37228
      Enter exit to quit Octave.
    • Now, clean up by typing
      cd /src/octave/octave-2.0.16
      make clean

    • Create the directory /usr/local/gnuplot, i.e. enter
      mkdir /usr/local/gnuplot
      and download gp371cyg.zip to this directory (i.e. c:\cygwin\usr\local\gnuplot).
    • If you don't have an archive program installed, download and install Winzip.
    • Download pipe-gnuplot.exe to c:\cygwin\usr\local\gnuplot.
    • Open a DOS terminal and type
      edit c:\cygwin\usr\local\share\octave\2.0.16\m\startup\octaverc
      (of course, you may use any other editor, too, or do it from your bash terminal if you've downloaded a UNIX editor at the very beginning, too) and change this file to

      ## System-wide startup file for Octave.
      ##
      ## This file should contain any commands that should be executed each
      ## time Octave starts for every user at this site.
      #####################################################################
      gnuplot_binary='pipe-gnuplot wgnuplot.exe';
      putenv('TMPDIR','c:\cygwin\tmp');
      #####################################################################

      Save this file, then open the file c:\cygwin\etc\profile and change the path definition to
      PATH="/usr/local/gnuplot:/usr/local/bin:/usr/bin:/bin:$PATH"
      Save this file, too, and exit the editor.
    • Now, enter octave in the bash terminal (Cygwin window) to restart Octave. Then type
      x=linspace(0,5*pi);plot(x,sin(x))
      and you should see the plot of a sine curve.
    • What follows is optional but useful if you want to revamp your bash terminal. In /bin (i.e. c:\cygwin\bin), create a file start_octave-2.0.16 containing the following two lines:

      #!/bin/sh.exe
      rxvt --keysym.0xFF50 '^a' --keysym.0xFF57 '^e' --keysym.0xFFFF '^f^h' -fn "Lucida Console-14" -tn linux -title Octave -sr -sl 10000 -e octave-2.0.16

      From rxvt to octave-2.0.16, it's all in one line! You can do this, for example, by opening a DOS terminal and typing
      cd \cygwin\bin
      edit start_octave-2.0.16

      Then insert the two lines mentioned above, save, and exit the editor.
    • Make this file executable (if it isn't already), i.e. type
      chmod ugo+x /bin/start_octave-2.0.16
      in the bash terminal (Cygwin window).
    • Now, create a file octave.bat in /bin (i.e. c:\cygwin\bin) containing the three lines
      @echo off
      cd c:\cygwin\bin
      bash --login start_octave-2.0.16

    • The last step is to create an Octave icon on your Windows desktop:
      • Click (with the right mouse button) on your Windows desktop.
      • In the dialog box, click on "New".
      • Enter the file name octave.bat and the directory c:\cygwin\bin\

    If everything went well, you should have installed Octave successfully now. Start Octave by double clicking on the Octave icon you've just created.