2333
|
1 % refcard.tex |
|
2 % |
|
3 % This file is TeX source for a reference card describing Octave. |
|
4 % |
|
5 % John W. Eaton |
|
6 % jwe@che.utexas.edu |
|
7 % Department of Chemical Engineering |
|
8 % The University of Texas at Austin |
|
9 % |
|
10 % Heavily modified by jwe from the source for the gdb reference card, |
|
11 % which was orignally written by Roland Pesch <pesch@cygnus.com>. |
|
12 % |
|
13 % Copyright (C) 1991, 1992 Free Software Foundation, Inc. |
|
14 % Permission is granted to make and distribute verbatim copies of |
|
15 % this reference provided the copyright notices and permission notices |
|
16 % are preserved on all copies. |
|
17 % |
|
18 % TeX markup is a programming language; accordingly this file is source |
|
19 % for a program to generate a reference. |
|
20 % |
7016
|
21 % This file is part of Octave. |
|
22 % |
|
23 % Octave is free software; you can redistribute it and/or modify it |
|
24 % under the terms of the GNU General Public License as published by the |
|
25 % Free Software Foundation; either version 3 of the License, or (at your |
|
26 % option) any later version. |
2333
|
27 % |
7016
|
28 % Octave is distributed in the hope that it will be useful, but WITHOUT |
|
29 % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
30 % FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
31 % for more details. |
2333
|
32 % |
7016
|
33 % You should have received a copy of the GNU General Public License |
|
34 % along with Octave; see the file COPYING. If not, see |
|
35 % <http://www.gnu.org/licenses/>. |
2333
|
36 % |
|
37 % You only have to set the total width and height of the paper, the |
|
38 % horizontal and vertical margin space measured from *paper edge* |
|
39 % and the interline and interspec spacing. |
|
40 % In order to support a new papersize, you have to fiddle with the |
|
41 % latter four dimensions. Just try out a few values. |
|
42 % All other values will be computed at process time so it should be |
|
43 % quite easy to support different paper sizes - only four values to |
|
44 % guess :-) |
|
45 % |
|
46 % To find the configuration places, just search for the string |
|
47 % "User configuration". |
|
48 % |
|
49 % -- Andreas Vogel (av@ssw.de) |
|
50 % |
|
51 % NOTE ON INTENTIONAL OMISSIONS: This reference card includes many |
|
52 % Octave commands, but due to space constraints there are some things |
|
53 % I chose to omit. In general, not all synonyms for commands are |
|
54 % covered, nor all variations of a command. |
|
55 |
|
56 \def\octaveversion{1.1.1} |
|
57 \def\refcardedition{1.1} |
|
58 |
|
59 % ------------------ |
|
60 % multicolumn format |
|
61 % ------------------ |
|
62 |
|
63 % Declarations (these must come first) |
|
64 |
|
65 \newdimen\totalwidth |
|
66 \newdimen\totalheight |
|
67 \newdimen\hmargin |
|
68 \newdimen\vmargin |
|
69 \newdimen\secskip |
|
70 \newdimen\lskip |
|
71 \newdimen\barwidth |
|
72 \newdimen\barheight |
|
73 \newdimen\intersecwidth |
|
74 |
|
75 \newcount\columnsperpage |
|
76 |
|
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
78 % % |
|
79 % CONFIGURATION % |
|
80 % % |
|
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
82 |
|
83 % There are currently 8 total columns, so some of these options will |
|
84 % not create a single page reference card. |
|
85 |
|
86 % Choose a paper size. Default is US letter size. |
|
87 |
|
88 \def\refcardafoursize{a4} % 3 columns, A4 paper (1 in = 254 mm) |
|
89 \def\refcardlegalsize{legal} % 4 columns, US legal paper (8.5 x 14in) |
4893
|
90 \def\refcardlettersize{letter} % 3 columns, US letter paper (8.5 x 11in) |
2333
|
91 |
|
92 \ifx\refcardsize\refcardafoursize |
|
93 \columnsperpage=3 % total number of columns to typeset |
|
94 \totalwidth=297mm % total width of paper |
|
95 \totalheight=210mm % total height of paper |
|
96 \hmargin=9mm % horizontal margin width |
|
97 \vmargin=7mm % vertical margin width |
|
98 \secskip=3mm % space between refcard secs |
|
99 \lskip=0.4mm % extra skip between \sec entries |
|
100 \else |
|
101 \ifx\refcardsize\refcardlegalsize |
|
102 \columnsperpage=4 % total number of columns to typeset |
|
103 \totalwidth=14in % total width of paper |
|
104 \totalheight=8.5in % total height of paper |
|
105 \hmargin=0.20in % horizontal margin width |
|
106 \vmargin=0.25in % vertical margin width |
|
107 \secskip=0.75pc % space between refcard secs |
|
108 \lskip=2pt % extra skip between \sec entries |
|
109 \else |
|
110 \columnsperpage=3 % total number of columns to typeset |
|
111 \totalwidth=11in % total width of paper |
|
112 \totalheight=8.5in % total height of paper |
|
113 \hmargin=0.25in % horizontal margin width |
|
114 \vmargin=0.25in % vertical margin width |
|
115 \secskip=0.75pc % space between refcard secs |
|
116 \lskip=2pt % extra skip between \sec entries |
|
117 \fi |
|
118 \fi |
|
119 |
4489
|
120 \ifx\pdfoutput\undefined |
|
121 \else |
|
122 \pdfpageheight=\totalheight |
4866
|
123 \pdfpagewidth=\totalwidth |
4489
|
124 \fi |
|
125 |
2333
|
126 % Change according to personal taste, not papersize dependent. |
|
127 |
|
128 \barwidth=.1pt % width of the cropmark bar |
|
129 \barheight=2pt % height of the cropmark bar |
|
130 \intersecwidth=0.5em % width between \itmwid and \dfnwid |
|
131 |
|
132 % Uncomment only one of the following definitions for folding guides. |
|
133 |
|
134 % No printed folding guide: |
|
135 |
|
136 %\def\vdecor{\hskip\hmargin plus1fil |
|
137 % \hskip\barwidth plus1fil |
|
138 % \hskip\hmargin plus1fil} |
|
139 |
|
140 % Solid line folding guide: |
|
141 |
|
142 %\def\vdecor{\hskip\hmargin plus1fil% |
|
143 % \vrule width \barwidth% |
|
144 % \hskip\hmargin plus1fil} |
|
145 |
|
146 % For small marks near top and bottom as folding guide: |
|
147 |
|
148 \def\vdecor{\hskip\hmargin plus1fil% |
|
149 \vbox to \vsize{\hbox to \barwidth{\vrule height\barheight width\barwidth}% |
|
150 \vfill |
|
151 \hbox to \barwidth{\vrule height\barheight width\barwidth}}% |
|
152 \hskip\hmargin plus1fil} |
|
153 |
|
154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
155 % % |
|
156 % END CONFIGURATION % |
|
157 % % |
|
158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
159 |
|
160 % values to be computed based on above definitions. |
|
161 % nothing to configure |
|
162 |
|
163 \newdimen\fullhsize % width of area without margins |
|
164 \newdimen\itmwid % width of item column |
|
165 \newdimen\dfnwid % width of definition column |
|
166 \newdimen\idnwid % width of indented text |
|
167 \newdimen\temp % only for temporary use |
|
168 |
|
169 % an alternate section format, used in some cases to make text fit better. |
|
170 |
|
171 \newdimen\altitmwid % width of item column in altsec |
|
172 \newdimen\altdfnwid % width of definition column in altsec |
|
173 |
|
174 % Subtract hmargin for left and right sides of paper from full width. |
|
175 % |
|
176 % fullhsize = totalwidth - (2 * hmargin) |
|
177 |
|
178 \fullhsize=\totalwidth |
|
179 \temp=\hmargin |
|
180 \multiply \temp by 2 |
|
181 \advance \fullhsize by -\temp |
|
182 |
|
183 % intercolumn space is composed of hmargin barwidth hmargin so that we |
|
184 % get the same amount of space on either side of the (optional) rule |
|
185 % between columns. For N columns, we need to subtract this amount of |
|
186 % space N-1 times. Divide by the number of columns to get the final |
|
187 % value of \hsize that we use to typeset columns. |
|
188 |
|
189 % hsize = (fullhsize - (ncols-1)*barwidth - 2*(ncols-1)*hmargin) / ncols |
|
190 |
|
191 \newcount\tmpcnt |
|
192 \tmpcnt\columnsperpage |
|
193 \advance \tmpcnt by -1 |
|
194 |
|
195 \hsize=\fullhsize |
|
196 |
|
197 \temp=\barwidth |
|
198 \multiply \temp by \tmpcnt |
|
199 \advance \hsize by -\temp |
|
200 |
|
201 \multiply \tmpcnt by 2 |
|
202 |
|
203 \temp=\hmargin |
|
204 \multiply \temp by \tmpcnt |
|
205 \advance \hsize by -\temp |
|
206 |
|
207 \divide \hsize by \columnsperpage |
|
208 |
|
209 % Vertical size is easy -- same amount of space above and below. |
|
210 % |
|
211 % vsize = totalheight - (2 * vmargin) |
|
212 |
|
213 \vsize=\totalheight |
|
214 \temp=\vmargin |
|
215 \multiply \temp by 2 |
|
216 \advance \vsize by -\temp |
|
217 |
|
218 % adjust the offsets so the margins are measured *from paper edge* |
|
219 |
|
220 \hoffset=-1in \advance \hoffset by \hmargin |
|
221 \voffset=-1in \advance \voffset by \vmargin |
|
222 |
|
223 % Width of items in a section. |
|
224 |
|
225 % itmwid = (hsize - intersecwidth) * 1/3 |
|
226 % dfnwid = (hsize - intersecwidth) * 2/3 |
|
227 |
|
228 % width of the item |
|
229 |
|
230 \temp=\hsize |
|
231 \advance \temp by -\intersecwidth |
|
232 \divide \temp by 3 |
|
233 \itmwid=\temp |
|
234 |
|
235 % width of the corresponding definition |
|
236 |
|
237 \dfnwid=\hsize |
|
238 \advance \dfnwid by -\itmwid |
|
239 |
|
240 % indentation for sub items, etc. |
|
241 |
|
242 \temp=\hsize \advance\temp by -1em |
|
243 \idnwid=\temp |
|
244 |
|
245 % Width of items in an alt section. |
|
246 |
|
247 \altitmwid=\itmwid \advance \altitmwid by 0.35in |
|
248 \altdfnwid=\dfnwid \advance \altdfnwid by -0.35in |
|
249 |
|
250 % Output macros. |
|
251 % |
|
252 % Strategy: |
|
253 % |
|
254 % * set each column in a box |
|
255 % * append new columns in a global `holding' box, inserting |
|
256 % intercolumn decorations as necessary. |
|
257 % * when we fill a page, dump the saved box and the latest column, |
|
258 % separated by the intercolumn decoration. |
|
259 |
|
260 \newbox\holdbox |
|
261 \newcount\colno |
|
262 \colno=0 |
|
263 |
|
264 \output={\relax |
|
265 \global\advance\colno by 1 |
|
266 \ifnum\colno=1 |
|
267 \global\setbox\holdbox=\columnbox |
|
268 \else |
|
269 \ifnum\colno=\columnsperpage |
|
270 \shipout\hbox to \fullhsize{\box\holdbox\vdecor\columnbox} |
|
271 \advancepageno |
|
272 \global\colno=0 |
|
273 \else |
|
274 \global\setbox\holdbox=\vbox{\hbox{\box\holdbox\vdecor\columnbox}} |
|
275 \fi |
|
276 \fi} |
|
277 |
|
278 \def\columnbox{\leftline{\pagebody}} |
|
279 |
|
280 \def\bye{\par\vfill |
|
281 \supereject |
|
282 \if R\lcr \null\vfill\eject \fi |
|
283 \end} |
|
284 |
|
285 % ----- |
|
286 % Fonts |
|
287 % ----- |
|
288 |
|
289 \font\bbf=cmbx10 |
|
290 \font\vbbf=cmbx12 |
|
291 \font\smrm=cmr6 |
|
292 \font\brm=cmr10 |
|
293 \font\rm=cmr7 |
|
294 \font\it=cmti7 |
|
295 \font\tt=cmtt8 |
|
296 |
|
297 % We can afford to allow some slop |
|
298 |
|
299 \hfuzz=1pt |
|
300 \vfuzz=1pt |
|
301 \hyphenpenalty=5000 |
|
302 \tolerance=2000 |
|
303 \raggedright |
|
304 \raggedbottom |
|
305 \normalbaselineskip=9pt |
|
306 \baselineskip=9pt |
|
307 |
|
308 \parindent=0pt |
|
309 \parskip=0pt |
|
310 \footline={\vbox to0pt{\hss}} |
|
311 |
|
312 \def\ctl#1{{\tt C-#1}} |
|
313 \def\opt#1{{\brm[{\rm #1}]}} |
|
314 \def\xtra#1{\noalign{\smallskip{\tt#1}}} |
|
315 |
|
316 % A normal section |
|
317 |
|
318 \long\def\sec#1;#2\endsec{\vskip \secskip |
|
319 \halign{% |
|
320 % |
|
321 % column 1 (of halign): |
|
322 % |
|
323 \vtop{\hsize=\itmwid\tt ##\par\vskip \lskip }\hfil |
|
324 % |
|
325 % column 2 (of halign): |
|
326 % |
|
327 &\vtop{% |
|
328 \hsize=\dfnwid |
|
329 \hangafter=1 |
|
330 \hangindent=\intersecwidth |
|
331 \rm ##\par\vskip \lskip}\cr |
|
332 % |
|
333 % Tail of \long\def fills in halign body with \sec args: |
|
334 % |
|
335 \noalign{{\bbf #1}% |
|
336 \vskip \lskip} |
|
337 #2}} |
|
338 |
|
339 \long\def\widesec#1;#2\endsec{\vskip \secskip |
|
340 \halign{% |
|
341 % |
|
342 % column 1 (of halign): |
|
343 % |
|
344 \vbox{\tt |
|
345 ##\par\vskip \lskip }\cr |
|
346 % |
|
347 % Tail of \long\def fills in halign body with \sec args: |
|
348 % |
|
349 \noalign{{\bbf #1}\vskip 3\lskip} |
|
350 #2}} |
|
351 |
|
352 % an alternate section format, used in some cases to make text fit better. |
|
353 |
|
354 \long\def\altsec#1;#2\endsec{\vskip \secskip |
|
355 \halign{% |
|
356 % |
|
357 % column 1 (of halign): |
|
358 % |
|
359 \vtop{\hsize=\altitmwid\tt |
|
360 ##\par\vskip \lskip}\hfil |
|
361 % |
|
362 % column 2 (of halign): |
|
363 % |
|
364 &\vtop{% |
|
365 \hsize=\altdfnwid |
|
366 \hangafter=1 |
|
367 \hangindent=\intersecwidth |
|
368 \rm ##\par\vskip \lskip}\cr |
|
369 % |
|
370 % Tail of \long\def fills in halign body with \sec args: |
|
371 % |
|
372 \noalign{{\bbf #1}\vskip \lskip} |
|
373 #2}} |
|
374 |
|
375 % ------------------------------------- |
|
376 % The actual text of the reference card |
|
377 % ------------------------------------- |
|
378 |
|
379 {\vbbf Octave Quick Reference}\hfil{\smrm Octave Version \octaveversion}\qquad |
|
380 |
|
381 \sec Starting Octave; |
|
382 octave&start interactive Octave session\cr |
|
383 octave {\it file}&run Octave on commands in {\it file}\cr |
|
384 octave --help&describe command line options\cr |
|
385 \endsec |
|
386 |
|
387 \sec Stopping Octave; |
|
388 quit {\rm or} exit&exit Octave\cr |
|
389 INTERRUPT&({\it e.g.} \ctl{c}) terminate current command and return to |
|
390 top-level prompt\cr |
|
391 \endsec |
|
392 |
|
393 \sec Getting Help; |
|
394 help&list all commands and built-in variables\cr |
|
395 help {\it command}&briefly describe {\it command}\cr |
|
396 help -i&use Info to browse Octave manual\cr |
|
397 help -i {\it command}&search for {\it command\/} in Octave manual\cr |
|
398 \endsec |
|
399 |
|
400 \sec Motion in Info; |
|
401 SPC {\rm or} C-v&scroll forward one screenful\cr |
|
402 DEL {\rm or} M-v&scroll backward one screenful\cr |
|
403 C-l&redraw the display\cr |
|
404 \endsec |
|
405 |
|
406 \sec Node Selection in Info; |
|
407 n&select the next node\cr |
|
408 p&select the previous node\cr |
|
409 u&select the `up' node\cr |
|
410 t&select the `top' node\cr |
|
411 d&select the directory node\cr |
|
412 <&select the first node in the current file\cr |
|
413 >&select the last node in the current file\cr |
|
414 % ]&move forward through the node structure\cr |
|
415 % [&move backward through the nodes\cr |
|
416 g&reads the name of a node and selects it\cr |
|
417 C-x k&kills the current node\cr |
|
418 \endsec |
|
419 |
|
420 \sec Searching in Info; |
|
421 s&search for a string\cr |
|
422 C-s&search forward incrementally\cr |
|
423 C-r&search backward incrementally\cr |
|
424 i&search index \& go to corresponding node\cr |
|
425 ,&go to next match from last `i' command\cr |
|
426 \endsec |
|
427 |
|
428 \sec Command-Line Cursor Motion; |
|
429 C-b&move back one character\cr |
|
430 C-f&move forward one character\cr |
6653
|
431 C-a&move to the start of the line\cr |
2333
|
432 C-e&move to the end of the line\cr |
|
433 M-f&move forward a word\cr |
|
434 M-b&move backward a word\cr |
|
435 C-l&clear screen, reprinting current line at top\cr |
|
436 \endsec |
|
437 |
|
438 \sec Inserting or Changing Text; |
|
439 M-TAB&insert a tab character\cr |
|
440 DEL&delete character to the left of the cursor\cr |
|
441 C-d&delete character under the cursor\cr |
|
442 C-v&add the next character verbatim\cr |
|
443 C-t&transpose characters at the point\cr |
|
444 M-t&transpose words at the point\cr |
|
445 % M-u&uppercase the current word\cr |
|
446 % M-l&lowercase the current word\cr |
|
447 % M-c&capitalize the current word\cr |
|
448 \endsec |
|
449 |
|
450 \vfill |
|
451 \line{\smrm \opt{ } surround optional arguments |
|
452 \hfill ... show one or more arguments} |
|
453 \vskip0.25\baselineskip |
2847
|
454 \centerline{\smrm Copyright 1996, 1997 John W. Eaton\qquad Permissions on back} |
2333
|
455 \eject |
|
456 |
|
457 \sec Killing and Yanking; |
|
458 C-k&kill to the end of the line\cr |
|
459 C-y&yank the most recently killed text\cr |
|
460 M-d&kill to the end of the current word\cr |
|
461 M-DEL&kill the word behind the cursor\cr |
|
462 M-y&rotate the kill ring and yank the new top\cr |
|
463 \endsec |
|
464 |
|
465 \sec Command Completion and History; |
|
466 TAB&complete a command or variable name\cr |
|
467 M-?&list possible completions\cr |
|
468 |
|
469 RET&enter the current line \cr |
|
470 C-p&move `up' through the history list\cr |
|
471 C-n&move `down' through the history list\cr |
|
472 M-<&move to the first line in the history\cr |
|
473 M->&move to the last line in the history\cr |
|
474 C-r&search backward in the history list\cr |
|
475 C-s&search forward in the history list\cr |
|
476 |
|
477 history \opt{{-q}} \opt{{\it N\/}}&list {\it N\/} previous history lines, |
|
478 omitting history numbers if {\tt -q}\cr |
|
479 history -w \opt{{\it file}}&write history to {\it file\/} ({\tt |
|
480 \char'0176/.octave\_hist} if no {\it file\/} argument)\cr |
|
481 history -r \opt{{\it file}}&read history from {\it file\/} ({\tt |
|
482 \char'0176/.octave\_hist} if no {\it file\/} argument)\cr |
|
483 |
|
484 edit\_history {\it lines}&edit and then run previous |
|
485 commands from the history list\cr |
|
486 run\_history {\it lines}&run previous commands from the |
|
487 history list\cr |
|
488 \quad\opt{{\it beg\/}} \opt{{\it end\/}}&Specify the first and last |
|
489 history commands to edit or run.\cr |
|
490 \omit\hfill\vbox{\hsize=\idnwid\rm\vskip0.25ex |
|
491 If {\it beg}\/ is greater than {\it end}, |
|
492 reverse the list of commands before editing. If {\it end\/} is |
|
493 omitted, select commands from {\it beg\/} to the end of the history |
|
494 list. If both arguments are omitted, edit the previous item in the |
|
495 history list.}\span\cr |
|
496 \endsec |
|
497 |
|
498 \sec Shell Commands; |
|
499 cd {\it dir}&change working directory to {\it dir}\cr |
|
500 pwd&print working directory\cr |
|
501 ls \opt{{\it options}}&print directory listing\cr |
|
502 getenv ({\it string})&return value of named environment variable\cr |
|
503 system ({\it cmd})&execute arbitrary shell command string\cr |
|
504 \endsec |
|
505 |
|
506 \sec Matrices; |
|
507 \omit\vbox{\rm\vskip0.25ex |
|
508 Square brackets delimit literal matrices. Commas separate elements |
|
509 on the same row. Semicolons separate rows. Commas may be replaced |
|
510 by spaces, and semicolons may be replaced by one or more newlines. |
|
511 Elements of a matrix may be arbitrary expressions, provided that |
|
512 all the dimensions agree.\vskip0.75ex}\span\cr |
|
513 [ {\it x}, {\it y}, ... ]&enter a row vector\cr |
|
514 [ {\it x}; {\it y}; ... ]&enter a column vector\cr |
|
515 [ {\it w}, {\it x}; {\it y}, {\it z} ]&enter a 2$\times$2 matrix\cr |
|
516 \endsec |
|
517 |
|
518 \sec Ranges; |
|
519 {\it base} : {\it limit}\cr |
|
520 {\it base} : {\it incr} : {\it limit}\cr |
|
521 \omit\hfill\vbox{\hsize=\idnwid\rm\vskip0.75ex |
|
522 Specify a range of values beginning with {\it base\/} with no elements |
|
523 greater than {\it limit}. If it is omitted, the default value of |
|
524 {\it incr\/} is 1. Negative increments are permitted.}\span\cr |
|
525 \endsec |
|
526 |
|
527 \vfill\eject |
|
528 |
|
529 \sec Strings and Common Escape Sequences; |
|
530 \omit\vbox{\rm\vskip0.5ex |
|
531 A {\it string constant\/} consists of a sequence of characters |
|
532 enclosed in either double-quote or single-quote marks.\vskip0.75ex}\span\cr |
|
533 \char'134\char'134&a literal backslash\cr |
|
534 \char'134 "&a literal double-quote character\cr |
|
535 \char'134 '&a literal single-quote character\cr |
|
536 \char'134 n&newline, ASCII code 10\cr |
|
537 \char'134 t&horizontal tab, ASCII code 9\cr |
|
538 \endsec |
|
539 |
|
540 \sec Index Expressions; |
|
541 {\it var} ({\it idx})&select elements of a vector\cr |
|
542 {\it var} ({\it idx1}, {\it idx2})&select elements of a matrix\cr |
|
543 |
|
544 \quad {\it scalar}&select row (column) corresponding to {\it scalar}\cr |
|
545 \quad {\it vector}&select rows (columns) corresponding to the elements |
|
546 of {\it vector}\cr |
|
547 \quad {\it range}&select rows (columns) corresponding to the elements |
|
548 of {\it range}\cr |
|
549 \quad :&select all rows (columns)\cr |
|
550 \endsec |
|
551 |
|
552 \sec Global Variables; |
|
553 global {\it var1} ...&Declare variables global.\cr |
|
554 \omit\hfill\vbox{\hsize=\idnwid\rm\vskip0.25ex |
|
555 Global variables may be accessed inside the body of a function |
|
556 without having to be passed in the function parameter list provided |
|
557 they are also declared global within the function.}\span\cr |
|
558 \endsec |
|
559 |
6548
|
560 \sec Selected Built-in Functions; |
2333
|
561 EDITOR&editor to use with {\tt edit\_history}\cr |
|
562 Inf, NaN&IEEE infinity, NaN\cr |
|
563 PAGER&program to use to paginate output\cr |
|
564 ans&last result not explicitly assigned\cr |
|
565 eps&machine precision\cr |
|
566 pi&$\pi$\cr |
|
567 realmax&maximum representable value\cr |
|
568 realmin&minimum representable value\cr |
|
569 \endsec |
|
570 |
|
571 \vfill\eject |
|
572 |
|
573 \sec Arithmetic and Increment Operators; |
|
574 {\it x} + {\it y}&addition\cr |
|
575 {\it x} - {\it y}&subtraction\cr |
|
576 {\it x} * {\it y}&matrix multiplication\cr |
|
577 {\it x} .* {\it y}&element by element multiplication\cr |
|
578 {\it x} / {\it y}&right division, conceptually equivalent to |
|
579 {\tt (inverse~(y')~*~x')'}\cr |
|
580 {\it x} ./ {\it y}&element by element right division\cr |
|
581 {\it x} \char'134{} {\it y}&left division, conceptually equivalent to |
|
582 {\tt inverse~(x)~*~y}\cr |
|
583 {\it x} .\char'134{} {\it y}&element by element left division\cr |
|
584 {\it x} \char'136{} {\it y}&power operator\cr |
|
585 {\it x} .\char'136{} {\it y}&element by element power operator\cr |
|
586 - {\it x}&negation\cr |
|
587 + {\it x}&unary plus (a no-op)\cr |
|
588 {\it x} '&complex conjugate transpose\cr |
|
589 {\it x} .'&transpose\cr |
|
590 ++ {\it x}\quad{\rm(}-- {\it x}{\rm)}&increment (decrement) {\it x}, |
|
591 return {\it new\/} value\cr |
|
592 {\it x} ++\quad{\rm(}{\it x} --{\rm)}&increment (decrement) {\it x}, |
|
593 return {\it old\/} value\cr |
|
594 \endsec |
|
595 |
|
596 \sec Assignment Expressions; |
|
597 {\it var} = {\it expr}&assign expression to variable\cr |
|
598 {\it var} ({\it idx}) = {\it expr}&assign expression to indexed variable\cr |
|
599 \endsec |
|
600 |
|
601 \sec Comparison and Boolean Operators; |
|
602 \omit \vbox{\rm\vskip0.75ex |
|
603 These operators work on an element-by-element basis. Both arguments |
|
604 are always evaluated.\vskip0.75ex}\span\cr |
|
605 {\it x} < {\it y}&true if {\it x\/} is less than {\it y}\cr |
|
606 {\it x} <= {\it y}&true if {\it x\/} is less than or equal to {\it y}\cr |
3602
|
607 {\it x} == {\it y}&true if {\it x\/} is equal to {\it y}\cr |
2333
|
608 {\it x} >= {\it y}&true if {\it x\/} is greater than or equal to {\it y}\cr |
3602
|
609 {\it x} > {\it y}&true if {\it x\/} is greater than {\it y}\cr |
2333
|
610 {\it x} != {\it y}&true if {\it x\/} is not equal to {\it y}\cr |
|
611 {\it x} \& {\it y}&true if both {\it x\/} and {\it y\/} are true\cr |
|
612 {\it x} | {\it y}&true if at least one of {\it x\/} or {\it y\/} is true\cr |
3602
|
613 ! {\it bool}&true if {\it bool\/} is false\cr |
2333
|
614 \endsec |
|
615 |
|
616 \sec Short-circuit Boolean Operators; |
|
617 \omit \vbox{\rm\vskip0.75ex |
|
618 Operators evaluate left-to-right, expecting scalar operands. |
|
619 Operands are only evaluated if necessary, stopping once overall |
|
620 truth value can be determined. Operands are converted to scalars by |
|
621 applying the {\tt all} function.\vskip0.75ex}\span\cr |
|
622 {\it x} \&\& {\it y}&true if both {\it x\/} and {\it y\/} are true\cr |
|
623 {\it x} || {\it y}&true if at least one of {\it x\/} or {\it y\/} is true\cr |
|
624 \endsec |
|
625 |
|
626 \sec Operator Precedence; |
|
627 \omit \vbox{\rm\vskip0.5ex |
|
628 Here is a table of the operators in Octave, in order of increasing |
|
629 precedence.\vskip0.75ex}\span\cr |
|
630 ;\ \ ,&statement separators\cr |
|
631 =&assignment, groups left to right\cr |
|
632 ||\ \ \&\&&logical ``or'' and ``and''\cr |
|
633 |\ \ \&&element-wise ``or'' and ``and''\cr |
|
634 < <= == >= > !=&relational operators\cr |
|
635 :&colon\cr |
|
636 +\ \ -&addition and subtraction\cr |
|
637 * / \char'134\ \ .*\ \ ./\ \ .\char'134&multiplication and division\cr |
|
638 '\ \ .'&transpose\cr |
|
639 +\ \ -\ \ ++\ \ --\ \ !&unary minus, increment, logical ``not''\cr |
|
640 \char'136\ \ .\char'136&exponentiation\cr |
|
641 \endsec |
|
642 |
|
643 \vfill\eject |
|
644 |
|
645 \widesec Statements; |
|
646 for {\it identifier} = {\it expr} {\it stmt-list} endfor\cr |
|
647 \hfill\vbox{\hsize=\idnwid\rm\vskip0.25ex |
|
648 Execute {\it stmt-list} once for each column of {\it expr}. The |
|
649 variable {\it identifier} is set to the value of the current column |
|
650 during each iteration.}\cr\cr |
|
651 while ({\it condition}) {\it stmt-list} endwhile\cr |
|
652 \hfill\vbox{\hsize=\idnwid\rm\vskip0.25ex |
|
653 Execute {\it stmt-list} while {\it condition} is true.}\cr\cr |
|
654 \hbox{\vtop{\hsize=\itmwid\tt break} |
|
655 \vtop{\hsize=\dfnwid\rm exit innermost loop}}\cr |
|
656 \hbox{\vtop{\hsize=\itmwid\tt continue} |
|
657 \vtop{\hsize=\dfnwid\rm go to beginning of innermost loop}}\cr |
|
658 \hbox{\vtop{\hsize=\itmwid\tt return} |
|
659 \vtop{\hsize=\dfnwid\rm return to calling function}}\cr\cr |
|
660 if ({\it condition}) {\it if-body} \opt{{\tt else} {\it else-body}} endif\cr |
|
661 \hfill\vbox{\hsize=\idnwid\rm\vskip0.25ex |
|
662 Execute {\it if-body} if {\it condition} is true, otherwise execute |
|
663 {\it else-body}.}\cr |
|
664 if ({\it condition}) {\it if-body} \opt{{\tt elseif} ({\it condition}) |
|
665 {\it elseif-body}} endif\cr |
|
666 \hfill\vbox{\hsize=\idnwid\rm\vskip0.25ex |
|
667 Execute {\it if-body} if {\it condition} is true, otherwise execute |
|
668 the {\it elseif-body} corresponding to the first {\tt elseif} |
|
669 condition that is true, otherwise execute {\it else-body}.}\cr |
|
670 \hfill\vbox{\hsize=\idnwid\rm\vskip0.25ex |
|
671 Any number of {\tt elseif} clauses may appear in an {\tt if} |
|
672 statement.}\cr\cr |
|
673 unwind\_protect {\it body} unwind\_protect\_cleanup {\it cleanup} end\cr |
|
674 \hfill\vbox{\hsize=\idnwid\rm\vskip0.25ex |
|
675 Execute {\it body}. Execute {\it cleanup} no matter how control |
|
676 exits {\it body}.}\cr |
|
677 \endsec |
|
678 |
|
679 \widesec Defining Functions; |
|
680 function \opt{{\it ret-list}} {\it function-name} |
|
681 \opt{\hskip0.2em({\it arg-list})\hskip0.2em}\cr |
|
682 \quad{\it function-body}\cr |
|
683 endfunction\cr\cr |
|
684 {\rm {\it ret-list\/} may be a single identifier or a comma-separated |
|
685 list of identifiers delimited by square-brackets.\vskip0.75ex}\cr |
|
686 {\rm {\it arg-list\/} is a comma-separated list of identifiers and may |
|
687 be empty.}\cr |
|
688 \endsec |
|
689 |
|
690 \sec Basic Matrix Manipulations; |
|
691 rows ({\it a})&return number of rows of {\it a}\cr |
|
692 columns ({\it a})&return number of columns of {\it a}\cr |
|
693 all ({\it a})&check if all elements of {\it a\/} nonzero\cr |
|
694 any ({\it a})&check if any elements of {\it a\/} nonzero\cr |
|
695 find ({\it a})&return indices of nonzero elements\cr |
|
696 sort ({\it a})&order elements in each column of {\it a}\cr |
|
697 sum ({\it a})&sum elements in columns of {\it a}\cr |
|
698 prod ({\it a})&product of elements in columns of {\it a}\cr |
|
699 min ({\it args})&find minimum values\cr |
|
700 max ({\it args})&find maximum values\cr |
|
701 rem ({\it x}, {\it y})&find remainder of {\it x}/{\it y}\cr |
|
702 reshape ({\it a}, {\it m}, {\it n})&reformat {\it a} to be {\it m} by |
|
703 {\it n}\cr\cr |
|
704 diag ({\it v}, {\it k})&create diagonal matrices\cr |
|
705 linspace ({\it b}, {\it l}, {\it n})&create vector of linearly-spaced |
|
706 elements\cr |
|
707 logspace ({\it b}, {\it l}, {\it n})&create vector of log-spaced |
|
708 elements\cr |
|
709 eye ({\it n}, {\it m})&create {\it n\/} by {\it m\/} identity matrix\cr |
|
710 ones ({\it n}, {\it m})&create {\it n\/} by {\it m\/} matrix of ones\cr |
|
711 zeros ({\it n}, {\it m})&create {\it n\/} by {\it m\/} matrix of zeros\cr |
|
712 rand ({\it n}, {\it m})&create {\it n\/} by {\it m\/} matrix of random |
|
713 values\cr |
|
714 \endsec |
|
715 |
|
716 \vfill\eject |
|
717 |
|
718 % sin({\it a}) cos({\it a}) tan({\it a})&trigonometric functions\cr |
|
719 % asin({\it a}) acos({\it a}) atan({\it a})&inverse trigonometric functions\cr |
|
720 % sinh({\it a}) cosh({\it a}) tanh({\it a})&hyperbolic trig functions\cr |
|
721 % asinh({\it a}) acosh({\it a}) atanh({\it a})&inverse hyperbolic trig |
|
722 % functions\cr\cr |
|
723 |
|
724 \sec Linear Algebra; |
|
725 chol ({\it a})&Cholesky factorization\cr |
|
726 det ({\it a})&compute the determinant of a matrix\cr |
|
727 eig ({\it a})&eigenvalues and eigenvectors\cr |
|
728 expm ({\it a})&compute the exponential of a matrix\cr |
|
729 hess ({\it a})&compute Hessenberg decomposition\cr |
|
730 inverse ({\it a})&invert a square matrix\cr |
|
731 norm ({\it a}, {\it p})&compute the {\it p}-norm of a matrix\cr |
|
732 pinv ({\it a})&compute pseudoinverse of {\it a}\cr |
|
733 qr ({\it a})&compute the QR factorization of a matrix\cr |
|
734 rank ({\it a})&matrix rank\cr |
|
735 schur ({\it a})&Schur decomposition of a matrix\cr |
|
736 svd ({\it a})&singular value decomposition\cr |
|
737 syl ({\it a}, {\it b}, {\it c})&solve the Sylvester equation\cr |
|
738 \endsec |
|
739 |
|
740 \sec Equations, ODEs, DAEs, Quadrature; |
|
741 *fsolve&solve nonlinear algebraic equations\cr |
|
742 *lsode&integrate nonlinear ODEs\cr |
|
743 *dassl&integrate nonlinear DAEs\cr |
|
744 *quad&integrate nonlinear functions\cr\cr |
|
745 perror ({\it nm}, {\it code})&for functions that return numeric |
|
746 codes, print error message for named function and given error |
|
747 code\cr\cr |
|
748 \omit \vbox{\rm |
|
749 {\tt *} See the on-line or printed manual for the complete list of |
|
750 arguments for these functions.}\span\cr |
|
751 \endsec |
|
752 |
|
753 \sec Signal Processing; |
|
754 fft ({\it a})&Fast Fourier Transform using FFTPACK\cr |
|
755 ifft ({\it a})&inverse FFT using FFTPACK\cr |
|
756 freqz ({\it args})&FIR filter frequency response\cr |
|
757 sinc ({\it x})&returns {\tt sin ($\pi$ x)/($\pi$ x)}\cr |
|
758 \endsec |
|
759 |
|
760 \altsec Image Processing; |
|
761 colormap ({\it map})&set the current colormap\cr |
|
762 gray2ind ({\it i}, {\it n})&convert gray scale to Octave image\cr |
|
763 image ({\it img}, {\it zoom})&display an Octave image matrix\cr |
|
764 imagesc ({\it img}, {\it zoom})&display scaled matrix as image\cr |
|
765 imshow ({\it img}, {\it map})&display Octave image\cr |
|
766 imshow ({\it i}, {\it n})&display gray scale image\cr |
|
767 imshow ({\it r}, {\it g}, {\it b})&display RGB image\cr |
|
768 ind2gray ({\it img}, {\it map})&convert Octave image to gray scale\cr |
|
769 ind2rgb ({\it img}, {\it map})&convert indexed image to RGB\cr |
|
770 loadimage ({\it file})&load an image file\cr |
|
771 rgb2ind ({\it r}, {\it g}, {\it b})&convert RGB to Octave image\cr |
|
772 \omit\tt saveimage ({\it file}, {\it img}, {\it fmt}, {\it map})\quad\rm |
|
773 save a matrix to {\it file}\span\cr |
|
774 \endsec |
|
775 |
|
776 \altsec Sets; |
|
777 create\_set ({\it a}, {\it b})&create row vector of unique values\cr |
|
778 complement ({\it a}, {\it b})&elements of {\it b} not in {\it a}\cr |
|
779 intersection ({\it a}, {\it b})&intersection of sets {\it a} and {\it b}\cr |
|
780 union ({\it a}, {\it b})&union of sets {\it a} and {\it b}\cr |
|
781 \endsec |
|
782 |
|
783 \altsec Strings; |
|
784 strcmp ({\it s}, {\it t})&compare strings\cr |
|
785 strcat ({\it s}, {\it t}, ...)&concatenate strings\cr |
|
786 \endsec |
|
787 |
|
788 \vfill\eject |
|
789 |
|
790 \altsec C-style Input and Output; |
|
791 fopen ({\it name}, {\it mode})&open file {\it name}\cr |
|
792 fclose ({\it file})&close {\it file}\cr |
|
793 printf ({\it fmt}, ...)&formatted output to {\tt stdout}\cr |
|
794 fprintf ({\it file}, {\it fmt}, ...)&formatted output to {\it file}\cr |
|
795 sprintf ({\it fmt}, ...)&formatted output to string\cr |
|
796 scanf ({\it fmt})&formatted input from {\tt stdin}\cr |
|
797 fscanf ({\it file}, {\it fmt})&formatted input from {\it file}\cr |
|
798 sscanf ({\it str}, {\it fmt})&formatted input from {\it string}\cr |
|
799 fgets ({\it file}, {\it len})&read {\it len\/} characters from {\it file\/}\cr |
|
800 fflush ({\it file})&flush pending output to {\it file}\cr |
|
801 ftell ({\it file})&return file pointer position\cr |
|
802 frewind ({\it file})&move file pointer to beginning\cr |
|
803 freport&print a info for open files\cr |
|
804 fread ({\it file}, {\it size}, {\it prec})&read binary data files\cr |
|
805 fwrite ({\it file}, {\it size}, {\it prec})&write binary data files\cr |
|
806 feof ({\it file})&determine if pointer is at EOF\cr |
|
807 \omit \vbox{\rm\vskip0.75ex |
|
808 A file may be referenced either by name or by the number returned |
|
809 from {\tt fopen}. Three files are preconnected when Octave starts: |
|
810 {\tt stdin}, {\tt stdout}, and {\tt stderr}.\vskip0.75ex}\span\cr |
|
811 \endsec |
|
812 |
|
813 \sec Other Input and Output functions; |
|
814 save {\it file} {\it var} ...&save variables in {\it file}\cr |
|
815 load {\it file}&load variables from {\it file}\cr |
|
816 disp ({\it var})&display value of {\it var} to screen\cr |
|
817 \endsec |
|
818 |
|
819 \sec Miscellaneous Functions; |
|
820 eval ({\it str})&evaluate {\it str} as a command\cr |
|
821 feval ({\it str}, ...)&evaluate function named by {\it str}, |
|
822 passing remaining args to called function\cr\cr |
|
823 error ({\it message})&print message and return to top level\cr\cr |
|
824 clear {\it pattern}&clear variables matching pattern\cr |
|
825 exist ({\it str})&check existence of variable or function\cr |
|
826 who&list current variables\cr |
|
827 \endsec |
|
828 |
|
829 \sec Polynomials; |
|
830 compan ({\it p})&companion matrix\cr |
|
831 conv ({\it a}, {\it b})&convolution\cr |
|
832 deconv ({\it a}, {\it b})&deconvolve two vectors\cr |
|
833 poly ({\it a})&create polynomial from a matrix\cr |
|
834 polyderiv ({\it p})&derivative of polynomial\cr |
|
835 polyreduce ({\it p})&integral of polynomial\cr |
|
836 polyval ({\it p}, {\it x})&value of polynomial at {\it x}\cr |
|
837 polyvalm ({\it p}, {\it x})&value of polynomial at {\it x}\cr |
|
838 roots ({\it p})&polynomial roots\cr |
|
839 residue ({\it a}, {\it b})&partial fraction expansion of |
|
840 ratio {\it a}/{\it b}\cr |
|
841 \endsec |
|
842 |
|
843 \sec Statistics; |
|
844 corrcoef ({\it x}, {\it y})&correlation coefficient\cr |
|
845 cov ({\it x}, {\it y})&covariance\cr |
|
846 mean ({\it a})&mean value\cr |
|
847 median ({\it a})&median value\cr |
|
848 std ({\it a})&standard deviation\cr |
|
849 var ({\it a})&variance\cr |
|
850 \endsec |
|
851 |
|
852 \vfill\eject |
|
853 |
6548
|
854 \sec Plotting Functions; |
2333
|
855 plot ({\it args})&2D plot with linear axes\cr |
6548
|
856 plot3 ({\it args})&3D plot with linear axes\cr |
|
857 line ({\it args})&2D or 3D line\cr |
2333
|
858 semilogx ({\it args})&2D plot with logarithmic x-axis\cr |
|
859 semilogy ({\it args})&2D plot with logarithmic y-axis\cr |
|
860 loglog ({\it args})&2D plot with logarithmic axes\cr |
|
861 bar ({\it args})&plot bar charts\cr |
|
862 stairs ({\it x}, {\it y})&plot stairsteps\cr |
|
863 hist ({\it y}, {\it x})&plot histograms\cr\cr |
|
864 title ({\it string})&set plot title\cr\cr |
|
865 axis ({\it limits})&set axis ranges\cr |
|
866 xlabel ({\it string})&set x-axis label\cr |
|
867 ylabel ({\it string})&set y-axis label\cr |
6548
|
868 zlabel ({\it string})&set z-axis label\cr |
|
869 legend ({\it string})&set label in plot key\cr |
2333
|
870 grid \opt{on$|$off}&set grid state\cr |
|
871 hold \opt{on$|$off}&set hold state\cr |
|
872 ishold&return 1 if hold is on, 0 otherwise\cr\cr |
|
873 mesh ({\it x}, {\it y}, {\it z})&plot 3D surface\cr |
|
874 meshdom ({\it x}, {\it y})&create mesh coordinate matrices\cr |
|
875 \endsec |
|
876 |
|
877 \vskip 0pt plus 2fill |
|
878 \hrule width \hsize |
|
879 \par\vskip10pt |
|
880 {\smrm\parskip=6pt |
|
881 Edition \refcardedition for Octave Version \octaveversion. Copyright |
6548
|
882 1996, 2007, John W. Eaton |
|
883 (jwe@bevo.che.wisc.edu). The author assumes no responsibility for any |
2333
|
884 errors on this card. |
|
885 |
|
886 This card may be freely distributed under the terms of the GNU |
|
887 General Public License. |
|
888 |
|
889 \TeX{} Macros for this card by Roland Pesch (pesch@cygnus.com), |
|
890 originally for the GDB reference card |
|
891 |
|
892 Octave itself is free software; you are welcome to distribute copies of |
|
893 it under the terms of the GNU General Public License. There is |
|
894 absolutely no warranty for Octave. |
|
895 } |
|
896 |
|
897 \end |
|
898 |
|
899 % For AUCTeX: |
|
900 % |
|
901 % Local Variables: |
|
902 % mode: tex |
|
903 % TeX-master: t |
|
904 % End: |