Mercurial > hg > octave-lyh
comparison doc/faq/OctaveFAQ.texi @ 12479:c741c1f2789e
Minor proofreading in FAQ
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Fri, 25 Feb 2011 15:11:26 -0600 |
parents | b4138a75eecc |
children | 30f2a3b1d236 |
comparison
equal
deleted
inserted
replaced
12478:b4138a75eecc | 12479:c741c1f2789e |
---|---|
26 * OctaveFAQ: (OctaveFAQ). Frequently asked questions about Octave | 26 * OctaveFAQ: (OctaveFAQ). Frequently asked questions about Octave |
27 @end direntry | 27 @end direntry |
28 @titlepage | 28 @titlepage |
29 @title Octave FAQ | 29 @title Octave FAQ |
30 @subtitle Frequently asked questions about Octave | 30 @subtitle Frequently asked questions about Octave |
31 @subtitle September 2008 | 31 @subtitle @today{} |
32 @sp 1 | 32 @sp 1 |
33 @author John W. Eaton and David Bateman | 33 @author John W. Eaton and David Bateman |
34 @page | 34 @page |
35 @end titlepage | 35 @end titlepage |
36 | 36 |
52 This FAQ is intended to supplement, not replace, the Octave manual. | 52 This FAQ is intended to supplement, not replace, the Octave manual. |
53 Before posting a question to the @email{help@@octave.org} mailing list, | 53 Before posting a question to the @email{help@@octave.org} mailing list, |
54 you should first check to see if the topic is covered in the manual. | 54 you should first check to see if the topic is covered in the manual. |
55 | 55 |
56 @menu | 56 @menu |
57 * What is Octave?:: | 57 * What is Octave?:: |
58 * Licensing Issues:: | 58 * Licensing Issues:: |
59 * How can I cite Octave?:: | 59 * How can I cite Octave?:: |
60 * Series 3.0.N:: | 60 * Series 3.0.N:: |
61 * Octave Features:: | 61 * Octave Features:: |
62 * Learning more about Octave:: | 62 * Learning more about Octave:: |
63 * Getting Octave:: | 63 * Getting Octave:: |
64 * Installation:: | 64 * Installation:: |
65 * Common problems:: | 65 * Common problems:: |
66 * How do I ...?:: | 66 * How do I ...?:: |
67 * @sc{Matlab} compatibility:: | 67 * @sc{Matlab} compatibility:: |
68 * Index:: | 68 * Index:: |
69 @end menu | 69 @end menu |
70 | 70 |
71 @node What is Octave? | 71 @node What is Octave? |
72 @chapter What is Octave? | 72 @chapter What is Octave? |
73 | 73 |
74 Octave is a high-level interactive language, primarily intended for | 74 Octave is a high-level interactive language, primarily intended for |
75 numerical computations that is mostly compatible with | 75 numerical computations that is mostly compatible with |
76 @sc{Matlab}.@footnote{@sc{Matlab} is a registered trademark of The MathWorks, | 76 @sc{Matlab}.@footnote{@sc{Matlab} is a registered trademark of The |
77 Inc.} | 77 MathWorks, Inc.} |
78 | 78 |
79 Octave can do arithmetic for real, complex or integer-valued scalars | 79 Octave can do arithmetic for real, complex or integer-valued scalars |
80 and matrices, solve sets of nonlinear algebraic equations, integrate | 80 and matrices, solve sets of nonlinear algebraic equations, integrate |
81 functions over finite and infinite intervals, and integrate systems of | 81 functions over finite and infinite intervals, and integrate systems of |
82 ordinary differential and differential-algebraic equations. | 82 ordinary differential and differential-algebraic equations. |
86 cursor movement commands used by GNU Emacs, and a vi-style line | 86 cursor movement commands used by GNU Emacs, and a vi-style line |
87 editing interface is also available. At the end of each session, the | 87 editing interface is also available. At the end of each session, the |
88 command history is saved, so that commands entered during previous | 88 command history is saved, so that commands entered during previous |
89 sessions are not lost. | 89 sessions are not lost. |
90 | 90 |
91 The Octave distribution includes a 590+ page Texinfo manual. Access | 91 The Octave distribution includes a 590+ page Texinfo manual. Access to |
92 to the complete text of the manual is available via the help command | 92 the complete text of the manual is available via the @code{doc} command |
93 @c really, the *complete* text? | |
94 at the Octave prompt. | 93 at the Octave prompt. |
95 | 94 |
96 @menu | 95 @menu |
97 * Who develops Octave?:: | 96 * Who develops Octave?:: |
98 * Why GNU Octave?:: | 97 * Why GNU Octave?:: |
99 * What version should I use?:: | 98 * What version should I use?:: |
100 * On what platforms does Octave run?:: | 99 * On what platforms does Octave run?:: |
101 @end menu | 100 @end menu |
102 | 101 |
103 @node Who develops Octave? | 102 @node Who develops Octave? |
104 @section Who develops Octave? | 103 @section Who develops Octave? |
105 | 104 |
106 Discussions about writing the software that would eventually become | 105 Discussions about writing the software that would eventually become |
107 Octave started in about 1988 with James B. Rawlings and John W. Eaton at | 106 Octave started in about 1988 with James B. Rawlings and John W. Eaton at |
108 the University of Texas. John W. Eaton was the original author of | 107 the University of Texas. John W. Eaton was the original author of |
109 Octave, starting full-time development in February 1992. He is still | 108 Octave, starting full-time development in February 1992. He is still the |
110 the primary maintainer. The community | 109 primary maintainer. The community of users/developers has in addition |
111 of users/developers has in addition contributed some code and fuels the | 110 contributed some code and fuels the discussion on the mailing lists |
112 discussion on the mailing lists @email{help@@octave.org} (user forum), | 111 @email{help@@octave.org} (user forum), @email{maintainers@@octave.org} |
113 @email{bug@@octave.org} (bug reports), @email{maintainers@@octave.org} | |
114 (development issues), and @email{octave-dev@@lists.sourceforge.net} (all | 112 (development issues), and @email{octave-dev@@lists.sourceforge.net} (all |
115 things related to the Octave Forge repository of user-contributed | 113 things related to the Octave Forge repository of user-contributed |
116 functions). | 114 functions). |
117 | 115 |
118 @node Why GNU Octave? | 116 @node Why GNU Octave? |
138 @cindex GNU [GNU's not unix] | 136 @cindex GNU [GNU's not unix] |
139 | 137 |
140 @node What version should I use? | 138 @node What version should I use? |
141 @section What version should I use? | 139 @section What version should I use? |
142 | 140 |
143 In general, you will find the latest version on | 141 In general, you will find the latest version on |
144 @url{http://www.octave.org/download.html}. It is | 142 @url{http://www.octave.org/download.html}. It is recommended to use the |
145 recommended to use the ``testing'' version of octave for general use, | 143 ``testing'' version of octave for general use, and the ``development'' |
146 and the ``development'' version if you want the latest features. | 144 version if you want the latest features. |
147 | 145 |
148 A list of user-visible changes since the last release is available in | 146 A list of user-visible changes since the last release is available in |
149 the file @file{NEWS}. The file @file{ChangeLog} in the source | 147 the file @file{NEWS}. The file @file{ChangeLog} in the source |
150 distribution contains a more detailed record of changes made since the | 148 distribution contains a more detailed record of changes made since the |
151 last release. | 149 last release. |
156 Octave runs on various Unices---at least Linux and Solaris, Mac OS X, | 154 Octave runs on various Unices---at least Linux and Solaris, Mac OS X, |
157 Windows and anything you can compile it on. Binary distributions exist | 155 Windows and anything you can compile it on. Binary distributions exist |
158 at least for Debian, Suse, Fedora and RedHat Linuxes (Intel and AMD | 156 at least for Debian, Suse, Fedora and RedHat Linuxes (Intel and AMD |
159 CPUs, at least), for Mac Os X and Windows' 98, 2000 and XP. | 157 CPUs, at least), for Mac Os X and Windows' 98, 2000 and XP. |
160 | 158 |
161 Two and three dimensional plotting is fully supported using gnuplot. | 159 Two and three dimensional plotting is fully supported using gnuplot and |
160 an experimental OpenGL backend. | |
162 | 161 |
163 The underlying numerical solvers are currently standard Fortran ones | 162 The underlying numerical solvers are currently standard Fortran ones |
164 like Lapack, Linpack, Odepack, the Blas, etc., packaged in a library | 163 like LAPACK, LINPACK, ODEPACK, the BLAS, etc., packaged in a library |
165 of C++ classes. If possible, the Fortran subroutines are compiled | 164 of C++ classes. If possible, the Fortran subroutines are compiled |
166 with the system's Fortran compiler, and called directly from the C++ | 165 with the system's Fortran compiler, and called directly from the C++ |
167 functions. If that's not possible, you can still compile Octave if | 166 functions. If that's not possible, you can still compile Octave if |
168 you have the free Fortran to C translator f2c. | 167 you have the free Fortran to C translator f2c. |
169 | 168 |
170 Octave is also free software; you can redistribute it and/or modify it | 169 Octave is also free software; you can redistribute it and/or modify it |
171 under the terms of the GNU General Public License as published by the | 170 under the terms of the GNU General Public License, version 3, as |
172 Free Software Foundation. | 171 published by the Free Software Foundation, or at your option any later |
172 version. | |
173 | 173 |
174 @node Licensing Issues | 174 @node Licensing Issues |
175 @chapter Licensing Issues | 175 @chapter Licensing Issues |
176 | 176 |
177 @menu | 177 @menu |
288 | 288 |
289 @item many many other minor features and compatibility changes | 289 @item many many other minor features and compatibility changes |
290 | 290 |
291 @end itemize | 291 @end itemize |
292 | 292 |
293 Here are some features that have been around since 2.1.N | 293 Here are some features that have been around since 2.1.N: |
294 | 294 |
295 @itemize @bullet | 295 @itemize @bullet |
296 | 296 |
297 @item NDarrays | 297 @item NDarrays |
298 | 298 |
299 @item cells | 299 @item cells |
300 | 300 |
301 @end itemize | 301 @end itemize |
302 | 302 |
303 The 3.1.N series is the current development release and will become a | 303 The 3.1.N series is the current development release and will become a |
304 3.2.N release in the future. This series brings the new features | 304 3.2.N release in the future. This series brings the following new |
305 features: | |
305 | 306 |
306 @itemize | 307 @itemize |
307 @item OpenGL graphics toolkit | 308 @item OpenGL graphics toolkit |
308 | 309 |
309 An experimental OpenGL graphics toolkit to replace the gnuplot. | 310 An experimental OpenGL graphics toolkit to replace gnuplot. |
310 | 311 |
311 @item Object Orient Programming | 312 @item Object Orient Programming |
312 | 313 |
313 @item Block comments | 314 @item Block comments |
314 | 315 |
315 @item imwrite and imread | 316 @item imwrite and imread |
316 | 317 |
317 The functions are based on the GraphicsMagick library. | 318 The functions are based on the GraphicsMagick library. |
318 | 319 |
319 @item Lazy transpose | 320 @item Lazy transpose |
320 | 321 |
333 @node Octave Features | 334 @node Octave Features |
334 @chapter What features are unique to Octave? | 335 @chapter What features are unique to Octave? |
335 | 336 |
336 @menu | 337 @menu |
337 * Functions defined on the command-line:: | 338 * Functions defined on the command-line:: |
338 * Comments with #:: | 339 * Comments with #:: |
339 * Strings delimitted by double quotes ":: | 340 * Strings delimitted by double quotes ":: |
340 * Line continuation by backslash:: | 341 * Line continuation by backslash:: |
341 * Informative block closing:: | 342 * Informative block closing:: |
342 * Coherent syntax:: | 343 * Coherent syntax:: |
343 * Exclamation mark as not operator:: | 344 * Exclamation mark as not operator:: |
344 * Increment and decrement operators:: | 345 * Increment and decrement operators:: |
345 * Unwind-protect:: | 346 * Unwind-protect:: |
346 * Built-in ODE and DAE solvers:: | 347 * Built-in ODE and DAE solvers:: |
347 @end menu | 348 @end menu |
348 | 349 |
349 This section refers to @sc{Matlab} R2008b and Octave 2.1.51. | 350 This section refers to @sc{Matlab} R2008b and Octave 2.1.51. |
350 | 351 |
356 type: | 357 type: |
357 | 358 |
358 @example | 359 @example |
359 @group | 360 @group |
360 octave:1> function s = hello_string (to_who) | 361 octave:1> function s = hello_string (to_who) |
361 > ## Say hello | 362 > ## Say hello |
362 > if nargin<1, to_who = "World"; end | 363 > if nargin<1, to_who = "World"; end |
363 > s = ["Hello ",\ | 364 > s = ["Hello ",\ |
364 > to_who]; | 365 > to_who]; |
365 > endfunction | 366 > endfunction |
366 octave:2> hello_string ("Moon") | 367 octave:2> hello_string ("Moon") |
367 ans = Hello Moon | 368 ans = Hello Moon |
368 @end group | 369 @end group |
369 @end example | 370 @end example |
370 | 371 |
371 @node Comments with # | 372 @node Comments with # |
372 @section Comments with # | 373 @section Comments with # |
373 | 374 |
374 The pound character, @samp{#}, may be used to start comments, in addition | 375 The pound character, @samp{#}, may be used to start comments, in addition |
375 to @samp{%}. See the previous example. The major advantage of this is | 376 to @samp{%}. See the previous example. The major advantage of this is |
376 that as @samp{#} is also a comment character for unix script files, any | 377 that as @samp{#} is also a comment character for unix script files, any |
377 file that starts with a string like @samp{#! /usr/bin/octave -q} will be | 378 file that starts with a string like @samp{#! /usr/bin/octave -q} will be |
378 treated as an octave script and be executed by octave. | 379 treated as an octave script and be executed by octave. |
379 | 380 |
380 @node Strings delimitted by double quotes " | 381 @node Strings delimitted by double quotes " |
381 @section Strings delimitted by double quotes " | 382 @section Strings delimitted by double quotes " |
382 The double quote, @samp{"}, may be used to delimit strings, in addition to | 383 The double quote, @samp{"}, may be used to delimit strings, in addition to |
383 the single quote @samp{'}. See the previous example. Also, double-quoted | 384 the single quote @samp{'}. See the previous example. Also, double-quoted |
384 strings include backslash interpretation (like C++, C, and Perl) while | 385 strings include backslash interpretation (like C++, C, and Perl) while |
385 single quoted are uninterpreted (like @sc{Matlab} and Perl). | 386 single quoted are uninterpreted (like @sc{Matlab} and Perl). |
386 | 387 |
387 @node Line continuation by backslash | 388 @node Line continuation by backslash |
388 @section Line continuation by backslash | 389 @section Line continuation by backslash |
389 | 390 |
390 Lines can be continued with a backslash, @samp{\}, in addition to three | 391 Lines can be continued with a backslash, @samp{\}, in addition to three |
391 points @samp{@dots{}}. See the previous example. | 392 points @samp{@dots{}}. See the previous example. |
392 | 393 |
393 @node Informative block closing | 394 @node Informative block closing |
455 value of @var{x} is 3. | 456 value of @var{x} is 3. |
456 | 457 |
457 For matrix and vector arguments, the increment and decrement operators | 458 For matrix and vector arguments, the increment and decrement operators |
458 work on each element of the operand. | 459 work on each element of the operand. |
459 | 460 |
460 | |
461 @node Unwind-protect | 461 @node Unwind-protect |
462 @section Unwind-protect | 462 @section Unwind-protect |
463 | 463 |
464 @cindex Unwind-protect | 464 @cindex Unwind-protect |
465 | 465 |
477 @end group | 477 @end group |
478 @end example | 478 @end example |
479 | 479 |
480 @noindent | 480 @noindent |
481 Where @var{body} and @var{cleanup} are both optional and may contain any | 481 Where @var{body} and @var{cleanup} are both optional and may contain any |
482 Octave expressions or commands. The statements in @var{cleanup} are | 482 Octave expressions or commands. The statements in @var{cleanup} are |
483 guaranteed to be executed regardless of how control exits @var{body}. | 483 guaranteed to be executed regardless of how control exits @var{body}. |
484 | 484 |
485 The @code{unwind_protect} statement is often used to reliably restore | 485 The @code{unwind_protect} statement is often used to reliably restore |
486 the values of global variables that need to be temporarily changed. | 486 the values of global variables that need to be temporarily changed. |
487 | 487 |
501 @node Learning more about Octave | 501 @node Learning more about Octave |
502 @chapter What documentation exists for Octave? | 502 @chapter What documentation exists for Octave? |
503 | 503 |
504 @menu | 504 @menu |
505 * Documentation:: | 505 * Documentation:: |
506 * Getting additional help:: | 506 * Getting additional help:: |
507 * User community:: | 507 * User community:: |
508 * Bug reports:: | 508 * Bug reports:: |
509 @end menu | 509 @end menu |
510 | |
511 | 510 |
512 @node Documentation | 511 @node Documentation |
513 @section What documentation exists for Octave? | 512 @section What documentation exists for Octave? |
514 | 513 |
515 @cindex Octave, documentation | 514 @cindex Octave, documentation |
524 Info system via the GNU Emacs, info, or xinfo programs, or by using | 523 Info system via the GNU Emacs, info, or xinfo programs, or by using |
525 the @samp{help -i} command to start the GNU info browser directly from | 524 the @samp{help -i} command to start the GNU info browser directly from |
526 the Octave prompt. | 525 the Octave prompt. |
527 | 526 |
528 If you have problems using this documentation, or find that some topic | 527 If you have problems using this documentation, or find that some topic |
529 is not adequately explained, indexed, or cross-referenced, please send | 528 is not adequately explained, indexed, or cross-referenced, please report |
530 a bug report to @email{bug@@octave.org}. | 529 it on @url{http://bugs.octave.org}. |
531 | |
532 | 530 |
533 @node Getting additional help | 531 @node Getting additional help |
534 @section Getting additional help | 532 @section Getting additional help |
535 | 533 |
536 @cindex Additional help | 534 @cindex Additional help |
592 | 590 |
593 @node Getting Octave | 591 @node Getting Octave |
594 @chapter Getting Octave | 592 @chapter Getting Octave |
595 | 593 |
596 @menu | 594 @menu |
597 * Source code:: | 595 * Source code:: |
598 * Pre-compiled binary packages:: | 596 * Pre-compiled binary packages:: |
599 * Octave for other platforms:: | 597 * Octave for other platforms:: |
600 @end menu | 598 @end menu |
601 | 599 |
602 @node Source code | 600 @node Source code |
641 @cindex DJGPP | 639 @cindex DJGPP |
642 @cindex EMX | 640 @cindex EMX |
643 @cindex OS/2 support | 641 @cindex OS/2 support |
644 | 642 |
645 Octave currently runs on Unix-like systems, Mac OS X, and Windows. | 643 Octave currently runs on Unix-like systems, Mac OS X, and Windows. |
646 It should be possible to make Octave work on other systems as well. | 644 It should be possible to make Octave work on other systems as well. |
647 If you are interested in porting Octave to other systems, please contact | 645 If you are interested in porting Octave to other systems, please contact |
648 @email{bug@@octave.org}. | 646 @email{maintainers@@octave.org}. |
649 | 647 |
650 @c @menu | 648 @c @menu |
651 @c * Octave for Unix:: | 649 @c * Octave for Unix:: |
652 @c * Octave for other platforms:: | 650 @c * Octave for other platforms:: |
653 @c * latest versions:: | 651 @c * latest versions:: |
654 @c @end menu | 652 @c @end menu |
655 | 653 |
656 @c @cindex Octave, ordering | 654 @c @cindex Octave, ordering |
657 @c @cindex Octave, getting a copy | 655 @c @cindex Octave, getting a copy |
658 | 656 |
659 @node Installation | 657 @node Installation |
660 @chapter Installation Issues and Problems | 658 @chapter Installation Issues and Problems |
661 | 659 |
662 @cindex Octave, building | 660 @cindex Octave, building |
663 | 661 |
664 Octave 3.2 require approximately 800MB of disk storage to unpack | 662 Octave 3.2 require approximately 800MB of disk storage to unpack |
665 and compile from source (considerably less if you don't compile with | 663 and compile from source (considerably less if you don't compile with |
666 debugging symbols). Once installed, Octave requires approximately 200MB | 664 debugging symbols). Once installed, Octave requires approximately 200MB |
667 of disk space (again, considerably less if you don't compile with | 665 of disk space (again, considerably less if you don't compile with |
668 debugging symbols). | 666 debugging symbols). |
669 | 667 |
670 @menu | 668 @menu |
671 * What else do I need?:: | 669 * What else do I need?:: |
672 * Other C++ compilers?:: | 670 * Other C++ compilers?:: |
673 @end menu | 671 @end menu |
674 | 672 |
675 @node What else do I need? | 673 @node What else do I need? |
676 @section What else do I need? | 674 @section What else do I need? |
677 | 675 |
681 @cindex GNU Make | 679 @cindex GNU Make |
682 @cindex Flex | 680 @cindex Flex |
683 @cindex GNU Bison | 681 @cindex GNU Bison |
684 | 682 |
685 To compile Octave, you will need a recent version of GNU Make. You | 683 To compile Octave, you will need a recent version of GNU Make. You |
686 will also need GCC 3.3 or later, although GCC 4.1 or later is | 684 will also need GCC 3.3 or later, although GCC 4.1 or later is |
687 recommended. | 685 recommended. |
688 | 686 |
689 @strong{You must have GNU Make to compile octave}. Octave's Makefiles | 687 @strong{You must have GNU Make to compile octave}. Octave's Makefiles |
690 use features of GNU Make that are not present in other versions of make. | 688 use features of GNU Make that are not present in other versions of make. |
691 GNU Make is very portable and easy to install. | 689 GNU Make is very portable and easy to install. |
775 @cindex @sc{Matlab} compatibility | 773 @cindex @sc{Matlab} compatibility |
776 @cindex Compatibility with @sc{Matlab} | 774 @cindex Compatibility with @sc{Matlab} |
777 | 775 |
778 People often ask | 776 People often ask |
779 | 777 |
780 ``I wrote some code for @sc{Matlab}, and I want to get it running under | 778 @quotation |
781 Octave. Is there anything I should watch out for?'' | 779 I wrote some code for @sc{Matlab}, and I want to get it running under |
782 | 780 Octave. Is there anything I should watch out for? |
781 @end quotation | |
782 | |
783 @noindent | |
783 or alternatively | 784 or alternatively |
784 | 785 |
785 ``I wrote some code in Octave, and want to share it with @sc{Matlab} | 786 @quotation |
786 users. Is there anything I should watch out for?'' | 787 I wrote some code in Octave, and want to share it with @sc{Matlab} |
787 | 788 users. Is there anything I should watch out for? |
789 @end quotation | |
790 | |
791 @noindent | |
788 which is not quite the same thing. There are still a number of | 792 which is not quite the same thing. There are still a number of |
789 differences between Octave and @sc{Matlab}, however in general | 793 differences between Octave and @sc{Matlab}, however in general |
790 differences between the two are considered as bugs. Octave might | 794 differences between the two are considered as bugs. Octave might |
791 consider that the bug is in @sc{Matlab} and do nothing about it, but | 795 consider that the bug is in @sc{Matlab} and do nothing about it, but |
792 generally functionality is almost identical. If you find a difference | 796 generally functionality is almost identical. If you find a difference |
793 between Octave behavior and @sc{Matlab}, then you should send a | 797 between Octave behavior and @sc{Matlab}, then you should send a |
794 description of this difference (with code illustrating the difference, | 798 description of this difference (with code illustrating the difference, |
795 if possible) to @email{bug@@octave.org}. | 799 if possible) to @url{http://bugs.octave.org}. |
796 | 800 |
797 Furthermore, Octave adds a few syntactical extensions to @sc{Matlab} that | 801 Furthermore, Octave adds a few syntactical extensions to @sc{Matlab} that |
798 might cause some issues when exchanging files between @sc{Matlab} and Octave | 802 might cause some issues when exchanging files between @sc{Matlab} and Octave |
799 users. As both Octave and @sc{Matlab} are under constant development the | 803 users. As both Octave and @sc{Matlab} are under constant development the |
800 information in this section is subject to change at anytime. | 804 information in this section is subject to change at anytime. |
840 @end example | 844 @end example |
841 | 845 |
842 Now that @sc{Matlab} has recently introduced nested functions, Octave will | 846 Now that @sc{Matlab} has recently introduced nested functions, Octave will |
843 probably have them soon as well. Until then nested functions in Octave | 847 probably have them soon as well. Until then nested functions in Octave |
844 are treated as sub-functions with the same scoping rules as | 848 are treated as sub-functions with the same scoping rules as |
845 sub-functions. | 849 sub-functions. |
846 | 850 |
847 The authors of Octave consider the nested function scoping rules of | 851 The authors of Octave consider the nested function scoping rules of |
848 @sc{Matlab} to be more problems than they are worth as they introduce | 852 @sc{Matlab} to be more problems than they are worth as they introduce |
849 diffiult to find bugs as inadvertantly modifying a variable in a | 853 diffiult to find bugs as inadvertantly modifying a variable in a |
850 nested function that is also used in the parent is particularly easy. | 854 nested function that is also used in the parent is particularly easy. |
864 though the most common types are accepted. | 868 though the most common types are accepted. |
865 | 869 |
866 @item | 870 @item |
867 @sc{Matlab} classdef object oriented programming is not yet supportted, | 871 @sc{Matlab} classdef object oriented programming is not yet supportted, |
868 though work is underway and when development more on to Octave 3.3 this | 872 though work is underway and when development more on to Octave 3.3 this |
869 will be included in teh development tree. | 873 will be included in the development tree. |
870 @end itemize | 874 @end itemize |
871 | 875 |
872 @item Differences in core functions | 876 @item Differences in core functions |
873 A large number of the @sc{Matlab} core functions (ie those that are in | 877 A large number of the @sc{Matlab} core functions (ie those that are in |
874 the core and not a toolbox) are implemented, and certainly all of the | 878 the core and not a toolbox) are implemented, and certainly all of the |
875 commonly used ones. There are a few functions that aren't implemented, | 879 commonly used ones. There are a few functions that aren't implemented, |
880 @c this is no longer true, condest is now implemented in Octave | |
876 for example @code{condest} or to do with specific missing Octave functionality | 881 for example @code{condest} or to do with specific missing Octave functionality |
877 (gui, dll, java, activex, dde, web, and serial functions). Some of the | 882 (gui, dll, java, activex, dde, web, and serial functions). Some of the |
878 core functions have limitations that aren't in the @sc{Matlab} | 883 core functions have limitations that aren't in the @sc{Matlab} |
879 version. For example the @code{sprandn} function can not force a | 884 version. For example the @code{sprandn} function can not force a |
880 particular condition number for the matrix like @sc{Matlab} can. | 885 particular condition number for the matrix like @sc{Matlab} can. |
886 called in the loops and so you can't include user functions in the loop | 891 called in the loops and so you can't include user functions in the loop |
887 of JIT optimized loops. Octave doesn't have a JIT and so to some might | 892 of JIT optimized loops. Octave doesn't have a JIT and so to some might |
888 seem slower than @sc{Matlab}. For this reason you must vectorize your code as | 893 seem slower than @sc{Matlab}. For this reason you must vectorize your code as |
889 much as possible. The MathWorks themselves have a good document | 894 much as possible. The MathWorks themselves have a good document |
890 discussing vectorization at | 895 discussing vectorization at |
896 @c it would be nice if we had our own guide for this instead of relying | |
897 @c on Matlab documentation. | |
891 @url{http://www.mathworks.com/support/tech-notes/1100/1109.html}. | 898 @url{http://www.mathworks.com/support/tech-notes/1100/1109.html}. |
892 | 899 |
893 @item Compiler | 900 @item Compiler |
894 On a related point, there is no Octave compiler, and so you can't | 901 On a related point, there is no Octave compiler, and so you can't |
895 convert your Octave code into a binary for additional speed or | 902 convert your Octave code into a binary for additional speed or |
902 itself. In the 3.2.N versions of Octave the support for graphics | 909 itself. In the 3.2.N versions of Octave the support for graphics |
903 handles is converging towards full compatibility. The @code{patch} | 910 handles is converging towards full compatibility. The @code{patch} |
904 function is currently limited to 2-D patches, due to an underlying | 911 function is currently limited to 2-D patches, due to an underlying |
905 limitation in gnuplot. | 912 limitation in gnuplot. |
906 | 913 |
907 @item GUI | 914 @item GUI |
908 There are no @sc{Matlab} compatible GUI functions. There are a number of | 915 There are no @sc{Matlab} compatible GUI functions. There are a number of |
909 bindings from Octave to Tcl/Tk, Vtk and zenity included in the | 916 bindings from Octave to Tcl/Tk, Vtk and zenity included in the |
910 Octave Forge project (@url{http://octave.sourceforge.net}) for example | 917 Octave Forge project (@url{http://octave.sourceforge.net}) for example |
911 that can be used for a GUI, but these are not @sc{Matlab} | 918 that can be used for a GUI, but these are not @sc{Matlab} |
912 compatible. Work on a @sc{Matlab} compatible GUI is in an alpha stage in the | 919 compatible. Work on a @sc{Matlab} compatible GUI is in an alpha stage in the |
913 JHandles package (@url{http://octave.sourceforge.net/jhandles/index.html}). | 920 JHandles package (@url{http://octave.sourceforge.net/jhandles/index.html}). |
914 This might be an issue if you intend to exchange Octave code with | 921 This might be an issue if you intend to exchange Octave code with |
915 @sc{Matlab} users. | 922 @sc{Matlab} users. |
916 | 923 |
917 @item Simulink | 924 @item Simulink |
918 Octave itself includes no Simulink support. Typically the simulink | 925 Octave itself includes no Simulink support. Typically the simulink |
919 models lag research and are less flexible, so shouldn't really be used | 926 models lag research and are less flexible, so shouldn't really be used |
920 in a research environment. However, some @sc{Matlab} users that try to | 927 in a research environment. However, some @sc{Matlab} users that try to |
921 use Octave complain about this lack. There is a similar package to | 928 use Octave complain about this lack. There is a similar package to |
922 simulink for the Octave and R projects available at | 929 simulink for the Octave and R projects available at |
930 @c is this project in any state of usability? | |
923 @url{http://www.scicraft.org/} | 931 @url{http://www.scicraft.org/} |
924 | 932 |
925 @item Mex-Files | 933 @item Mex-Files |
926 Octave includes an API to the @sc{Matlab} MEX interface. However, as MEX is | 934 Octave includes an API to the @sc{Matlab} MEX interface. However, as MEX is |
927 an API to the internals of @sc{Matlab} and the internals of Octave | 935 an API to the internals of @sc{Matlab} and the internals of Octave |
943 There are some differences in the mat v5 file format accepted by | 951 There are some differences in the mat v5 file format accepted by |
944 Octave. @sc{Matlab} recently introduced the "-V7.3" save option which is | 952 Octave. @sc{Matlab} recently introduced the "-V7.3" save option which is |
945 an HDF5 format which is particularly useful for 64-bit platforms where | 953 an HDF5 format which is particularly useful for 64-bit platforms where |
946 the standard @sc{Matlab} format can not correctly save variables.. Octave | 954 the standard @sc{Matlab} format can not correctly save variables.. Octave |
947 accepts HDF5 files, but is not yet compatible with the "-v7.3" versions | 955 accepts HDF5 files, but is not yet compatible with the "-v7.3" versions |
948 produced by @sc{Matlab}. | 956 produced by @sc{Matlab}. |
949 | 957 |
950 Although Octave can load inline abd function handles saved by | 958 Although Octave can load inline abd function handles saved by |
951 @sc{Matlab}, it can not yet save them. | 959 @sc{Matlab}, it can not yet save them. |
952 | 960 |
953 Finally, Some multi-byte unicode characters aren't yet treated in | 961 Finally, Some multi-byte unicode characters aren't yet treated in |
967 donated by those interested in them through the Octave Forge website | 975 donated by those interested in them through the Octave Forge website |
968 (@url{http://octave.sourceforge.net}). These might be lacking in certain | 976 (@url{http://octave.sourceforge.net}). These might be lacking in certain |
969 functionality relative to the @sc{Matlab} toolboxes, and might not | 977 functionality relative to the @sc{Matlab} toolboxes, and might not |
970 exactly duplicate the @sc{Matlab} functionality or interface. | 978 exactly duplicate the @sc{Matlab} functionality or interface. |
971 | 979 |
980 @c TODO: Update this to mention how it's now enabled in Octave | |
972 @item Short-circuit & and | operators | 981 @item Short-circuit & and | operators |
973 The @code{&} and @code{|} operators in @sc{Matlab} short-circuit when | 982 The @code{&} and @code{|} operators in @sc{Matlab} short-circuit when |
974 included in an if statemant and not otherwise. In Octave only the | 983 included in an if statemant and not otherwise. In Octave only the |
975 @code{&&} and @code{||} short circuit. Note that this means that | 984 @code{&&} and @code{||} short circuit. Note that this means that |
976 | 985 |
1089 relative to the minimum-norm solution? Can it be nicely bounded, or can it be | 1098 relative to the minimum-norm solution? Can it be nicely bounded, or can it be |
1090 arbitrarily big? Consider this example: | 1099 arbitrarily big? Consider this example: |
1091 | 1100 |
1092 @example | 1101 @example |
1093 @group | 1102 @group |
1094 m = 10; | 1103 m = 10; |
1095 n = 10000; | 1104 n = 10000; |
1096 A = ones(m, n) + 1e-6 * randn(m,n); | 1105 A = ones(m, n) + 1e-6 * randn(m,n); |
1097 b = ones(m, 1) + 1e-6 * randn(m,1); | 1106 b = ones(m, 1) + 1e-6 * randn(m,1); |
1098 norm(A \ b) | 1107 norm(A \ b) |
1099 @end group | 1108 @end group |
1100 @end example | 1109 @end example |
1101 | 1110 |
1102 @noindent | 1111 @noindent |
1103 while Octave's minimum-norm values are around 3e-2, @sc{Matlab}'s results | 1112 while Octave's minimum-norm values are around 3e-2, @sc{Matlab}'s results |
1104 are 50-times larger. For another issue, try this code: | 1113 are 50-times larger. For another issue, try this code: |
1105 | 1114 |
1106 @example | 1115 @example |
1107 @group | 1116 @group |
1108 m = 5; | 1117 m = 5; |
1109 n = 100; | 1118 n = 100; |
1110 j = floor(m * rand(1, n)) + 1; | 1119 j = floor(m * rand(1, n)) + 1; |
1111 b = ones(m, 1); | 1120 b = ones(m, 1); |
1112 A = zeros(m, n); | 1121 A = zeros(m, n); |
1113 A(sub2ind(size(A),j,1:n)) = 1; | 1122 A(sub2ind(size(A),j,1:n)) = 1; |
1114 x = A \ b; | 1123 x = A \ b; |
1115 [dummy,p] = sort(rand(1,n)); | 1124 [dummy,p] = sort(rand(1,n)); |
1116 y = A(:,p)\b; | 1125 y = A(:,p)\b; |
1117 norm(x(p)-y) | 1126 norm(x(p)-y) |
1118 @end group | 1127 @end group |
1119 @end example | 1128 @end example |
1120 | 1129 |
1121 @noindent | 1130 @noindent |
1123 with respect to column permutations. If there are multiple columns of | 1132 with respect to column permutations. If there are multiple columns of |
1124 the same norm, permuting columns of the matrix gets you different | 1133 the same norm, permuting columns of the matrix gets you different |
1125 result than permuting the solution vector. This will surprise many | 1134 result than permuting the solution vector. This will surprise many |
1126 users. | 1135 users. |
1127 | 1136 |
1128 Since the mldivide (\) and mrdivide (/) operators are often part of a more | 1137 Since the mldivide (\) and mrdivide (/) operators are often part of a more |
1129 complex expression, where there is no room to react to warnings or flags, it | 1138 complex expression, where there is no room to react to warnings or flags, it |
1130 should prefer intelligence (robustness) to speed, and so the Octave developers | 1139 should prefer intelligence (robustness) to speed, and so the Octave developers |
1131 are firmly of the opinion that Octave's approach for singular, under- and | 1140 are firmly of the opinion that Octave's approach for singular, under- and |
1132 over-determined matrices is a better choice that @sc{Matlab}'s | 1141 over-determined matrices is a better choice that @sc{Matlab}'s |
1133 | 1142 |
1134 @item Octave extensions | 1143 @item Octave extensions |