Thread View: sci.math.num-analysis
6 messages
6 total messages
Started by John W. Eaton
Mon, 11 Jan 1993 20:18
Octave -- a high-level language for numerical computations
Author: John W. Eaton
Date: Mon, 11 Jan 1993 20:18
Date: Mon, 11 Jan 1993 20:18
263 lines
9097 bytes
9097 bytes
------------------------------
ANNOUNCING: Octave ALPHA test
------------------------------
What is Octave?
---------------
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.
Octave can do arithmetic for real and complex 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.
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.
Some help is available at the Octave prompt, and there is a rough man
page. Texinfo documentation is planned.
Currently, there is very little support for plotting, but it is
possible to save variables in files for use by other programs.
A better set of plotting commands is planned, and will be available by
the time beta testing begins.
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.
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.
Instructions for obtaining Octave are given below.
Using Octave
------------
This set of examples is by no means complete.
* to enter and compute the SVD of a matrix:
bash$ octave
Octave, version 0.61. Copyright (C) 1992, John W. Eaton.
This is free software with ABSOLUTELY NO WARRANTY.
For details, type `warranty'.
octave:1> a = [ 1, 2, 3 ; 4, 5, 6 ]
a =
1 2 3
4 5 6
octave:2> svd (a)
ans =
9.50803
0.77287
* to also get the left and right singular matrices:
octave:3> [u, s, v] = svd (a)
u =
-0.386318 -0.922366
-0.922366 0.386318
s =
9.50803 0 0
0 0.77287 0
v =
-0.428667 0.805964 0.408248
-0.566307 0.112382 -0.816497
-0.703947 -0.581199 0.408248
* to check the result:
octave:4> u*s*v'
ans =
1 2 3
4 5 6
* to define a nonlinear function and evaluate it:
octave:5> function y = f (x)
y(1) = x(1)^2 + x(2) - 4;
y(2) = x(1)^2 - x(2) - 1.5;
endfunction
octave:6> f ([1,2])
ans =
-1
-2.5
* solve it from a specified initial condition:
octave:7> fsolve ('f', [1,2])
ans =
1.65831
1.25
* to solve a set of differential equations (ending a statement with a
semicolon suppresses the default output):
octave:8> function xdot = f (x, t)
xdot = zeros (3, 1);
xdot(1) = 77.27 * (x(2) - x(1)*x(2) + x(1) - 8.375e-06*x(1)^2);
xdot(2) = (x(3) - x(1)*x(2) - x(2)) / 77.27;
xdot(3) = 0.161*(x(1) - x(3));
endfunction
octave:9> output_times = [0, logspace(-1,2.4), logspace(2.4,2.69896)];
octave:10> y = lsode ('f', [4; 1.1; 4], output_times);
octave:11> y
y =
4 1.1 4
7.84248 1.09504 4.03433
8.28731 1.09372 4.04557
8.75881 1.09205 4.06021
9.25679 1.08994 4.07918
9.78408 1.08727 4.10366
10.3492 1.08391 4.13511
10.97 1.0797 4.17546
... and so on ...
* and save the output in a text file:
octave:12> save foo.out y
Octave can also be used to solve nonlinear optimization problems, but
for now this is only possible if you have a copy of Gill and Murray's
NPSOL (we can't redistribute it because it's not free software).
If you don't have NPSOL but you still want to be able to solve NLPs,
you'll need to find a replacement or order NPSOL from Stanford.
You can get more information about NPSOL from
Stanford University
Office of Technology Licensing
857 Serra Street
Stanford CA 94305-6225
Tel: (415) 723-0651
Fax: (415) 725-7295
Octave may soon contain support for FSQP, an NLP solver from Andre
Tits (andre@src.umd.edu) of the University of Maryland. FSQP is not
really free software either -- it can't be redistributed to third
parties, so we can't distribute it -- but it is available free of
charge to academic sites. Complete instructions for obtaining FSQP
will be added to Octave's documentation if support for FSQP is added.
Where to get Octave
-------------------
If you are on the Internet, you can copy the latest distribution
version of Octave from the file /pub/octave/octave-M.N.tar.Z, on
the host ftp.che.utexas.edu. This is a compressed tar file, so be
sure to use binary mode for the transfer. M and N stand for version
numbers; look at a listing of the directory through ftp to see what
version is available. After you unpack the distribution, be sure to
look at the files README and INSTALL.
Installation
------------
Octave requires approximately 25MB of disk storage to unpack and
install (significantly less if you don't compile with debugging
symbols). In order to build Octave, you will need a current version
of g++, libg++, and GNU make. If you don't have these tools, you can
get them from many anonymous ftp archives, including ftp.che.utexas.edu,
ftp.uu.net, prep.ai.mit.edu, and wuarchive.wustl.edu, or by writing to
the FSF at 675 Mass Ave, Cambridge, MA 02139, USA.
Octave has been compiled and tested with g++-2.3.3 and libg++-2.3 on a
SPARCstation 2 running SunOS 4.1.2, an IBM RS/6000 running AIX 3.2,
a DECstation 5000/240 running Ultrix 4.2a, and an i486 system running
Linux SLS 0.99-47.
Implementation
--------------
Octave is being developed with GNU make, bison (a replacement for
YACC), flex (a replacement for lex), gcc/g++, and libg++ on Sun
SPARCstations, DEC DECstations, and IBM RS/6000s. It should be
easy to port it to any machine that runs gcc/g++.
The underlying numerical solvers are currently standard Fortran ones
like Lapack, Linpack, Odepack, the Blas, etc., packaged in a library
of C++ classes (see the files in the libcruft and liboctave
subdirectories). 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, they are translated with f2c and
compiled with a C compiler. Better performance is usually achieved if
the intermediate translation to C is avoided.
The library of C++ classes may also be useful by itself, and they are
distributed under the same terms as Octave.
Acknowledgements
----------------
Special thanks to the following people and organizations for
supporting the development of Octave:
* Digital Equipment Corporation, for a one year grant as part of
their External Research Program.
* Sun Microsystems, Inc., for an Academic Equipment grant.
* The University of Texas College of Engineering, for providing a
Challenge for Excellence Research Supplement, and for providing an
Academic Development Funds grant.
* Texaco Chemical Company, for providing funding to continue the
development of this software.
* Noel Bell, Senior Engineer, Texaco Chemical Company, Austin Texas.
* James B. Rawlings, Associate Professor, Department of Chemical
Engineering, The University of Texas at Austin.
Bugs
----
Please report any problems you have to
bug-octave@che.utexas.edu
Your bug reports play an essential role in making Octave reliable.
Reporting a bug may help you by bringing a solution to your problem,
or it may not. In any case, the principal function of a bug report
is to help the entire community by making the next version of Octave
work better. Bug reports are your contribution to the maintenance of
Octave.
The file BUGS in the top level directory of the source distribution
contains more information about how to provide useful bug reports.
Comments and suggestions are also always welcome.
--
John W. Eaton
jwe@che.utexas.edu
Department of Chemical Engineering
The University of Texas at Austin
Re: Octave -- a high-level language for numerical computations
Author: Barry Merriman
Date: Tue, 12 Jan 1993 02:39
Date: Tue, 12 Jan 1993 02:39
24 lines
1228 bytes
1228 bytes
In article <1iskmhINNokt@geraldo.cc.utexas.edu> jwe@che.utexas.edu (John W. Eaton) writes: > ------------------------------ > ANNOUNCING: Octave ALPHA test > ------------------------------ > > What is Octave? > --------------- > > 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. What would be the advantage (besides $) of Octave over Maple/Mathematica/MATLAB ? Isn't it YANKEE (Yet Another Numerical Komputing EEnvironment)? -- Barry Merriman UCLA Dept. of Math UCLA Inst. for Fusion and Plasma Research barry@math.ucla.edu (Internet; NeXTMail is welcome)
Re: Octave -- a high-level language for numerical computations
Author: K. Scott Hunziker
Date: Tue, 12 Jan 1993 06:43
Date: Tue, 12 Jan 1993 06:43
14 lines
833 bytes
833 bytes
John W. Eaton (jwe@che.utexas.edu) wrote: : 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. Octave looks a lot like MATLAB -- care to list some of their differences? -- Scott Hunziker ksh@hobbes.ds.boeing.com
Re: Octave -- a high-level language for numerical computations
Author: Andrew Telford
Date: Tue, 12 Jan 1993 07:14
Date: Tue, 12 Jan 1993 07:14
16 lines
1070 bytes
1070 bytes
Are there any significant differences between Octave
and the MATLAB clone RLab which is also under the GPL and
in alpha test:
mizar.docs.uu.se /pub/alpha/RLaB/rlab-0.30.tar.Z
Andrew
--
/\/\ Process Control Group
/ / /\ BHP Research - Melbourne Laboratories
/ / / \ 245 Wellington Rd, Mulgrave, 3170
/ / / /\ \ AUSTRALIA
\ \/ / / /
\ / / / Phone : +61-3-560-7066
\/\/\/ AARnet/Internet : ajt@resmel.bhp.com.au
Re: Octave -- a high-level language for numerical computations
Author: John W. Eaton
Date: Tue, 12 Jan 1993 09:29
Date: Tue, 12 Jan 1993 09:29
77 lines
2843 bytes
2843 bytes
In article <AJT.93Jan12171438@peregrin.resmel.bhp.com.au>
ajt@resmel.bhp.com.au (Andrew Telford) writes:
> Are there any significant differences between Octave and the MATLAB
> clone RLab which is also under the GPL and in alpha test:
RLaB is definitely not a Matlab clone -- the syntax of the RLaB
language is very different from the syntax of Matlab. The README file
that comes with RLaB even says:
RLaB is NOT a MATLAB clone!
Because of this, there may be more differences between Octave and RLaB
than there are similarities. For example, FOR loops in Octave may be
written as
for i = 1:4
for j = 1:5
m(i,j) = i+j;
end % one may also use `endfor' here, which can help
end % debugging of mismatched `end' statements
but in RLaB the above would (I think) be written as
for(i in 1:4) {
for(j in 1:5) {
m[i;j] = i+j;
}
}
Note also that RLaB uses square brackets instead of parenthesis for
matrix indexing, and semicolons instead of commas to separate the
indices.
Function definitions are also much different. Octave allows
function [x, y, z] = foo (a, b, c)
% Do something with a, b, and c to make x, y, and z.
if (nargin != 3) % parens optional here
error ('usage: [x, y, z] = foo (a, b, c)');
else
x = 1/a; y = b; z = c^2;
endif % or, if you prefer, just `end'
end % or `endfunction' or just EOF if function is defined in a file
while RLaB uses an entirely different syntax (this is an example from
the RLaB distribution):
fact = function (f) {
if(f <= 1) {
return 1;
} else {
return f*$self(f-1);
}
}
(Note that to do this in Octave, you might write
function f = fact (x)
if (x <= 1)
f = 1;
else
f = x * fact (x-1);
endif
endfunction
though it would probably be better to avoid recursion for this
problem. :-)
The RLaB distribution contains a more complete list of differences
between it and Matlab.
In general, the syntax of Octave is very much like that of Matlab.
--
Virtually all of the programs obtained by our sampling | John W. Eaton
procedure were written in FORTRAN. -- Donald E. Knuth | jwe@che.utexas.edu
Re: Octave -- a high-level language for numerical computations
Author: John W. Eaton
Date: Tue, 12 Jan 1993 10:07
Date: Tue, 12 Jan 1993 10:07
57 lines
2854 bytes
2854 bytes
In article <1993Jan12.023957.14993@math.ucla.edu>
barry@arnold.math.ucla.edu (Barry Merriman) writes:
> In article <1iskmhINNokt@geraldo.cc.utexas.edu> jwe@che.utexas.edu
> (John W. Eaton) writes:
>
>> 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.
>
> What would be the advantage (besides $) of Octave over
> Maple/Mathematica/MATLAB ?
Among other things, you get the source, so you can tinker with it if
you like. If you make useful changes, you are free (and encouraged!)
to share them with everyone else.
In addition, there are a number of other minor features that I find
attractive:
* You can choose whether you want assignment to an element of a
matrix that is currently out of bounds to resize the matrix or
produce a range error.
* You can choose to have statements like
clear a; for i = 1:5, a(i) = i; end
produce column vectors or row vectors.
* You can choose to disallow Fortran-style indexing of two
dimensional matrices so that statements like
a = [1,2;3,4]; a(2)
produce errors.
* Some Matlab functions (e.g., eye) will take negative arguments and
treat them as 0. Octave allows you to make this an error.
* Some Matlab functions (e.g., eye) will take complex arguments and
throw away the imaginary part. Octave allows you to make this an
error.
* The ODE solver (LSODE) is built in to the interpreter, and there
is a DAE solver (DASSL) that is also built in.
I also prefer the command line editing and history mechanism of
Octave, because it uses real Emacs-style keybindings and works just
like my shell (bash), and because the command history is saved between
sessions.
Octave doesn't have any symbolic capability (yet :-) so it is much
different from Maple or Mathematica. Since Octave is intended for
numerical computations, one might find it to be more suitable for
those tasks than symbolic processors.
Whether these things are advantages is for you to decide :-).
--
Virtually all of the programs obtained by our sampling | John W. Eaton
procedure were written in FORTRAN. -- Donald E. Knuth | jwe@che.utexas.edu
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads