Mercurial > octave-libgccjit
annotate doc/interpreter/intro.txi @ 17957:e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
* intro.txi: Mention GUI in introduction.
* plot.txi: Update figure root properties.
author | Michael Godfrey <michaeldgodfrey@gmail.com> |
---|---|
date | Sun, 10 Nov 2013 11:06:58 -0500 |
parents | dae2230227a7 |
children |
rev | line source |
---|---|
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17152
diff
changeset
|
1 @c Copyright (C) 1996-2013 John W. Eaton |
7018 | 2 @c |
3 @c This file is part of Octave. | |
4 @c | |
5 @c Octave is free software; you can redistribute it and/or modify it | |
6 @c under the terms of the GNU General Public License as published by the | |
7 @c Free Software Foundation; either version 3 of the License, or (at | |
8 @c your option) any later version. | |
9 @c | |
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT | |
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 @c for more details. | |
14 @c | |
15 @c You should have received a copy of the GNU General Public License | |
16 @c along with Octave; see the file COPYING. If not, see | |
17 @c <http://www.gnu.org/licenses/>. | |
3294 | 18 |
4167 | 19 @node Introduction |
3294 | 20 @chapter A Brief Introduction to Octave |
21 @cindex introduction | |
22 | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
23 GNU Octave is a high-level language, primarily intended for numerical |
17957
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
24 computations. It is typically used for such problems as solving |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
25 linear and nonlinear equations, numerical linear algebra, statistical |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
26 analysis, and for performing other numerical experiments. It may also |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
27 be used as a batch-oriented language for automated data processing. |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
28 |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
29 Until recently GNU Octave provided a command-line interface with |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
30 graphical results displayed in separate windows. The current version |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
31 (version 3.8, released in late 2013) also provides, by default, a |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
32 graphical user interface. |
3294 | 33 |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
34 GNU Octave is freely redistributable software. You may redistribute |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
35 it and/or modify it under the terms of the GNU General Public License |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
36 as published by the Free Software Foundation. The GPL is included in |
17097
e7a059a9a644
doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
37 this manual, @pxref{Copying}. |
3294 | 38 |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
39 This manual provides comprehensive documentation on how to install, |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
40 run, use, and extend GNU Octave. Additional chapters describe how |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
41 to report bugs and help contribute code. |
3294 | 42 |
43 This document corresponds to Octave version @value{VERSION}. | |
44 | |
45 @menu | |
17152
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
46 * Running Octave:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
47 * Simple Examples:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
48 * Conventions:: |
3294 | 49 @end menu |
50 | |
4167 | 51 @node Running Octave |
3294 | 52 @section Running Octave |
53 | |
17957
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
54 On most systems, Octave is started with the shell command @samp{octave}. |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
55 This, by default, starts the graphical user interface (GUI). The central |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
56 window in the GUI is the Octave command-line interface. Octave displays |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
57 an initial message and then a prompt indicating it is ready to accept |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
58 input. If you have chosen the traditional command-line interface only |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
59 the command prompt appears. In any case, you can immediately begin |
e5566719e0a1
doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents:
17757
diff
changeset
|
60 typing Octave commands. |
3294 | 61 |
62 If you get into trouble, you can usually interrupt Octave by typing | |
9033
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
63 @kbd{Control-C} (written @kbd{C-c} for short). @kbd{C-c} gets |
3294 | 64 its name from the fact that you type it by holding down @key{CTRL} and |
65 then pressing @key{c}. Doing this will normally return you to Octave's | |
66 prompt. | |
67 | |
68 @cindex exiting octave | |
69 @cindex quitting octave | |
70 To exit Octave, type @kbd{quit}, or @kbd{exit} at the Octave prompt. | |
71 | |
72 On systems that support job control, you can suspend Octave by sending | |
73 it a @code{SIGTSTP} signal, usually by typing @kbd{C-z}. | |
74 | |
4167 | 75 @node Simple Examples |
3294 | 76 @section Simple Examples |
77 | |
78 The following chapters describe all of Octave's features in detail, but | |
79 before doing that, it might be helpful to give a sampling of some of its | |
80 capabilities. | |
81 | |
82 If you are new to Octave, I recommend that you try these examples to | |
10719
e54152088b0a
Clarify documentation wording. Bug #30165.
Rik <octave@nomad.inbox5.com>
parents:
10668
diff
changeset
|
83 begin learning Octave by using it. Lines marked like so, @samp{octave:13>}, |
3294 | 84 are lines you type, ending each with a carriage return. Octave will |
85 respond with an answer, or by displaying a graph. | |
86 | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
87 @subsection Elementary Calculations |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
88 |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
89 Octave can easily be used for basic numerical calculations. Octave |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
90 knows about arithmetic operations (+,-,*,/), exponentiation (^), |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
91 natural logarithms/exponents (log, exp), and the trigonometric |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
92 functions (sin, cos, @dots{}). Moreover, Octave calculations work |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
93 on real or imaginary numbers (i,j). In addition, some mathematical |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
94 constants such as the base of the natural logarithm (e) and the ratio |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
95 of a circle's circumference to its diameter (pi) are pre-defined. |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
96 |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
97 @noindent |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
98 For example, to verify Euler's Identity, |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
99 @tex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
100 $$e^{\imath\pi} = -1$$ |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
101 @end tex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
102 @ifnottex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
103 @display |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
104 |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
105 i*pi |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
106 e = -1 |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
107 @end display |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
108 @end ifnottex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
109 |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
110 @noindent |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
111 type the following which will evaluate to @code{-1} within the |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
112 tolerance of the calculation. |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
113 |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
114 @example |
14856
c3fd61c59e9c
maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
115 octave:1> exp (i*pi) |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
116 @end example |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
117 |
6623 | 118 @subsection Creating a Matrix |
3294 | 119 |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
120 Vectors and matrices are the basic building blocks for numerical analysis. |
9033
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
121 To create a new matrix and store it in a variable so that you can |
3294 | 122 refer to it later, type the command |
123 | |
124 @example | |
6620 | 125 octave:1> A = [ 1, 1, 2; 3, 5, 8; 13, 21, 34 ] |
3294 | 126 @end example |
127 | |
128 @noindent | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
129 Octave will respond by printing the matrix in neatly aligned columns. |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
130 Octave uses a comma or space to separate entries in a row, and a |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
131 semicolon or carriage return to separate one row from the next. |
9033
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
132 Ending a command with a semicolon tells Octave not to print the result |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
133 of the command. For example, |
3294 | 134 |
135 @example | |
6620 | 136 octave:2> B = rand (3, 2); |
3294 | 137 @end example |
138 | |
139 @noindent | |
140 will create a 3 row, 2 column matrix with each element set to a random | |
141 value between zero and one. | |
142 | |
9033
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
143 To display the value of a variable, simply type the name of the |
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
144 variable at the prompt. For example, to display the value stored in the |
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
145 matrix @code{B}, type the command |
3294 | 146 |
147 @example | |
6620 | 148 octave:3> B |
3294 | 149 @end example |
150 | |
6623 | 151 @subsection Matrix Arithmetic |
3294 | 152 |
153 Octave has a convenient operator notation for performing matrix | |
8476
4998c6c78632
[docs] fix case to match example
Brian Gough <bjg@gnu.org>
parents:
7490
diff
changeset
|
154 arithmetic. For example, to multiply the matrix @code{A} by a scalar |
3294 | 155 value, type the command |
156 | |
157 @example | |
6620 | 158 octave:4> 2 * A |
3294 | 159 @end example |
160 | |
6620 | 161 @noindent |
8476
4998c6c78632
[docs] fix case to match example
Brian Gough <bjg@gnu.org>
parents:
7490
diff
changeset
|
162 To multiply the two matrices @code{A} and @code{B}, type the command |
3294 | 163 |
164 @example | |
6620 | 165 octave:5> A * B |
3294 | 166 @end example |
167 | |
6620 | 168 @noindent |
169 and to form the matrix product | |
3294 | 170 @tex |
6620 | 171 $@code{A}^T@code{A}$, |
3294 | 172 @end tex |
6620 | 173 @ifnottex |
174 @code{transpose (A) * A}, | |
175 @end ifnottex | |
3294 | 176 type the command |
177 | |
178 @example | |
6620 | 179 octave:6> A' * A |
3294 | 180 @end example |
181 | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
182 @subsection Solving Systems of Linear Equations |
3294 | 183 |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
184 Systems of linear equations are ubiquitous in numerical analysis. |
6620 | 185 To solve the set of linear equations @code{A@var{x} = b}, |
3294 | 186 use the left division operator, @samp{\}: |
187 | |
188 @example | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
189 @var{x} = A \ b |
3294 | 190 @end example |
191 | |
192 @noindent | |
193 This is conceptually equivalent to | |
194 @tex | |
6620 | 195 $@code{A}^{-1}@code{b}$, |
3294 | 196 @end tex |
6620 | 197 @ifnottex |
3294 | 198 @code{inv (a) * b}, |
6620 | 199 @end ifnottex |
3294 | 200 but avoids computing the inverse of a matrix directly. |
201 | |
202 If the coefficient matrix is singular, Octave will print a warning | |
203 message and compute a minimum norm solution. | |
204 | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
205 A simple example comes from chemistry and the need to obtain balanced |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
206 chemical equations. Consider the burning of hydrogen and oxygen to |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
207 produce water. |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
208 @tex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
209 $$ {\rm H_{2}} + {\rm O_{2}} \rightarrow {\rm H_{2}O} $$ |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
210 @end tex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
211 @ifnottex |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10719
diff
changeset
|
212 |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
213 @example |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
214 H2 + O2 --> H2O |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
215 @end example |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10719
diff
changeset
|
216 |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
217 @end ifnottex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
218 @noindent |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
219 The equation above is not accurate. The Law of Conservation of Mass requires |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
220 that the number of molecules of each type balance on the left- and right-hand |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
221 sides of the equation. Writing the variable overall reaction with |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
222 individual equations for hydrogen and oxygen one finds: |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
223 @tex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
224 \vbox{ |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
225 $$ x_{1}{\rm H_{2}} + x_{2}{\rm O_{2}} \rightarrow {\rm H_{2}O} $$ |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
226 $$ {\rm H:}\quad 2x_{1} + 0x_{2} \rightarrow 2 $$ |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
227 $$ {\rm O:}\quad 0x_{1} + 2x_{2} \rightarrow 1 $$ |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
228 } |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
229 @end tex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
230 @ifnottex |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10719
diff
changeset
|
231 |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
232 @example |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
233 @group |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
234 x1*H2 + x2*O2 --> H2O |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
235 H: 2*x1 + 0*x2 --> 2 |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
236 O: 0*x1 + 2*x2 --> 1 |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
237 @end group |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
238 @end example |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10719
diff
changeset
|
239 |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
240 @end ifnottex |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
241 @noindent |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
242 The solution in Octave is found in just three steps. |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
243 |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
244 @example |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
245 @group |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
246 octave:1> A = [ 2, 0; 0, 2 ]; |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
247 octave:2> b = [ 2; 1 ]; |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
248 octave:3> x = A \ b |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
249 @end group |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
250 @end example |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
251 |
6623 | 252 @subsection Integrating Differential Equations |
3294 | 253 |
254 Octave has built-in functions for solving nonlinear differential | |
255 equations of the form | |
256 @tex | |
257 $$ | |
258 {dx \over dt} = f(x,t), \qquad x(t=t_0) = x_0 | |
259 $$ | |
260 @end tex | |
6620 | 261 @ifnottex |
3294 | 262 |
263 @example | |
264 @group | |
265 dx | |
266 -- = f (x, t) | |
267 dt | |
268 @end group | |
269 @end example | |
270 | |
271 @noindent | |
272 with the initial condition | |
273 | |
274 @example | |
275 x(t = t0) = x0 | |
276 @end example | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10719
diff
changeset
|
277 |
6620 | 278 @end ifnottex |
3294 | 279 @noindent |
280 For Octave to integrate equations of this form, you must first provide a | |
281 definition of the function | |
282 @tex | |
283 $f (x, t)$. | |
284 @end tex | |
6620 | 285 @ifnottex |
3294 | 286 @code{f(x,t)}. |
6620 | 287 @end ifnottex |
3294 | 288 This is straightforward, and may be accomplished by entering the |
289 function body directly on the command line. For example, the following | |
9033
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
290 commands define the right-hand side function for an interesting pair of |
3294 | 291 nonlinear differential equations. Note that while you are entering a |
292 function, Octave responds with a different prompt, to indicate that it | |
293 is waiting for you to complete your input. | |
294 | |
295 @example | |
296 @group | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
297 octave:1> function xdot = f (x, t) |
3294 | 298 > |
299 > r = 0.25; | |
300 > k = 1.4; | |
301 > a = 1.5; | |
302 > b = 0.16; | |
303 > c = 0.9; | |
304 > d = 0.8; | |
305 > | |
306 > xdot(1) = r*x(1)*(1 - x(1)/k) - a*x(1)*x(2)/(1 + b*x(1)); | |
307 > xdot(2) = c*a*x(1)*x(2)/(1 + b*x(1)) - d*x(2); | |
308 > | |
309 > endfunction | |
310 @end group | |
311 @end example | |
312 | |
313 @noindent | |
314 Given the initial condition | |
315 | |
316 @example | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
317 octave:2> x0 = [1; 2]; |
3294 | 318 @end example |
319 | |
320 @noindent | |
321 and the set of output times as a column vector (note that the first | |
322 output time corresponds to the initial condition given above) | |
323 | |
324 @example | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
325 octave:3> t = linspace (0, 50, 200)'; |
3294 | 326 @end example |
327 | |
328 @noindent | |
329 it is easy to integrate the set of differential equations: | |
330 | |
331 @example | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
332 octave:4> x = lsode ("f", x0, t); |
3294 | 333 @end example |
334 | |
335 @noindent | |
336 The function @code{lsode} uses the Livermore Solver for Ordinary | |
337 Differential Equations, described in A. C. Hindmarsh, @cite{ODEPACK, a | |
338 Systematized Collection of ODE Solvers}, in: Scientific Computing, R. S. | |
339 Stepleman et al. (Eds.), North-Holland, Amsterdam, 1983, pages 55--64. | |
340 | |
6623 | 341 @subsection Producing Graphical Output |
3294 | 342 |
343 To display the solution of the previous example graphically, use the | |
344 command | |
345 | |
346 @example | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
347 octave:1> plot (t, x) |
3294 | 348 @end example |
349 | |
6620 | 350 @noindent |
351 If you are using a graphical user interface, Octave will automatically create | |
6331 | 352 a separate window to display the plot. |
353 | |
6620 | 354 To save a plot once it has been displayed on the screen, use the print |
6331 | 355 command. For example, |
3294 | 356 |
357 @example | |
6331 | 358 print -deps foo.eps |
3294 | 359 @end example |
360 | |
361 @noindent | |
7001 | 362 will create a file called @file{foo.eps} that contains a rendering of |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
363 the current plot in Encapsulated PostScript format. The command |
3294 | 364 |
365 @example | |
6331 | 366 help print |
3294 | 367 @end example |
368 | |
369 @noindent | |
6331 | 370 explains more options for the @code{print} command and provides a list |
6620 | 371 of additional output file formats. |
3294 | 372 |
6623 | 373 @subsection Editing What You Have Typed |
3294 | 374 |
375 At the Octave prompt, you can recall, edit, and reissue previous | |
376 commands using Emacs- or vi-style editing commands. The default | |
377 keybindings use Emacs-style commands. For example, to recall the | |
9033
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
378 previous command, press @kbd{Control-p} (written @kbd{C-p} for |
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
379 short). Doing this will normally bring back the previous line of input. |
6620 | 380 @kbd{C-n} will bring up the next line of input, @kbd{C-b} will move |
381 the cursor backward on the line, @kbd{C-f} will move the cursor forward | |
382 on the line, etc. | |
3294 | 383 |
384 A complete description of the command line editing capability is given | |
17097
e7a059a9a644
doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
385 in this manual, @pxref{Command Line Editing}. |
3294 | 386 |
6623 | 387 @subsection Help and Documentation |
3294 | 388 |
389 Octave has an extensive help facility. The same documentation that is | |
390 available in printed form is also available from the Octave prompt, | |
391 because both forms of the documentation are created from the same input | |
392 file. | |
393 | |
394 In order to get good help you first need to know the name of the command | |
395 that you want to use. This name of the function may not always be | |
12546
39ca02387a32
Improve docstrings for a number of functions.
Rik <octave@nomad.inbox5.com>
parents:
11573
diff
changeset
|
396 obvious, but a good place to start is to type @code{help --list}. |
11565
21c3e1370b82
implement --list option for help function
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
397 This will show you all the operators, keywords, built-in functions, |
21c3e1370b82
implement --list option for help function
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
398 and loadable functions available in the current session of Octave. An |
21c3e1370b82
implement --list option for help function
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
399 alternative is to search the documentation using the @code{lookfor} |
21c3e1370b82
implement --list option for help function
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
400 function. This function is described in @ref{Getting Help}. |
6620 | 401 |
402 Once you know the name of the function you wish to use, you can get more | |
403 help on the function by simply including the name as an argument to help. | |
404 For example, | |
3294 | 405 |
406 @example | |
407 help plot | |
408 @end example | |
409 | |
410 @noindent | |
411 will display the help text for the @code{plot} function. | |
412 | |
413 Octave sends output that is too long to fit on one screen through a | |
414 pager like @code{less} or @code{more}. Type a @key{RET} to advance one | |
415 line, a @key{SPC} to advance one page, and @key{q} to exit the pager. | |
416 | |
417 The part of Octave's help facility that allows you to read the complete | |
418 text of the printed manual from within Octave normally uses a separate | |
419 program called Info. When you invoke Info you will be put into a menu | |
420 driven program that contains the entire Octave manual. Help for using | |
17097
e7a059a9a644
doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
421 Info is provided in this manual, @pxref{Getting Help}. |
3294 | 422 |
4167 | 423 @node Conventions |
3294 | 424 @section Conventions |
425 | |
426 This section explains the notational conventions that are used in this | |
427 manual. You may want to skip this section and refer back to it later. | |
428 | |
429 @menu | |
17152
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
430 * Fonts:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
431 * Evaluation Notation:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
432 * Printing Notation:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
433 * Error Messages:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
434 * Format of Descriptions:: |
3294 | 435 @end menu |
436 | |
4167 | 437 @node Fonts |
3294 | 438 @subsection Fonts |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
439 @cindex documentation fonts |
3294 | 440 |
441 Examples of Octave code appear in this font or form: @code{svd (a)}. | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
442 Names that represent variables or function arguments appear |
3294 | 443 in this font or form: @var{first-number}. Commands that you type at the |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
444 shell prompt appear in this font or form: @samp{octave --no-init-file}. |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
445 Commands that you type at the Octave prompt sometimes appear in this font |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
446 or form: @kbd{foo --bar --baz}. Specific keys on your keyboard appear |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
447 in this font or form: @key{ANY}. |
3294 | 448 |
4167 | 449 @node Evaluation Notation |
3294 | 450 @subsection Evaluation Notation |
451 @cindex evaluation notation | |
452 @cindex documentation notation | |
453 | |
454 In the examples in this manual, results from expressions that you | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10719
diff
changeset
|
455 evaluate are indicated with @samp{@result{}}. For example: |
3294 | 456 |
457 @example | |
458 @group | |
459 sqrt (2) | |
460 @result{} 1.4142 | |
461 @end group | |
462 @end example | |
463 | |
464 @noindent | |
465 You can read this as ``@code{sqrt (2)} evaluates to 1.4142''. | |
466 | |
467 In some cases, matrix values that are returned by expressions are | |
468 displayed like this | |
469 | |
470 @example | |
471 @group | |
472 [1, 2; 3, 4] == [1, 3; 2, 4] | |
473 @result{} [ 1, 0; 0, 1 ] | |
474 @end group | |
475 @end example | |
476 | |
477 @noindent | |
478 and in other cases, they are displayed like this | |
479 | |
480 @example | |
481 @group | |
482 eye (3) | |
483 @result{} 1 0 0 | |
484 0 1 0 | |
485 0 0 1 | |
486 @end group | |
487 @end example | |
488 | |
489 @noindent | |
490 in order to clearly show the structure of the result. | |
491 | |
492 Sometimes to help describe one expression, another expression is | |
493 shown that produces identical results. The exact equivalence of | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
10719
diff
changeset
|
494 expressions is indicated with @samp{@equiv{}}. For example: |
3294 | 495 |
496 @example | |
497 @group | |
498 rot90 ([1, 2; 3, 4], -1) | |
499 @equiv{} | |
500 rot90 ([1, 2; 3, 4], 3) | |
501 @equiv{} | |
502 rot90 ([1, 2; 3, 4], 7) | |
503 @end group | |
504 @end example | |
505 | |
4167 | 506 @node Printing Notation |
3294 | 507 @subsection Printing Notation |
508 @cindex printing notation | |
509 | |
510 Many of the examples in this manual print text when they are | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
511 evaluated. In this manual the printed text resulting from an example |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
512 is indicated by @samp{@print{}}. The value that is returned by |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
513 evaluating the expression is displayed with @samp{@result{}} |
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
514 (@code{1} in the next example) and follows on a separate line. |
3294 | 515 |
516 @example | |
517 @group | |
518 printf ("foo %s\n", "bar") | |
519 @print{} foo bar | |
520 @result{} 1 | |
521 @end group | |
522 @end example | |
523 | |
4167 | 524 @node Error Messages |
3294 | 525 @subsection Error Messages |
526 @cindex error message notation | |
527 | |
528 Some examples signal errors. This normally displays an error message | |
9089
0b08eaf77dd6
Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents:
9033
diff
changeset
|
529 on your terminal. Error messages are shown on a line beginning with |
3294 | 530 @code{error:}. |
531 | |
532 @example | |
533 @group | |
7490 | 534 fieldnames ([1, 2; 3, 4]) |
17757
dae2230227a7
doc: Use double-quote in preference to single quote in code examples.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
535 error: fieldnames: Invalid input argument |
3294 | 536 @end group |
537 @end example | |
538 | |
4167 | 539 @node Format of Descriptions |
3294 | 540 @subsection Format of Descriptions |
541 @cindex description format | |
542 | |
17145
f7fd413dcf4a
doc: Remove subnode on built-in variables which no longer exist.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
543 Functions and commands are described in this manual in a |
3294 | 544 uniform format. The first line of a description contains the name of |
545 the item followed by its arguments, if any. | |
10668
72585f1ca7a2
Replace @ifinfo with @ifnottex.
Rik <octave@nomad.inbox5.com>
parents:
9209
diff
changeset
|
546 @ifnottex |
17145
f7fd413dcf4a
doc: Remove subnode on built-in variables which no longer exist.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
547 The category---function, command, or whatever---appears at the |
3294 | 548 beginning of the line. |
10668
72585f1ca7a2
Replace @ifinfo with @ifnottex.
Rik <octave@nomad.inbox5.com>
parents:
9209
diff
changeset
|
549 @end ifnottex |
3294 | 550 @iftex |
17145
f7fd413dcf4a
doc: Remove subnode on built-in variables which no longer exist.
Rik <rik@octave.org>
parents:
17097
diff
changeset
|
551 The category---function, command, or whatever---is printed next to the |
3294 | 552 right margin. |
553 @end iftex | |
554 The description follows on succeeding lines, sometimes with examples. | |
555 | |
556 @menu | |
17152
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
557 * A Sample Function Description:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
17145
diff
changeset
|
558 * A Sample Command Description:: |
3294 | 559 @end menu |
560 | |
4167 | 561 @node A Sample Function Description |
3294 | 562 @subsubsection A Sample Function Description |
563 @cindex function descriptions | |
564 | |
565 In a function description, the name of the function being described | |
566 appears first. It is followed on the same line by a list of parameters. | |
567 The names used for the parameters are also used in the body of the | |
568 description. | |
569 | |
570 Here is a description of an imaginary function @code{foo}: | |
571 | |
14093
050bc580cb60
doc: Various docstring improvements before 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents:
14034
diff
changeset
|
572 @deftypefn {Function File} {} foo (@var{x}) |
050bc580cb60
doc: Various docstring improvements before 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents:
14034
diff
changeset
|
573 @deftypefnx {Function File} {} foo (@var{x}, @var{y}) |
050bc580cb60
doc: Various docstring improvements before 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents:
14034
diff
changeset
|
574 @deftypefnx {Function File} {} foo (@var{x}, @var{y}, @dots{}) |
3294 | 575 The function @code{foo} subtracts @var{x} from @var{y}, then adds the |
576 remaining arguments to the result. If @var{y} is not supplied, then the | |
577 number 19 is used by default. | |
578 | |
579 @example | |
580 @group | |
581 foo (1, [3, 5], 3, 9) | |
582 @result{} [ 14, 16 ] | |
583 foo (5) | |
584 @result{} 14 | |
585 @end group | |
586 @end example | |
587 | |
588 More generally, | |
589 | |
590 @example | |
591 @group | |
592 foo (@var{w}, @var{x}, @var{y}, @dots{}) | |
593 @equiv{} | |
594 @var{x} - @var{w} + @var{y} + @dots{} | |
595 @end group | |
596 @end example | |
597 @end deftypefn | |
598 | |
599 Any parameter whose name contains the name of a type (e.g., | |
9033
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
600 @var{integer} or @var{matrix}) is expected to be of that |
3294 | 601 type. Parameters named @var{object} may be of any type. Parameters |
602 with other sorts of names (e.g., @var{new_file}) are discussed | |
603 specifically in the description of the function. In some sections, | |
604 features common to parameters of several functions are described at the | |
605 beginning. | |
606 | |
607 Functions in Octave may be defined in several different ways. The | |
7001 | 608 category name for functions may include another name that indicates the |
3294 | 609 way that the function is defined. These additional tags include |
610 | |
611 @table @asis | |
6620 | 612 @item Function File |
613 @cindex function file | |
614 The function described is defined using Octave commands stored in a text | |
615 file. @xref{Function Files}. | |
616 | |
3294 | 617 @item Built-in Function |
618 @cindex built-in function | |
619 The function described is written in a language like C++, C, or Fortran, | |
620 and is part of the compiled Octave binary. | |
621 | |
622 @item Loadable Function | |
623 @cindex loadable function | |
624 The function described is written in a language like C++, C, or Fortran. | |
625 On systems that support dynamic linking of user-supplied functions, it | |
626 may be automatically linked while Octave is running, but only if it is | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
627 needed. @xref{External Code Interface}. |
3294 | 628 |
629 @item Mapping Function | |
630 @cindex mapping function | |
631 The function described works element-by-element for matrix and vector | |
632 arguments. | |
633 @end table | |
634 | |
4167 | 635 @node A Sample Command Description |
3294 | 636 @subsubsection A Sample Command Description |
637 @cindex command descriptions | |
638 | |
639 Command descriptions have a format similar to function descriptions, | |
9033
c7d60ac7a3e6
Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
640 except that the word `Function' is replaced by `Command'. Commands are |
7001 | 641 functions that may be called without surrounding their arguments in |
3294 | 642 parentheses. For example, here is the description for Octave's |
643 @code{cd} command: | |
644 | |
11573
6f8ffe2c6f76
Grammarcheck txi files for 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11565
diff
changeset
|
645 @deftypefn {Command} {} cd dir |
11547 | 646 @deftypefnx {Command} {} chdir dir |
3294 | 647 Change the current working directory to @var{dir}. For example, |
648 @kbd{cd ~/octave} changes the current working directory to | |
649 @file{~/octave}. If the directory does not exist, an error message is | |
650 printed and the working directory is not changed. | |
11547 | 651 @end deftypefn |
3294 | 652 |