annotate doc/interpreter/intro.texi @ 2653:e7908588548a

[project @ 1997-02-01 16:53:52 by jwe]
author jwe
date Sat, 01 Feb 1997 16:57:10 +0000
parents 31d5588dbb61
children 18192eea4973
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
1 @c Copyright (C) 1996 John W. Eaton
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
2 @c This is part of the Octave manual.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
3 @c For copying conditions, see the file gpl.texi.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
4
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
5 @node Introduction, Invoking Octave, Preface, Top
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
6 @chapter A Brief Introduction to Octave
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
7 @cindex introduction
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
8
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
9 This manual documents how to run, install and port Octave, and how to
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
10 report bugs.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
11
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
12 Octave is a high-level language, primarily intended for numerical
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
13 computations. It provides a convenient command line interface for
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
14 solving linear and nonlinear problems numerically, and for performing
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
15 other numerical experiments. It may also be used as a batch-oriented
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
16 language.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
17
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
18 Octave is also freely redistributable software. You may redistribute it
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
19 and/or modify it under the terms of the GNU General Public License as
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
20 published by the Free Software Foundation. The GPL is included in this
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
21 manual in @ref{Copying}.
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
22
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
23 This document corresponds to Octave version @value{VERSION}.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
24
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
25 @c XXX FIXME XXX -- add explanation about how and why Octave was written.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
26 @c
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
27 @c XXX FIXME XXX -- add a sentence or two explaining that we could
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
28 @c always use more funding.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
29
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
30 @menu
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
31 * Running Octave::
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
32 * Simple Examples::
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
33 * Conventions::
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
34 @end menu
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
35
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
36 @node Running Octave, Simple Examples, Introduction, Introduction
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
37 @section Running Octave
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
38
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
39 On most systems, the way to invoke Octave is with the shell command
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
40 @samp{octave}. Octave displays an initial message and then a prompt
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
41 indicating it is ready to accept input. You can begin typing Octave
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
42 commands immediately afterward.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
43
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
44 If you get into trouble, you can usually interrupt Octave by typing
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
45 @kbd{Control-C} (usually written @kbd{C-c} for short). @kbd{C-c} gets
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
46 its name from the fact that you type it by holding down the @kbd{CTRL}
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
47 key and then pressing @kbd{c}. Doing this will normally return you to
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
48 Octave's prompt.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
49
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
50 @cindex exiting octave
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
51 @cindex quitting octave
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
52 To exit Octave, type @samp{quit}, or @samp{exit} at the Octave prompt.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
53
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
54 On systems that support job control, you can suspend Octave by sending
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
55 it a @code{SIGTSTP} signal, usually by typing @kbd{C-z}.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
56
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
57 @node Simple Examples, Conventions, Running Octave, Introduction
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
58 @section Simple Examples
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
59
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
60 The following chapters describe all of Octave's features in detail, but
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
61 before doing that, it might be helpful to give a sampling of some of its
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
62 capabilities.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
63
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
64 If you are new to Octave, I recommend that you try these examples to
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
65 begin learning Octave by using it. Lines marked with @samp{octave:13>}
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
66 are lines you type, ending each with a carriage return. Octave will
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
67 respond with an answer, or by displaying a graph.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
68
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
69 @unnumberedsubsec Creating a Matrix
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
70
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
71 To create a new matrix and store it in a variable so that it you can
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
72 refer to it later, type the command
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
73
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
74 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
75 octave:1> a = [ 1, 1, 2; 3, 5, 8; 13, 21, 34 ]
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
76 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
77
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
78 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
79 Octave will respond by printing the matrix in neatly aligned columns.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
80 Ending a command with a semicolon tells Octave to not print the result
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
81 of a command. For example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
82
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
83 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
84 octave:2> b = rand (3, 2);
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
85 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
86
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
87 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
88 will create a 3 row, 2 column matrix with each element set to a random
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
89 value between zero and one.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
90
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
91 To display the value of any variable, simply type the name of the
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
92 variable. For example, to display the value stored in the matrix
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
93 @samp{b}, type the command
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
94
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
95 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
96 octave:3> b
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
97 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
98
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
99 @unnumberedsubsec Matrix Arithmetic
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
100
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
101 Octave has a convenient operator notation for performing matrix
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
102 arithmetic. For example, to multiply the matrix @var{a} by a scalar
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
103 value, type the command
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
104
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
105 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
106 octave:4> 2 * a
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
107 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
108
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
109 To multiply the two matrices @var{a} and @var{b}, type the command
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
110
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
111 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
112 octave:5> a * b
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
113 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
114
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
115 To form the matrix product
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
116 @iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
117 @tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
118 $a^Ta$,
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
119 @end tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
120 @end iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
121 @ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
122 @code{transpose (a) * a},
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
123 @end ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
124 type the command
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
125
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
126 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
127 octave:6> a' * a
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
128 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
129
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
130 @unnumberedsubsec Solving Linear Equations
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
131
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
132 To solve the set of linear equations
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
133 @iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
134 @tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
135 ${\bf Ax} = {\bf b}$,
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
136 @end tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
137 @end iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
138 @ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
139 @code{Ax = b},
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
140 @end ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
141 use the left division operator, @samp{\}:
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
142
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
143 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
144 octave:7> a \ b
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
145 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
146
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
147 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
148 This is conceptually equivalent to
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
149 @iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
150 @tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
151 ${\bf A}^{-1}{\bf b}$,
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
152 @end tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
153 @end iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
154 @ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
155 inv (A) * b,
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
156 @end ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
157 but avoids computing the inverse of a matrix directly.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
158
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
159 If the coefficient matrix is singular, Octave will print a warning
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
160 message and compute a minimum norm solution.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
161
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
162 @unnumberedsubsec Integrating Differential Equations
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
163
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
164 Octave has built-in functions for solving nonlinear differential
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
165 equations of the form
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
166 @iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
167 @tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
168 $$
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
169 {dx \over dt} = f(x,t), \qquad {\rm with} x(t=t_0) = x_0
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
170 $$
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
171 @end tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
172 @end iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
173 @ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
174
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
175 @example
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
176 @group
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
177 dx
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
178 -- = f (x, t)
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
179 dt
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
180 @end group
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
181 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
182
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
183 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
184 with the initial condition
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
185
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
186 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
187 x(t = t0) = x0
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
188 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
189 @end ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
190
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
191 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
192 For Octave to integrate equations of this form, you must first provide a
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
193 definition of the function
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
194 @iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
195 @tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
196 $f (x, t)$.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
197 @end tex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
198 @end iftex
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
199 @ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
200 @code{f(x,t)}.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
201 @end ifinfo
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
202 This is straightforward, and may be accomplished by entering the
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
203 function body directly on the command line. For example, the following
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
204 commands define the right hand side function for an interesting pair of
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
205 nonlinear differential equations. Note that while you are entering a
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
206 function, Octave responds with a different prompt, to indicate that it
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
207 is waiting for you to complete your input.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
208
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
209 @example
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
210 @group
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
211 octave:8> function xdot = f (x, t)
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
212 >
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
213 > r = 0.25;
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
214 > k = 1.4;
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
215 > a = 1.5;
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
216 > b = 0.16;
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
217 > c = 0.9;
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
218 > d = 0.8;
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
219 >
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
220 > xdot(1) = r*x(1)*(1 - x(1)/k) - a*x(1)*x(2)/(1 + b*x(1));
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
221 > xdot(2) = c*a*x(1)*x(2)/(1 + b*x(1)) - d*x(2);
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
222 >
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
223 > endfunction
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
224 @end group
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
225 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
226
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
227 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
228 Given the initial condition
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
229
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
230 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
231 x0 = [1; 2];
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
232 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
233
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
234 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
235 and the set of output times as a column vector (note that the first
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
236 output time corresponds to the initial condition given above)
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
237
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
238 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
239 t = linspace (0, 50, 200)';
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
240 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
241
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
242 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
243 it is easy to integrate the set of differential equations:
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
244
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
245 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
246 x = lsode ("f", x0, t);
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
247 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
248
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
249 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
250 The function @samp{lsode} uses the Livermore Solver for Ordinary
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
251 Differential Equations, described in A. C. Hindmarsh, @cite{ODEPACK, a
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
252 Systematized Collection of ODE Solvers}, in: Scientific Computing, R. S.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
253 Stepleman et al. (Eds.), North-Holland, Amsterdam, 1983, pages 55--64.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
254
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
255 @unnumberedsubsec Producing Graphical Output
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
256
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
257 To display the solution of the previous example graphically, use the
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
258 command
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
259
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
260 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
261 plot (t, x)
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
262 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
263
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
264 If you are using the X Window System, Octave will automatically create
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
265 a separate window to display the plot. If you are using a terminal that
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
266 supports some other graphics commands, you will need to tell Octave what
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
267 kind of terminal you have. Type the command
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
268
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
269 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
270 set term
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
271 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
272
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
273 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
274 to see a list of the supported terminal types. Octave uses
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
275 @code{gnuplot} to display graphics, and can display graphics on any
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
276 terminal that is supported by @code{gnuplot}.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
277
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
278 To capture the output of the plot command in a file rather than sending
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
279 the output directly to your terminal, you can use a set of commands like
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
280 this
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
281
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
282 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
283 @group
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
284 set term postscript
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
285 set output "foo.ps"
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
286 replot
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
287 @end group
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
288 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
289
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
290 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
291 This will work for other types of output devices as well. Octave's
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
292 @samp{set} command is really just piped to the @code{gnuplot}
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
293 subprocess, so that once you have a plot on the screen that you like,
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
294 you should be able to do something like this to create an output file
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
295 suitable for your graphics printer.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
296
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
297 Or, you can eliminate the intermediate file by using commands like this
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
298
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
299 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
300 @group
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
301 set term postscript
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
302 set output "|lpr -Pname_of_your_graphics_printer"
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
303 replot
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
304 @end group
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
305 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
306
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
307 @unnumberedsubsec Editing What You Have Typed
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
308
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
309 At the Octave prompt, you can recall, edit, and reissue previous
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
310 commands using Emacs- or vi-style editing commands. The default
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
311 keybindings use Emacs-style commands. For example, to recall the
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
312 previous command, type @kbd{Control-P} (usually written @kbd{C-p} for
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
313 short). @kbd{C-p} gets its name from the fact that you type it by
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
314 holding down the @kbd{CTRL} key and then pressing @kbd{p}. Doing this
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
315 will normally bring back the previous line of input. @kbd{C-n} will
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
316 bring up the next line of input, @kbd{C-b} will move the cursor backward
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
317 on the line, @kbd{C-f} will move the cursor forward on the line, etc.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
318
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
319 A complete description of the command line editing capability is given
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
320 in this manual in @ref{Command Line Editing}.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
321
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
322 @unnumberedsubsec Getting Help
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
323
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
324 Octave has an extensive help facility. The same documentation that is
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
325 available in printed form is also available from the Octave prompt,
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
326 because both forms of the documentation are created from the same input
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
327 file.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
328
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
329 In order to get good help you first need to know the name of the command
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
330 that you want to use. This name of the function may not always be
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
331 obvious, but a good place to start is to just type @code{help}.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
332 This will show you all the operators, reserved words, functions,
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
333 built-in variables, and function files. You can then get more
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
334 help on anything that is listed by simply including the name as an
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
335 argument to help. For example,
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
336
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
337 @example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
338 help plot
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
339 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
340
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
341 @noindent
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
342 will display the help text for the @code{plot} function.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
343
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
344 Octave sends output that is too long to fit on one screen through a
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
345 pager like @code{less} or @code{more}. Type a carriage return to
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
346 advance one line, a space character to advance one page, and @samp{q} to
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
347 exit the pager.
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
348
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
349 The part of Octave's help facility that allows you to read the complete
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
350 text of the printed manual from within Octave normally uses a separate
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
351 program called Info. When you invoke Info you will be put into a menu
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
352 driven program that contains the entire Octave manual. Help for using
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
353 Info is provided in this manual in @ref{Help}.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
354
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
355 @node Conventions, , Simple Examples, Introduction
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
356 @section Conventions
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
357
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
358 This section explains the notational conventions that are used in this
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
359 manual. You may want to skip this section and refer back to it later.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
360
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
361 @menu
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
362 * Fonts::
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
363 * Evaluation Notation::
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
364 * Printing Notation::
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
365 * Error Messages::
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
366 * Format of Descriptions::
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
367 @end menu
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
368
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
369 @node Fonts, Evaluation Notation, Conventions, Conventions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
370 @subsection Fonts
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
371 @cindex fonts
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
372
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
373 Examples of Octave code appear in this font or form: @code{svd (a)}.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
374 Names that represent arguments or metasyntactic variables appear
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
375 in this font or form: @var{first-number}.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
376
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
377 @node Evaluation Notation, Printing Notation, Fonts, Conventions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
378 @subsection Evaluation Notation
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
379 @cindex evaluation notation
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
380 @cindex documentation notation
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
381
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
382 In the examples in this manual, results from expressions that you
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
383 evaluate are indicated with @samp{@result{}}. For example,
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
384
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
385 @example
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
386 @group
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
387 sqrt (2)
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
388
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
389 @result{} 1.4142
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
390 @end group
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
391 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
392
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
393 @noindent
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
394 You can read this as ``@code{sqrt (2)} evaluates to 1.4142''.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
395
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
396 In some cases, matrix values that are returned by expressions are
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
397 displayed like this
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
398
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
399 @example
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
400 @group
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
401 [1, 2; 3, 4] == [1, 3; 2, 4]
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
402
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
403 @result{} [ 1, 0; 0, 1 ]
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
404 @end group
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
405 @end example
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
406
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
407 @noindent
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
408 and in other cases, they are displayed like this
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
409
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
410 @example
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
411 @group
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
412 eye (3)
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
413
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
414 @result{} 1 0 0
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
415 0 1 0
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
416 0 0 1
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
417 @end group
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
418 @end example
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
419
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
420 @noindent
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
421 in order to clearly show the structure of the result.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
422
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
423 Sometimes to help describe one expression, another expression is
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
424 shown that produces identical results. The exact equivalence of
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
425 expressions is indicated with @samp{@equiv{}}. For example,
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
426
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
427 @example
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
428 @group
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
429 rot90 ([1, 2; 3, 4], -1)
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
430 @equiv{}
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
431 rot90 ([1, 2; 3, 4], 3)
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
432 @equiv{}
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
433 rot90 ([1, 2; 3, 4], 7)
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
434 @end group
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
435 @end example
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
436
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
437 @node Printing Notation, Error Messages, Evaluation Notation, Conventions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
438 @subsection Printing Notation
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
439 @cindex printing notation
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
440
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
441 Many of the examples in this manual print text when they are
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
442 evaluated. Examples in this manual indicate printed text with
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
443 @samp{@print{}}. The value that is returned by evaluating the
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
444 expression (here @code{1}) is displayed with @samp{@result{}} and
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
445 follows on a separate line.
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
446
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
447 @example
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
448 @group
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
449 printf ("foo %s\n", "bar")
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
450
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
451 @print{} foo bar
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
452
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
453 @result{} 1
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
454 @end group
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
455 @end example
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
456
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
457 @node Error Messages, Format of Descriptions, Printing Notation, Conventions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
458 @subsection Error Messages
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
459 @cindex error message notation
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
460
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
461 Some examples signal errors. This normally displays an error message
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
462 on your terminal. Error messages are shown on a line starting with
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
463 @samp{@error{}}. Note that @samp{@error{}} itself does not appear on
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
464 your terminal.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
465
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
466 @example
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
467 struct_elements ([1, 2; 3, 4])
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
468 @error{} struct_elements: wrong type argument `matrix'
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
469 @end example
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
470
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
471 @node Format of Descriptions, , Error Messages, Conventions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
472 @subsection Format of Descriptions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
473 @cindex description format
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
474
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
475 Functions, commands, and variables are described in this manual in a
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
476 uniform format. The first line of a description contains the name of
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
477 the item followed by its arguments, if any.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
478 @ifinfo
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
479 The category---function, variable, or whatever---appears at the
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
480 beginning of the line.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
481 @end ifinfo
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
482 @iftex
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
483 The category---function, variable, or whatever---is printed next to the
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
484 right margin.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
485 @end iftex
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
486 The description follows on succeeding lines, sometimes with examples.
2449
31d5588dbb61 [project @ 1996-10-30 22:58:44 by jwe]
jwe
parents: 2333
diff changeset
487
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
488 @menu
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
489 * A Sample Function Description::
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
490 * A Sample Command Description::
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
491 * A Sample Variable Description::
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
492 @end menu
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
493
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
494 @node A Sample Function Description, A Sample Command Description, Format of Descriptions, Format of Descriptions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
495 @subsubsection A Sample Function Description
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
496 @cindex function descriptions
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
497
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
498 In a function description, the name of the function being described
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
499 appears first. It is followed on the same line by a list of parameters.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
500 The names used for the parameters are also used in the body of the
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
501 description.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
502
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
503 Here is a description of an imaginary function @code{foo}:
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
504
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
505 @deftypefn {Function} {} foo (@var{x}, @var{y}, @dots{})
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
506 The function @code{foo} subtracts @var{x} from @var{y}, then adds the
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
507 remaining arguments to the result. If @var{y} is not supplied, then the
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
508 number 19 is used by default.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
509
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
510 @example
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
511 @group
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
512 foo (1, [3, 5], 3, 9)
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
513
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
514 @result{} [ 14, 16 ]
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
515
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
516 foo (5)
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
517
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
518 @result{} 14
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
519 @end group
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
520 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
521
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
522 More generally,
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
523
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
524 @example
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
525 @group
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
526 foo (@var{w}, @var{x}, @var{y}, @dots{})
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
527 @equiv{}
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
528 @var{x} - @var{w} + @var{y} + @dots{}
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
529 @end group
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
530 @end example
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
531 @end deftypefn
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
532
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
533 Any parameter whose name contains the name of a type (e.g.,
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
534 @var{integer}, @var{integer1} or @var{matrix}) is expected to be of that
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
535 type. Parameters named @var{object} may be of any type. Parameters
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
536 with other sorts of names (e.g., @var{new_file}) are discussed
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
537 specifically in the description of the function. In some sections,
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
538 features common to parameters of several functions are described at the
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
539 beginning.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
540
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
541 Functions in Octave may be defined in several different ways. The
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
542 catagory name for functions may include another name that indicates the
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
543 way that the function is defined. These additional tags include
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
544
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
545 @table @asis
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
546 @item Built-in Function
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
547 The function described is written in a language like C++, C, or Fortran,
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
548 and is part of the compiled Octave binary.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
549
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
550 @item Loadable Function
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
551 The function described is written in a language like C++, C, or Fortran.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
552 On systems that support dynamic linking of user-supplied functions, it
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
553 may be automatically linked while Octave is running, but only if it is
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
554 needed. @xref{Dynamically Linked Functions}.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
555
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
556 @item Function File
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
557 The function described is defined using Octave commands stored in a text
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
558 file. @xref{Function Files}.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
559 @end table
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
560
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
561 @node A Sample Command Description, A Sample Variable Description, A Sample Function Description, Format of Descriptions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
562 @subsubsection A Sample Function Description
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
563 @cindex command descriptions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
564
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
565 Command descriptions have a format similar to function descriptions,
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
566 except that the word `Function' is replaced by `Command. Commands are
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
567 functions that are called without surrounding their arguments in
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
568 parentheses. For example, here is the description for Octave's
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
569 @code{cd} command:
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
570
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
571 @deffn {Command} cd dir
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
572 @deffnx {Command} chdir dir
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
573 Change the current working directory to @var{dir}. For example,
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
574
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
575 @example
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
576 cd ~/octave
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
577 @end example
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
578
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
579 @noindent
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
580 Changes the current working directory to @file{~/octave}. If the
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
581 directory does not exist, an error message is printed and the working
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
582 directory is not changed.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
583 @end deffn
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
584
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
585 @node A Sample Variable Description, , A Sample Command Description, Format of Descriptions
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
586 @subsubsection A Sample Variable Description
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
587 @cindex variable descriptions
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
588
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
589 A @dfn{variable} is a name that can hold a value. Although any variable
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
590 can be set by the user, certain variables that exist specifically so
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
591 that users can change them are called @dfn{user options}. Ordinary
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
592 variables and user options are described using a format like that for
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
593 functions except that there are no arguments.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
594
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
595 Here is a description of the imaginary user option
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
596 @code{do_what_i_mean_not_what_i_say}.
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
597
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
598 @defvr {User Option} do_what_i_mean_not_what_i_say
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
599 If the value of this variable is nonzero, Octave will do what you
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
600 actually wanted, even if you have typed a completely different and
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
601 meaningless list of commands.
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
602 @end defvr
2333
b1a56412c385 [project @ 1996-07-19 02:20:16 by jwe]
jwe
parents:
diff changeset
603
2653
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
604 Other variable descriptions have the same format, but `User Option' is
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
605 replaced by `Variable', for ordinary variables, or `Constant' for
e7908588548a [project @ 1997-02-01 16:53:52 by jwe]
jwe
parents: 2449
diff changeset
606 symbolic constants whose values cannot be changed.