annotate doc/interpreter/intro.txi @ 31185:a1145ac2ce9b

Tiff: populated TagID from the C++ map to avoid having two copies * __tiff__.cc (F__tiff_make_tagid__): implemented internal function as initializer for TagID. * Tiff.m: changed the initialization for TagID to use the internal function.
author magedrifaat <magedrifaat@gmail.com>
date Thu, 18 Aug 2022 17:23:43 +0200
parents 796f54d4ddbf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 28159
diff changeset
1 @c Copyright (C) 1996-2022 The Octave Project Developers
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
2 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
3 @c This file is part of Octave.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
4 @c
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
5 @c Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
6 @c under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
7 @c the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
8 @c (at your option) any later version.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
9 @c
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
10 @c Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
11 @c WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
12 @c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 @c GNU General Public License for more details.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
14 @c
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
15 @c You should have received a copy of the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
16 @c along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
17 @c <https://www.gnu.org/licenses/>.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
18
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
19 @node Introduction
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
20 @chapter A Brief Introduction to Octave
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
21 @cindex introduction
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
22
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
23 GNU Octave is a high-level language primarily intended for numerical
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
24 computations. It is typically used for such problems as solving
17957
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
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
29 The current version of Octave executes in a graphical user interface
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
30 (GUI). The GUI hosts an Integrated Development Environment (IDE)
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
31 which includes a code editor with syntax highlighting, built-in
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
32 debugger, documentation browser, as well as the interpreter for the
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
33 language itself. A command-line interface for Octave is also available.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
34
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
35 GNU Octave is freely redistributable software. You may redistribute
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
36 it and/or modify it under the terms of the GNU General Public License
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
37 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
38 this manual, @pxref{Copying}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
39
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
40 This manual provides comprehensive documentation on how to install,
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
41 run, use, and extend GNU Octave. Additional chapters describe how
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
42 to report bugs and help contribute code.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
43
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
44 This document corresponds to Octave version @value{VERSION}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
45
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
46 @menu
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
47 * Running Octave::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
48 * Simple Examples::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
49 * Conventions::
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
50 @end menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
51
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
52 @node Running Octave
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
53 @section Running Octave
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
54
17957
e5566719e0a1 doc: Mention GUI in introduction. Update figure root properties.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17757
diff changeset
55 On most systems, Octave is started with the shell command @samp{octave}.
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
56 This starts the graphical user interface. The central window in the GUI
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
57 is the Octave command-line interface. In this window Octave displays an
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
58 initial message and then a prompt indicating it is ready to accept
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
59 input. If you have chosen the traditional command-line interface then
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
60 only the command prompt appears in the same window that was running
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
61 a shell. In either case, you can immediately begin typing Octave
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
62 commands.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
63
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
64 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
65 @kbd{Control-C} (written @kbd{C-c} for short). @kbd{C-c} gets
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
66 its name from the fact that you type it by holding down @key{CTRL} and
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
67 then pressing @key{c}. Doing this will normally return you to Octave's
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
68 prompt.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
69
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
70 @cindex exiting octave
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
71 @cindex quitting octave
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
72 To exit Octave, type @kbd{quit} or @kbd{exit} at the Octave prompt.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
73
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
74 On systems that support job control, you can suspend Octave by sending
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
75 it a @code{SIGTSTP} signal, usually by typing @kbd{C-z}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
76
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
77 @node Simple Examples
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
78 @section Simple Examples
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
79
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
80 The following chapters describe all of Octave's features in detail, but
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
81 before doing that, it might be helpful to give a sampling of some of its
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
82 capabilities.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
83
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
84 If you are new to Octave, we recommend that you try these examples to
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
85 begin learning Octave by using it. Lines marked like so,
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
86 @samp{octave:13>}, are lines you type, ending each with a carriage
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
87 return. Octave will respond with an answer, or by displaying a graph.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
88
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
89 @subsection Elementary Calculations
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
90
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
91 Octave can easily be used for basic numerical calculations. Octave
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
92 knows about arithmetic operations (+,-,*,/), exponentiation (^),
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
93 natural logarithms/exponents (log, exp), and the trigonometric
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
94 functions (sin, cos, @dots{}). Moreover, Octave calculations work
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
95 on real or imaginary numbers (i,j). In addition, some mathematical
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
96 constants such as the base of the natural logarithm (e) and the ratio
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
97 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
98
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
99 @noindent
21315
ea2c2e08ceda doc: Periodic spellcheck of documentation.
Rik <rik@octave.org>
parents: 20672
diff changeset
100 For example, to verify @nospell{Euler's} Identity,
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
101 @tex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
102 $$e^{\imath\pi} = -1$$
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
103 @end tex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
104 @ifnottex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
105 @display
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
106
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
107 i*pi
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
108 e = -1
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
109 @end display
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
110 @end ifnottex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
111
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
112 @noindent
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
113 type the following which will evaluate to @code{-1} within the
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
114 tolerance of the calculation.
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
115
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
116 @example
14856
c3fd61c59e9c maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
117 octave:1> exp (i*pi)
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
118 @end example
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
119
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6620
diff changeset
120 @subsection Creating a Matrix
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
121
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
122 Vectors and matrices are the basic building blocks for numerical
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
123 analysis. To create a new matrix and store it in a variable so that you
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
124 can refer to it later, type the command
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
125
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
126 @example
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
127 octave:1> A = [ 1, 1, 2; 3, 5, 8; 13, 21, 34 ]
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
128 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
129
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
130 @noindent
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
131 Octave will respond by printing the matrix in neatly aligned columns.
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
132 Octave uses a comma or space to separate entries in a row, and a
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
133 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
134 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
135 of the command. For example,
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
136
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
137 @example
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
138 octave:2> B = rand (3, 2);
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
139 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
140
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
141 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
142 will create a 3 row, 2 column matrix with each element set to a random
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
143 value between zero and one.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
144
9033
c7d60ac7a3e6 Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
145 To display the value of a variable, simply type the name of the
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
146 variable at the prompt. For example, to display the value stored in the
9033
c7d60ac7a3e6 Documentation cleanup of preface and intro
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
147 matrix @code{B}, type the command
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
148
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
149 @example
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
150 octave:3> B
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
151 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
152
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6620
diff changeset
153 @subsection Matrix Arithmetic
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
154
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
155 Octave uses standard mathematical notation with the advantage over
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
156 low-level languages that operators may act on scalars, vector, matrices,
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
157 or N-dimensional arrays. For example, to multiply the matrix @code{A}
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
158 by a scalar value, type the command
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
159
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
160 @example
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
161 octave:4> 2 * A
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
162 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
163
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
164 @noindent
8476
4998c6c78632 [docs] fix case to match example
Brian Gough <bjg@gnu.org>
parents: 7490
diff changeset
165 To multiply the two matrices @code{A} and @code{B}, type the command
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
166
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
167 @example
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
168 octave:5> A * B
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
169 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
170
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
171 @noindent
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
172 and to form the matrix product
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
173 @tex
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
174 $@code{A}^T@code{A}$,
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
175 @end tex
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
176 @ifnottex
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
177 @code{transpose (A) * A},
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
178 @end ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
179 type the command
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
180
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
181 @example
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
182 octave:6> A' * A
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
183 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
184
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
185 @subsection Solving Systems of Linear Equations
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
186
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
187 Systems of linear equations are ubiquitous in numerical analysis.
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
188 To solve the set of linear equations @code{A@var{x} = b},
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
189 use the left division operator, @samp{\}:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
190
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
191 @example
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
192 @var{x} = A \ b
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
193 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
194
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
195 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
196 This is conceptually equivalent to
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
197 @tex
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
198 $@code{A}^{-1}@code{b}$,
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
199 @end tex
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
200 @ifnottex
20672
77b104cad58e intro.txi change a to A to match the previous comments
Doug Stewart <doug.dastew@gmail.com
parents: 20194
diff changeset
201 @code{inv (A) * b},
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
202 @end ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
203 but avoids computing the inverse of a matrix directly.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
204
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
205 If the coefficient matrix is singular, Octave will print a warning
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
206 message and compute a minimum norm solution.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
207
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
208 A simple example comes from chemistry and the need to obtain balanced
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
209 chemical equations. Consider the burning of hydrogen and oxygen to
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
210 produce water.
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
211 @tex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
212 $$ {\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
213 @end tex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
214 @ifnottex
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10719
diff changeset
215
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
216 @example
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
217 H2 + O2 --> H2O
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
218 @end example
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10719
diff changeset
219
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
220 @end ifnottex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
221 @noindent
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
222 The equation above is not accurate. The Law of Conservation of Mass requires
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
223 that the number of molecules of each type balance on the left- and right-hand
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
224 sides of the equation. Writing the variable overall reaction with
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
225 individual equations for hydrogen and oxygen one finds:
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
226 @tex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
227 \vbox{
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
228 $$ 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
229 $$ {\rm H:}\quad 2x_{1} + 0x_{2} \rightarrow 2 $$
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
230 $$ {\rm O:}\quad 0x_{1} + 2x_{2} \rightarrow 1 $$
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
231 }
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
232 @end tex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
233 @ifnottex
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10719
diff changeset
234
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
235 @example
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
236 @group
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
237 x1*H2 + x2*O2 --> H2O
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
238 H: 2*x1 + 0*x2 --> 2
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
239 O: 0*x1 + 2*x2 --> 1
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
240 @end group
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
241 @end example
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10719
diff changeset
242
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
243 @end ifnottex
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
244 @noindent
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
245 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
246
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
247 @example
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
248 @group
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
249 octave:1> A = [ 2, 0; 0, 2 ];
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
250 octave:2> b = [ 2; 1 ];
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
251 octave:3> x = A \ b
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
252 @end group
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
253 @end example
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
254
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6620
diff changeset
255 @subsection Integrating Differential Equations
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
256
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
257 Octave has built-in functions for solving nonlinear differential
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
258 equations of the form
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
259 @tex
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
260 $$
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
261 {dx \over dt} = f(x,t), \qquad x(t=t_0) = x_0
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
262 $$
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
263 @end tex
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
264 @ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
265
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
266 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
267 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
268 dx
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
269 -- = f (x, t)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
270 dt
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
271 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
272 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
273
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
274 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
275 with the initial condition
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
276
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
277 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
278 x(t = t0) = x0
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
279 @end example
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10719
diff changeset
280
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
281 @end ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
282 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
283 For Octave to integrate equations of this form, you must first provide a
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
284 definition of the function
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
285 @tex
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
286 $f (x, t)$.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
287 @end tex
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
288 @ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
289 @code{f(x,t)}.
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
290 @end ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
291 This is straightforward, and may be accomplished by entering the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
292 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
293 commands define the right-hand side function for an interesting pair of
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
294 nonlinear differential equations. Note that while you are entering a
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
295 function, Octave responds with a different prompt, to indicate that it
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
296 is waiting for you to complete your input.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
297
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
298 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
299 @group
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17957
diff changeset
300 octave:1> function xdot = f (x, t)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
301 >
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
302 > r = 0.25;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
303 > k = 1.4;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
304 > a = 1.5;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
305 > b = 0.16;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
306 > c = 0.9;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
307 > d = 0.8;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
308 >
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
309 > xdot(1) = r*x(1)*(1 - x(1)/k) - a*x(1)*x(2)/(1 + b*x(1));
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
310 > xdot(2) = c*a*x(1)*x(2)/(1 + b*x(1)) - d*x(2);
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
311 >
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
312 > endfunction
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
313 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
314 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
315
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
316 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
317 Given the initial condition
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
318
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
319 @example
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
320 octave:2> x0 = [1; 2];
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
321 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
322
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
323 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
324 and the set of output times as a column vector (note that the first
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
325 output time corresponds to the initial condition given above)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
326
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
327 @example
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
328 octave:3> t = linspace (0, 50, 200)';
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
329 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
330
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
331 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
332 it is easy to integrate the set of differential equations:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
333
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
334 @example
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
335 octave:4> x = lsode ("f", x0, t);
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
336 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
337
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
338 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
339 The function @code{lsode} uses the Livermore Solver for Ordinary
19040
0850b5212619 doc: Add @nospell macro around proper names in documentation.
Rik <rik@octave.org>
parents: 17957
diff changeset
340 Differential Equations, described in @nospell{A. C. Hindmarsh},
0850b5212619 doc: Add @nospell macro around proper names in documentation.
Rik <rik@octave.org>
parents: 17957
diff changeset
341 @cite{ODEPACK, a Systematized Collection of ODE Solvers}, in: Scientific
0850b5212619 doc: Add @nospell macro around proper names in documentation.
Rik <rik@octave.org>
parents: 17957
diff changeset
342 Computing, @nospell{R. S. Stepleman} et al. (Eds.), North-Holland, Amsterdam,
0850b5212619 doc: Add @nospell macro around proper names in documentation.
Rik <rik@octave.org>
parents: 17957
diff changeset
343 1983, pages 55--64.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
344
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6620
diff changeset
345 @subsection Producing Graphical Output
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
346
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
347 To display the solution of the previous example graphically, use the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
348 command
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
349
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
350 @example
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
351 octave:1> plot (t, x)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
352 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
353
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
354 @noindent
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
355 Octave will automatically create a separate window to display the plot.
6331
9e3e58d914ca [project @ 2007-02-20 08:00:34 by jwe]
jwe
parents: 5775
diff changeset
356
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
357 To save a plot once it has been displayed on the screen, use the print
6331
9e3e58d914ca [project @ 2007-02-20 08:00:34 by jwe]
jwe
parents: 5775
diff changeset
358 command. For example,
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
359
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
360 @example
28159
54d6f1b5fab2 doc: Simplify print command in Intro chapter of manual.
Rik <rik@octave.org>
parents: 26376
diff changeset
361 print foo.pdf
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
362 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
363
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
364 @noindent
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
365 will create a file called @file{foo.pdf} that contains a rendering of
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
366 the current plot in Portable Document Format. The command
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
367
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
368 @example
6331
9e3e58d914ca [project @ 2007-02-20 08:00:34 by jwe]
jwe
parents: 5775
diff changeset
369 help print
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
370 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
371
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
372 @noindent
6331
9e3e58d914ca [project @ 2007-02-20 08:00:34 by jwe]
jwe
parents: 5775
diff changeset
373 explains more options for the @code{print} command and provides a list
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
374 of additional output file formats.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
375
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6620
diff changeset
376 @subsection Help and Documentation
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
377
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
378 Octave has an extensive help facility. The same documentation that is
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
379 available in printed form is also available from the Octave prompt,
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
380 because both forms of the documentation are created from the same input
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
381 file.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
382
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
383 In order to get good help you first need to know the name of the command
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
384 that you want to use. The name of this function may not always be
12546
39ca02387a32 Improve docstrings for a number of functions.
Rik <octave@nomad.inbox5.com>
parents: 11573
diff changeset
385 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
386 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
387 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
388 alternative is to search the documentation using the @code{lookfor}
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
389 function (described in @ref{Getting Help}).
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
390
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
391 Once you know the name of the function you wish to use, you can get more
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
392 help on the function by simply including the name as an argument to help.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6331
diff changeset
393 For example,
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
394
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
395 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
396 help plot
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
397 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
398
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
399 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
400 will display the help text for the @code{plot} function.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
401
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
402 The part of Octave's help facility that allows you to read the complete
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
403 text of the printed manual from within Octave normally uses a separate
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
404 program called Info. When you invoke Info you will be put into a menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
405 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
406 Info is provided in this manual, @pxref{Getting Help}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
407
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
408 @subsection Editing What You Have Typed
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
409
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
410 At the Octave prompt, you can recall, edit, and reissue previous
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
411 commands using Emacs- or vi-style editing commands. The default
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
412 keybindings use Emacs-style commands. For example, to recall the
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
413 previous command, press @kbd{Control-p} (written @kbd{C-p} for
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
414 short). Doing this will normally bring back the previous line of input.
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
415 @kbd{C-n} will bring up the next line of input, @kbd{C-b} will move
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
416 the cursor backward on the line, @kbd{C-f} will move the cursor forward
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
417 on the line, etc.
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
418
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
419 A complete description of the command line editing capability is given
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
420 in this manual, @pxref{Command Line Editing}.
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
421
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
422 @node Conventions
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
423 @section Conventions
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
424
21315
ea2c2e08ceda doc: Periodic spellcheck of documentation.
Rik <rik@octave.org>
parents: 20672
diff changeset
425 This section explains the notation conventions that are used in this
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
426 manual. You may want to skip this section and refer back to it later.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
427
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
428 @menu
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
429 * Fonts::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
430 * Evaluation Notation::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
431 * Printing Notation::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
432 * Error Messages::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
433 * Format of Descriptions::
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
434 @end menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
435
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
436 @node Fonts
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
437 @subsection Fonts
9089
0b08eaf77dd6 Detailed review of intro.texi
Rik <rdrider0-list@yahoo.com>
parents: 9033
diff changeset
438 @cindex documentation fonts
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
439
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
440 Examples of Octave code appear in this font or form: @w{@code{svd (a)}}.
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
441 Names that represent variables or function arguments appear in this font
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
442 or form: @var{first-number}. Commands that you type at the shell prompt
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
443 appear in this font or form: @w{@samp{octave --no-init-file}}. Commands
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
444 that you type at the Octave prompt sometimes appear in this font or
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
445 form: @w{@kbd{foo --bar --baz}}. Specific keys on your keyboard appear
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
446 in this font or form: @key{RET}.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
447
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
448 @node Evaluation Notation
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
449 @subsection Evaluation Notation
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
450 @cindex evaluation notation
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
451 @cindex documentation notation
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
452
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
453 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
454 evaluate are indicated with @samp{@result{}}. For example:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
455
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
456 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
457 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
458 sqrt (2)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
459 @result{} 1.4142
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
460 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
461 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
462
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
463 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
464 You can read this as ``@code{sqrt (2)} evaluates to 1.4142''.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
465
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
466 In some cases, matrix values that are returned by expressions are
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
467 displayed like this
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
468
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
469 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
470 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
471 [1, 2; 3, 4] == [1, 3; 2, 4]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
472 @result{} [ 1, 0; 0, 1 ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
473 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
474 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
475
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
476 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
477 and in other cases, they are displayed like this
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
478
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
479 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
480 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
481 eye (3)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
482 @result{} 1 0 0
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
483 0 1 0
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
484 0 0 1
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
485 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
486 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
487
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
488 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
489 in order to clearly show the structure of the result.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
490
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
491 Sometimes to help describe one expression, another expression is shown
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
492 that produces identical results. The exact equivalence of expressions
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
493 is indicated with @samp{@equiv{}}. For example:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
494
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
495 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
496 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
497 rot90 ([1, 2; 3, 4], -1)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
498 @equiv{}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
499 rot90 ([1, 2; 3, 4], 3)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
500 @equiv{}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
501 rot90 ([1, 2; 3, 4], 7)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
502 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
503 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
504
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
505 @node Printing Notation
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
506 @subsection Printing Notation
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
507 @cindex printing notation
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
508
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
509 Many of the examples in this manual print text when they are evaluated.
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
510 In this manual the printed text resulting from an example is indicated
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
511 by @samp{@print{}}. The value that is returned by evaluating the
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
512 expression is displayed with @samp{@result{}} (@code{1} in the next
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
513 example) and follows on a separate line.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
514
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
515 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
516 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
517 printf ("foo %s\n", "bar")
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
518 @print{} foo bar
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
519 @result{} 1
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
520 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
521 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
522
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
523 @node Error Messages
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
524 @subsection Error Messages
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
525 @cindex error message notation
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
526
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
527 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
528 on your terminal. Error messages are shown on a line beginning with
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
529 @code{error:}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
530
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
531 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
532 @group
7490
0b1521bc9afa doc fix
Ben Abbott
parents: 7018
diff changeset
533 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
534 error: fieldnames: Invalid input argument
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
535 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
536 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
537
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
538 @node Format of Descriptions
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
539 @subsection Format of Descriptions
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
540 @cindex description format
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
541
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
542 Functions and commands are described in this manual in a uniform format.
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
543 The first line of a description contains the name of the item followed
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
544 by its arguments, if any. If there are multiple ways to invoke the
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
545 function then each allowable form is listed.
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
546
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
547 The description follows on succeeding lines, sometimes with examples.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
548
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
549 @menu
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
550 * A Sample Function Description::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17145
diff changeset
551 * A Sample Command Description::
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
552 @end menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
553
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
554 @node A Sample Function Description
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
555 @subsubsection A Sample Function Description
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
556 @cindex function descriptions
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
557
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
558 In a function description, the name of the function being described
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
559 appears first. It is followed on the same line by a list of parameters.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
560 The names used for the parameters are also used in the body of the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
561 description.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
562
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
563 After all of the calling forms have been enumerated, the next line is a
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
564 concise one-sentence summary of the function.
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
565
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
566 After the summary there may be documentation on the inputs and outputs,
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
567 examples of function usage, notes about the algorithm used, and references
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
568 to related functions.
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
569
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
570 Here is a description of an imaginary function @code{foo}:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
571
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
572 @need 4000
21319
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 21315
diff changeset
573 @deftypefn {} {} foo (@var{x})
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 21315
diff changeset
574 @deftypefnx {} {} foo (@var{x}, @var{y})
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 21315
diff changeset
575 @deftypefnx {} {} foo (@var{x}, @var{y}, @dots{})
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
576 Subtract @var{x} from @var{y}, then add any remaining arguments to the
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
577 result.
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
578
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
579 The input @var{x} must be a numeric scalar, vector, or array.
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
580
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
581 The optional input @var{y} defaults to 19 if it is not supplied.
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
582
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
583 Example:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
584
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
585 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
586 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
587 foo (1, [3, 5], 3, 9)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
588 @result{} [ 14, 16 ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
589 foo (5)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
590 @result{} 14
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
591 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
592 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
593
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
594 More generally,
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
595
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
596 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
597 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
598 foo (@var{w}, @var{x}, @var{y}, @dots{})
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
599 @equiv{}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
600 @var{x} - @var{w} + @var{y} + @dots{}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
601 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
602 @end example
20194
b0f7ee81d974 doc: Remove extra spaces at start of docstring which show up in Info format.
Rik <rik@octave.org>
parents: 20177
diff changeset
603
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
604 @b{See also:} bar
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
605 @end deftypefn
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
606
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
607 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
608 @var{integer} or @var{matrix}) is expected to be of that
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
609 type. Parameters named @var{object} may be of any type. Parameters
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
610 with other sorts of names (e.g., @var{new_file}) are discussed
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
611 specifically in the description of the function. In some sections,
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
612 features common to parameters of several functions are described at the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
613 beginning.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
614
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3730
diff changeset
615 @node A Sample Command Description
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
616 @subsubsection A Sample Command Description
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
617 @cindex command descriptions
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
618
21531
32101a071a9c doc: Remove Function Category from documentation about function descriptions.
Rik <rik@octave.org>
parents: 21319
diff changeset
619 Commands are functions that may be called without surrounding their arguments
32101a071a9c doc: Remove Function Category from documentation about function descriptions.
Rik <rik@octave.org>
parents: 21319
diff changeset
620 in parentheses. Command descriptions have a format similar to function
32101a071a9c doc: Remove Function Category from documentation about function descriptions.
Rik <rik@octave.org>
parents: 21319
diff changeset
621 descriptions. For example, here is the description for Octave's @code{diary}
32101a071a9c doc: Remove Function Category from documentation about function descriptions.
Rik <rik@octave.org>
parents: 21319
diff changeset
622 command:
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
623
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
624 @need 4000
21319
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 21315
diff changeset
625 @deftypefn {} {} diary
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 21315
diff changeset
626 @deftypefnx {} {} diary on
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 21315
diff changeset
627 @deftypefnx {} {} diary off
8880d93010d8 Remove further uses of CLASS field in @deftypefn macro.
Rik <rik@octave.org>
parents: 21315
diff changeset
628 @deftypefnx {} {} diary @var{filename}
22854
e3e52ba95250 doc: Update Introduction chapter to use newest version of diary() Texinfo.
Rik <rik@octave.org>
parents: 22853
diff changeset
629 @deftypefnx {} {[@var{status}, @var{diaryfile}] =} diary
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
630 Record a list of all commands @emph{and} the output they produce, mixed
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
631 together just as they appear on the terminal.
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
632
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
633 Valid options are:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
634
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
635 @table @asis
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
636 @item on
22854
e3e52ba95250 doc: Update Introduction chapter to use newest version of diary() Texinfo.
Rik <rik@octave.org>
parents: 22853
diff changeset
637 Start recording a session in a file called @file{diary} in the current working
e3e52ba95250 doc: Update Introduction chapter to use newest version of diary() Texinfo.
Rik <rik@octave.org>
parents: 22853
diff changeset
638 directory.
20177
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
639
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
640 @item off
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
641 Stop recording the session in the diary file.
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
642
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
643 @item @var{filename}
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
644 Record the session in the file named @var{filename}.
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
645 @end table
4951982f8a2c intro.txi: Improve documentation in introductory chapter.
Rik <rik@octave.org>
parents: 19697
diff changeset
646
22854
e3e52ba95250 doc: Update Introduction chapter to use newest version of diary() Texinfo.
Rik <rik@octave.org>
parents: 22853
diff changeset
647 With no input or output arguments, @code{diary} toggles the current diary
e3e52ba95250 doc: Update Introduction chapter to use newest version of diary() Texinfo.
Rik <rik@octave.org>
parents: 22853
diff changeset
648 state.
e3e52ba95250 doc: Update Introduction chapter to use newest version of diary() Texinfo.
Rik <rik@octave.org>
parents: 22853
diff changeset
649
e3e52ba95250 doc: Update Introduction chapter to use newest version of diary() Texinfo.
Rik <rik@octave.org>
parents: 22853
diff changeset
650 If output arguments are requested, @code{diary} ignores inputs and returns
e3e52ba95250 doc: Update Introduction chapter to use newest version of diary() Texinfo.
Rik <rik@octave.org>
parents: 22853
diff changeset
651 the current status. The boolean @var{status} indicates whether recording is on
e3e52ba95250 doc: Update Introduction chapter to use newest version of diary() Texinfo.
Rik <rik@octave.org>
parents: 22853
diff changeset
652 or off, and @var{diaryfile} is the name of the file where the session is
22910
23847979b91e maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 22854
diff changeset
653 stored.
22852
efdb5d9dface doc: Rewrite parts of Introduction chapter.
Rik <rik@octave.org>
parents: 22323
diff changeset
654 @seealso{history, evalc}
11547
e1851653d59c Eliminate @deffn macros.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
655 @end deftypefn