annotate doc/interpreter/numbers.txi @ 19627:446c46af4b42 stable

strip trailing whitespace from most source files * Makefile.am, NEWS, build-aux/common.mk, configure.ac, doc/Makefile.am, doc/doxyhtml/Makefile.am, doc/interpreter/Makefile.am, doc/interpreter/arith.txi, doc/interpreter/audio.txi, doc/interpreter/basics.txi, doc/interpreter/bugs.txi, doc/interpreter/container.txi, doc/interpreter/cp-idx.txi, doc/interpreter/data.txi, doc/interpreter/debug.txi, doc/interpreter/diagperm.txi, doc/interpreter/diffeq.txi, doc/interpreter/doccheck/README, doc/interpreter/doccheck/spellcheck, doc/interpreter/emacs.txi, doc/interpreter/errors.txi, doc/interpreter/eval.txi, doc/interpreter/expr.txi, doc/interpreter/external.txi, doc/interpreter/fn-idx.txi, doc/interpreter/func.txi, doc/interpreter/geometry.txi, doc/interpreter/geometryimages.m, doc/interpreter/gpl.txi, doc/interpreter/grammar.txi, doc/interpreter/gui.txi, doc/interpreter/image.txi, doc/interpreter/install.txi, doc/interpreter/interp.txi, doc/interpreter/interpimages.m, doc/interpreter/intro.txi, doc/interpreter/io.txi, doc/interpreter/java.txi, doc/interpreter/linalg.txi, doc/interpreter/macros.texi, doc/interpreter/matrix.txi, doc/interpreter/munge-texi.pl, doc/interpreter/nonlin.txi, doc/interpreter/numbers.txi, doc/interpreter/obsolete.txi, doc/interpreter/octave-config.1, doc/interpreter/octave.texi, doc/interpreter/oop.txi, doc/interpreter/op-idx.txi, doc/interpreter/optim.txi, doc/interpreter/package.txi, doc/interpreter/plot.txi, doc/interpreter/poly.txi, doc/interpreter/preface.txi, doc/interpreter/quad.txi, doc/interpreter/set.txi, doc/interpreter/signal.txi, doc/interpreter/sparse.txi, doc/interpreter/sparseimages.m, doc/interpreter/splineimages.m, doc/interpreter/stats.txi, doc/interpreter/stmt.txi, doc/interpreter/strings.txi, doc/interpreter/system.txi, doc/interpreter/testfun.txi, doc/interpreter/tips.txi, doc/interpreter/var.txi, doc/interpreter/vectorize.txi, doc/liboctave/Makefile.am, doc/liboctave/array.texi, doc/liboctave/bugs.texi, doc/liboctave/cp-idx.texi, doc/liboctave/dae.texi, doc/liboctave/diffeq.texi, doc/liboctave/error.texi, doc/liboctave/factor.texi, doc/liboctave/fn-idx.texi, doc/liboctave/gpl.texi, doc/liboctave/install.texi, doc/liboctave/intro.texi, doc/liboctave/liboctave.texi, doc/liboctave/matvec.texi, doc/liboctave/nleqn.texi, doc/liboctave/nlfunc.texi, doc/liboctave/ode.texi, doc/liboctave/optim.texi, doc/liboctave/preface.texi, doc/liboctave/quad.texi, doc/liboctave/range.texi, doc/refcard/Makefile.am, doc/refcard/refcard.tex, etc/HACKING, etc/NEWS.1, etc/NEWS.2, etc/NEWS.3, etc/OLD-ChangeLogs/ChangeLog, etc/OLD-ChangeLogs/doc-ChangeLog, etc/OLD-ChangeLogs/scripts-ChangeLog, etc/OLD-ChangeLogs/src-ChangeLog, etc/OLD-ChangeLogs/test-ChangeLog, etc/PROJECTS, etc/README.Cygwin, etc/README.MacOS, etc/README.MinGW, etc/README.gnuplot, etc/gdbinit, etc/icons/Makefile.am, examples/@polynomial/end.m, examples/@polynomial/subsasgn.m, examples/Makefile.am, examples/standalonebuiltin.cc, libgui/Makefile.am, libgui/qterminal/libqterminal/README, libgui/qterminal/libqterminal/unix/BlockArray.cpp, libgui/qterminal/libqterminal/unix/BlockArray.h, libgui/qterminal/libqterminal/unix/Character.h, libgui/qterminal/libqterminal/unix/CharacterColor.h, libgui/qterminal/libqterminal/unix/Emulation.cpp, libgui/qterminal/libqterminal/unix/Emulation.h, libgui/qterminal/libqterminal/unix/Filter.cpp, libgui/qterminal/libqterminal/unix/Filter.h, libgui/qterminal/libqterminal/unix/History.cpp, libgui/qterminal/libqterminal/unix/History.h, libgui/qterminal/libqterminal/unix/KeyboardTranslator.cpp, libgui/qterminal/libqterminal/unix/KeyboardTranslator.h, libgui/qterminal/libqterminal/unix/LineFont.h, libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp, libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.h, libgui/qterminal/libqterminal/unix/Screen.cpp, libgui/qterminal/libqterminal/unix/Screen.h, libgui/qterminal/libqterminal/unix/ScreenWindow.cpp, libgui/qterminal/libqterminal/unix/ScreenWindow.h, libgui/qterminal/libqterminal/unix/TerminalCharacterDecoder.cpp, libgui/qterminal/libqterminal/unix/TerminalCharacterDecoder.h, libgui/qterminal/libqterminal/unix/Vt102Emulation.h, libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp, libgui/qterminal/qterminal/main.cpp, libgui/src/m-editor/file-editor-tab.cc, libgui/src/octave-gui.cc, libgui/src/octave-qt-link.cc, libinterp/corefcn/data.cc, libinterp/corefcn/defun-int.h, libinterp/corefcn/det.cc, libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/lu.cc, libinterp/corefcn/oct-tex-parser.yy, libinterp/corefcn/oct-tex-symbols.in, libinterp/corefcn/quadcc.cc, libinterp/corefcn/zfstream.cc, libinterp/dldfcn/__eigs__.cc, libinterp/dldfcn/__voronoi__.cc, libinterp/gendoc.pl, libinterp/genprops.awk, libinterp/mk-errno-list, libinterp/mk-pkg-add, libinterp/mkbuiltins, libinterp/mkdefs, libinterp/mkdocs, libinterp/mkops, libinterp/octave-value/ov-java.cc, libinterp/parse-tree/lex.ll, libinterp/parse-tree/oct-parse.in.yy, libinterp/parse-tree/octave.gperf, liboctave/Makefile.am, liboctave/array/Array.cc, liboctave/array/module.mk, liboctave/cruft/daspk/datv.f, liboctave/cruft/daspk/dcnst0.f, liboctave/cruft/daspk/dcnstr.f, liboctave/cruft/daspk/ddasic.f, liboctave/cruft/daspk/ddasid.f, liboctave/cruft/daspk/ddasik.f, liboctave/cruft/daspk/ddaspk.f, liboctave/cruft/daspk/ddstp.f, liboctave/cruft/daspk/ddwnrm.f, liboctave/cruft/daspk/dfnrmd.f, liboctave/cruft/daspk/dfnrmk.f, liboctave/cruft/daspk/dhels.f, liboctave/cruft/daspk/dheqr.f, liboctave/cruft/daspk/dinvwt.f, liboctave/cruft/daspk/dlinsd.f, liboctave/cruft/daspk/dlinsk.f, liboctave/cruft/daspk/dmatd.f, liboctave/cruft/daspk/dnedd.f, liboctave/cruft/daspk/dnedk.f, liboctave/cruft/daspk/dnsd.f, liboctave/cruft/daspk/dnsid.f, liboctave/cruft/daspk/dnsik.f, liboctave/cruft/daspk/dnsk.f, liboctave/cruft/daspk/dorth.f, liboctave/cruft/daspk/dslvd.f, liboctave/cruft/daspk/dslvk.f, liboctave/cruft/daspk/dspigm.f, liboctave/cruft/daspk/dyypnw.f, liboctave/cruft/dasrt/ddasrt.f, liboctave/cruft/dasrt/drchek.f, liboctave/cruft/dassl/ddaslv.f, liboctave/cruft/dassl/ddassl.f, liboctave/cruft/misc/blaswrap.c, liboctave/cruft/misc/module.mk, liboctave/cruft/odepack/cfode.f, liboctave/cruft/odepack/dlsode.f, liboctave/cruft/odepack/ewset.f, liboctave/cruft/odepack/intdy.f, liboctave/cruft/odepack/prepj.f, liboctave/cruft/odepack/sintdy.f, liboctave/cruft/odepack/slsode.f, liboctave/cruft/odepack/solsy.f, liboctave/cruft/odepack/ssolsy.f, liboctave/cruft/odepack/stode.f, liboctave/cruft/odepack/vnorm.f, liboctave/cruft/ranlib/Basegen.doc, liboctave/cruft/ranlib/README, liboctave/cruft/ranlib/genbet.f, liboctave/cruft/ranlib/genexp.f, liboctave/cruft/ranlib/gennch.f, liboctave/cruft/ranlib/gennf.f, liboctave/cruft/ranlib/gennor.f, liboctave/cruft/ranlib/getsd.f, liboctave/cruft/ranlib/initgn.f, liboctave/cruft/ranlib/phrtsd.f, liboctave/cruft/ranlib/randlib.fdoc, liboctave/cruft/ranlib/setsd.f, liboctave/cruft/ranlib/tstgmn.for, liboctave/cruft/ranlib/tstmid.for, liboctave/cruft/slatec-fn/atanh.f, liboctave/cruft/slatec-fn/datanh.f, liboctave/cruft/slatec-fn/xgmainc.f, liboctave/cruft/slatec-fn/xsgmainc.f, liboctave/numeric/module.mk, liboctave/operators/mk-ops.awk, liboctave/operators/mx-ops, liboctave/operators/sparse-mk-ops.awk, liboctave/operators/sparse-mx-ops, liboctave/operators/vx-ops, liboctave/util/module.mk, run-octave.in, scripts/@ftp/ftp.m, scripts/audio/wavread.m, scripts/deprecated/java_convert_matrix.m, scripts/deprecated/java_debug.m, scripts/deprecated/java_invoke.m, scripts/deprecated/java_new.m, scripts/deprecated/java_unsigned_conversion.m, scripts/deprecated/javafields.m, scripts/deprecated/javamethods.m, scripts/deprecated/shell_cmd.m, scripts/general/accumarray.m, scripts/general/display.m, scripts/general/fieldnames.m, scripts/general/interp1.m, scripts/general/interp2.m, scripts/general/interp3.m, scripts/general/isa.m, scripts/general/methods.m, scripts/general/sortrows.m, scripts/geometry/convhull.m, scripts/geometry/delaunay.m, scripts/geometry/delaunay3.m, scripts/geometry/delaunayn.m, scripts/geometry/griddata.m, scripts/geometry/griddatan.m, scripts/geometry/voronoi.m, scripts/geometry/voronoin.m, scripts/gui/guihandles.m, scripts/gui/inputdlg.m, scripts/gui/listdlg.m, scripts/gui/msgbox.m, scripts/gui/questdlg.m, scripts/gui/uigetfile.m, scripts/gui/waitbar.m, scripts/gui/warndlg.m, scripts/help/doc.m, scripts/help/help.m, scripts/help/type.m, scripts/image/bone.m, scripts/image/cmpermute.m, scripts/image/cmunique.m, scripts/image/colorcube.m, scripts/image/colormap.m, scripts/image/contrast.m, scripts/image/gray2ind.m, scripts/image/image.m, scripts/image/imshow.m, scripts/image/ind2gray.m, scripts/image/jet.m, scripts/image/rgb2ntsc.m, scripts/image/spinmap.m, scripts/io/importdata.m, scripts/io/strread.m, scripts/io/textread.m, scripts/io/textscan.m, scripts/java/java_get.m, scripts/java/java_set.m, scripts/java/javaaddpath.m, scripts/java/javaclasspath.m, scripts/java/javamem.m, scripts/linear-algebra/linsolve.m, scripts/linear-algebra/qzhess.m, scripts/miscellaneous/debug.m, scripts/miscellaneous/desktop.m, scripts/miscellaneous/dir.m, scripts/miscellaneous/dos.m, scripts/miscellaneous/edit.m, scripts/miscellaneous/fact.m, scripts/miscellaneous/getappdata.m, scripts/miscellaneous/inputname.m, scripts/miscellaneous/license.m, scripts/miscellaneous/ls_command.m, scripts/miscellaneous/run.m, scripts/miscellaneous/setfield.m, scripts/miscellaneous/unix.m, scripts/miscellaneous/ver.m, scripts/mk-pkg-add, scripts/mkdoc.pl, scripts/optimization/fminsearch.m, scripts/optimization/optimset.m, scripts/optimization/sqp.m, scripts/pkg/pkg.m, scripts/pkg/private/create_pkgadddel.m, scripts/pkg/private/fix_depends.m, scripts/pkg/private/install.m, scripts/plot/appearance/axis.m, scripts/plot/appearance/box.m, scripts/plot/appearance/clabel.m, scripts/plot/appearance/daspect.m, scripts/plot/appearance/datetick.m, scripts/plot/appearance/grid.m, scripts/plot/appearance/legend.m, scripts/plot/appearance/orient.m, scripts/plot/appearance/shading.m, scripts/plot/appearance/text.m, scripts/plot/appearance/title.m, scripts/plot/appearance/xlabel.m, scripts/plot/appearance/ylabel.m, scripts/plot/appearance/zlabel.m, scripts/plot/draw/area.m, scripts/plot/draw/bar.m, scripts/plot/draw/barh.m, scripts/plot/draw/colorbar.m, scripts/plot/draw/contour.m, scripts/plot/draw/contour3.m, scripts/plot/draw/contourf.m, scripts/plot/draw/ellipsoid.m, scripts/plot/draw/errorbar.m, scripts/plot/draw/ezcontour.m, scripts/plot/draw/ezcontourf.m, scripts/plot/draw/ezmesh.m, scripts/plot/draw/ezpolar.m, scripts/plot/draw/fill.m, scripts/plot/draw/fplot.m, scripts/plot/draw/hist.m, scripts/plot/draw/meshc.m, scripts/plot/draw/meshz.m, scripts/plot/draw/pareto.m, scripts/plot/draw/patch.m, scripts/plot/draw/peaks.m, scripts/plot/draw/pie.m, scripts/plot/draw/pie3.m, scripts/plot/draw/plot.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/private/__bar__.m, scripts/plot/draw/private/__contour__.m, scripts/plot/draw/private/__errplot__.m, scripts/plot/draw/private/__ezplot__.m, scripts/plot/draw/private/__patch__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/rectangle.m, scripts/plot/draw/ribbon.m, scripts/plot/draw/rose.m, scripts/plot/draw/scatter.m, scripts/plot/draw/scatter3.m, scripts/plot/draw/semilogx.m, scripts/plot/draw/shrinkfaces.m, scripts/plot/draw/sombrero.m, scripts/plot/draw/sphere.m, scripts/plot/draw/stairs.m, scripts/plot/draw/stem.m, scripts/plot/draw/stemleaf.m, scripts/plot/draw/surf.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfc.m, scripts/plot/draw/surfl.m, scripts/plot/draw/surfnorm.m, scripts/plot/draw/tetramesh.m, scripts/plot/draw/trimesh.m, scripts/plot/draw/triplot.m, scripts/plot/draw/trisurf.m, scripts/plot/util/__gnuplot_drawnow__.m, scripts/plot/util/__plt_get_axis_arg__.m, scripts/plot/util/axes.m, scripts/plot/util/clf.m, scripts/plot/util/copyobj.m, scripts/plot/util/figure.m, scripts/plot/util/gcbo.m, scripts/plot/util/graphics_toolkit.m, scripts/plot/util/hggroup.m, scripts/plot/util/meshgrid.m, scripts/plot/util/newplot.m, scripts/plot/util/print.m, scripts/plot/util/private/__add_default_menu__.m, scripts/plot/util/private/__fltk_print__.m, scripts/plot/util/private/__gnuplot_print__.m, scripts/plot/util/private/__print_parse_opts__.m, scripts/plot/util/refreshdata.m, scripts/plot/util/subplot.m, scripts/polynomial/conv.m, scripts/polynomial/poly.m, scripts/polynomial/polyeig.m, scripts/polynomial/polyfit.m, scripts/polynomial/polyval.m, scripts/polynomial/private/__splinefit__.m, scripts/polynomial/spline.m, scripts/prefs/prefdir.m, scripts/prefs/preferences.m, scripts/prefs/private/prefsfile.m, scripts/prefs/rmpref.m, scripts/signal/freqz.m, scripts/signal/module.mk, scripts/sparse/eigs.m, scripts/sparse/pcg.m, scripts/sparse/private/__sprand_impl__.m, scripts/sparse/sprand.m, scripts/sparse/sprandn.m, scripts/sparse/spy.m, scripts/sparse/svds.m, scripts/specfun/expint.m, scripts/specfun/factor.m, scripts/special-matrix/gallery.m, scripts/special-matrix/hankel.m, scripts/special-matrix/toeplitz.m, scripts/startup/inputrc, scripts/statistics/base/kurtosis.m, scripts/statistics/base/moment.m, scripts/statistics/base/qqplot.m, scripts/statistics/base/var.m, scripts/statistics/distributions/betarnd.m, scripts/statistics/distributions/binoinv.m, scripts/statistics/distributions/binopdf.m, scripts/statistics/distributions/binornd.m, scripts/statistics/distributions/cauchy_rnd.m, scripts/statistics/distributions/chi2rnd.m, scripts/statistics/distributions/discrete_pdf.m, scripts/statistics/distributions/discrete_rnd.m, scripts/statistics/distributions/empirical_rnd.m, scripts/statistics/distributions/exprnd.m, scripts/statistics/distributions/frnd.m, scripts/statistics/distributions/gamrnd.m, scripts/statistics/distributions/geornd.m, scripts/statistics/distributions/hygernd.m, scripts/statistics/distributions/kolmogorov_smirnov_cdf.m, scripts/statistics/distributions/laplace_cdf.m, scripts/statistics/distributions/laplace_pdf.m, scripts/statistics/distributions/logistic_cdf.m, scripts/statistics/distributions/logistic_pdf.m, scripts/statistics/distributions/lognrnd.m, scripts/statistics/distributions/nbincdf.m, scripts/statistics/distributions/nbininv.m, scripts/statistics/distributions/nbinpdf.m, scripts/statistics/distributions/nbinrnd.m, scripts/statistics/distributions/normrnd.m, scripts/statistics/distributions/poissinv.m, scripts/statistics/distributions/poissrnd.m, scripts/statistics/distributions/tinv.m, scripts/statistics/distributions/trnd.m, scripts/statistics/distributions/unidcdf.m, scripts/statistics/distributions/unidpdf.m, scripts/statistics/distributions/unidrnd.m, scripts/statistics/distributions/unifrnd.m, scripts/statistics/distributions/wblrnd.m, scripts/statistics/models/module.mk, scripts/statistics/tests/kruskal_wallis_test.m, scripts/strings/base2dec.m, scripts/strings/deblank.m, scripts/strings/dec2base.m, scripts/strings/dec2bin.m, scripts/strings/dec2hex.m, scripts/strings/mat2str.m, scripts/strings/ostrsplit.m, scripts/strings/regexptranslate.m, scripts/strings/str2num.m, scripts/strings/strcat.m, scripts/strings/strjoin.m, scripts/strings/strsplit.m, scripts/strings/strtok.m, scripts/strings/strtrim.m, scripts/strings/strtrunc.m, scripts/strings/substr.m, scripts/testfun/__run_test_suite__.m, scripts/testfun/speed.m, scripts/testfun/test.m, scripts/time/asctime.m, scripts/time/datenum.m, scripts/time/datevec.m, scripts/time/weekday.m, src/Makefile.am, test/Makefile.am, test/build-bc-overload-tests.sh, test/build-sparse-tests.sh, test/jit.tst, test/line-continue.tst: Strip trailing whitespace.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 08:26:57 -0500
parents d63878346099
children 0e1f5a750d00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17390
diff changeset
1 @c Copyright (C) 1996-2013 John W. Eaton
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
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
5 @c Octave is free software; you can redistribute it and/or modify it
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
6 @c under the terms of the GNU General Public License as published by the
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
7 @c Free Software Foundation; either version 3 of the License, or (at
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
8 @c your option) any later version.
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
9 @c
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
13 @c for more details.
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
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
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
17 @c <http://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: 4029
diff changeset
19 @node Numeric Data Types
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
20 @chapter Numeric Data Types
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
21 @cindex numeric constant
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
22 @cindex numeric value
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
23
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
24 A @dfn{numeric constant} may be a scalar, a vector, or a matrix, and it
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
25 may contain complex values.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
26
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
27 The simplest form of a numeric constant, a scalar, is a single number
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
28 that can be an integer, a decimal fraction, a number in scientific
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
29 (exponential) notation, or a complex number. Note that by default numeric
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
30 constants are represented within Octave in double-precision floating
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
31 point format (complex constants are stored as pairs of double-precision
17097
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 16939
diff changeset
32 floating point values). It is, however, possible to represent real
8534
0eb83938c8bc Trivial fixes in numbers.txi
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
33 integers as described in @ref{Integer Data Types}. Here are some
0eb83938c8bc Trivial fixes in numbers.txi
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
34 examples of real-valued numeric constants, which all have the same
0eb83938c8bc Trivial fixes in numbers.txi
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
35 value:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
36
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
37 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
38 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
39 105
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
40 1.05e+2
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
41 1050e-1
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
42 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
43 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
44
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
45 To specify complex constants, you can write an expression of the form
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
46
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
47 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
48 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
49 3 + 4i
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
50 3.0 + 4.0i
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
51 0.3e1 + 40e-1i
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
52 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
53 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
54
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
55 @noindent
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
56 all of which are equivalent. The letter @samp{i} in the previous example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
57 stands for the pure imaginary constant, defined as
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
58 @tex
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
59 $\sqrt{-1}$.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
60 @end tex
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
61 @ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
62 @code{sqrt (-1)}.
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
63 @end ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
64
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
65 For Octave to recognize a value as the imaginary part of a complex
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
66 constant, a space must not appear between the number and the @samp{i}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
67 If it does, Octave will print an error message, like this:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
68
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
69 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
70 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
71 octave:13> 3 + 4 i
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
72
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
73 parse error:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
74
8015
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
75 syntax error
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
76
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
77 >>> 3 + 4 i
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
78 ^
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
79 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
80 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
81
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
82 @noindent
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
83 You may also use @samp{j}, @samp{I}, or @samp{J} in place of the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
84 @samp{i} above. All four forms are equivalent.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
85
6549
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
86 @DOCSTRING(double)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
87
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
88 @DOCSTRING(complex)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
89
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
90 @menu
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
91 * Matrices::
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
92 * Ranges::
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
93 * Single Precision Data Types::
6549
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
94 * Integer Data Types::
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
95 * Bit Manipulations::
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
96 * Logical Values::
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
97 * Promotion and Demotion of Data Types::
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
98 * Predicates for Numeric Objects::
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
99 @end menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
100
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 4029
diff changeset
101 @node Matrices
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
102 @section Matrices
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
103 @cindex matrices
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
104
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
105 @opindex [
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
106 @opindex ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
107 @opindex ;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
108 @opindex ,
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
109
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
110 It is easy to define a matrix of values in Octave. The size of the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
111 matrix is determined automatically, so it is not necessary to explicitly
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
112 state the dimensions. The expression
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
113
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
114 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
115 a = [1, 2; 3, 4]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
116 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
117
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
118 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
119 results in the matrix
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
120 @tex
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
121 $$ a = \left[ \matrix{ 1 & 2 \cr 3 & 4 } \right] $$
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
122 @end tex
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
123 @ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
124
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
125 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
126 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
127
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
128 / \
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
129 | 1 2 |
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
130 a = | |
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
131 | 3 4 |
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
132 \ /
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
133
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
134 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
135 @end example
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10791
diff changeset
136
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
137 @end ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
138
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
139 Elements of a matrix may be arbitrary expressions, provided that the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
140 dimensions all make sense when combining the various pieces. For
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
141 example, given the above matrix, the expression
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
142
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
143 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
144 [ a, a ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
145 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
146
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
147 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
148 produces the matrix
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
149
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
150 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
151 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
152 ans =
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
153
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
154 1 2 1 2
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
155 3 4 3 4
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
156 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
157 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
158
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
159 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
160 but the expression
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
161
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
162 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
163 [ a, 1 ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
164 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
165
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
166 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
167 produces the error
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
168
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
169 @example
8015
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
170 error: number of rows must match (1 != 2) near line 13, column 6
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
171 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
172
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
173 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
174 (assuming that this expression was entered as the first thing on line
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
175 13, of course).
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
176
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
177 Inside the square brackets that delimit a matrix expression, Octave
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
178 looks at the surrounding context to determine whether spaces and newline
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
179 characters should be converted into element and row separators, or
4476
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
180 simply ignored, so an expression like
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
181
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
182 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
183 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
184 a = [ 1 2
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
185 3 4 ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
186 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
187 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
188
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
189 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
190 will work. However, some possible sources of confusion remain. For
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
191 example, in the expression
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
192
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
193 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
194 [ 1 - 1 ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
195 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
196
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
197 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
198 the @samp{-} is treated as a binary operator and the result is the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
199 scalar 0, but in the expression
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
200
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
201 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
202 [ 1 -1 ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
203 @end example
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 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
206 the @samp{-} is treated as a unary operator and the result is the
4476
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
207 vector @code{[ 1, -1 ]}. Similarly, the expression
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
208
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
209 @example
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
210 [ sin (pi) ]
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
211 @end example
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
212
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
213 @noindent
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
214 will be parsed as
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
215
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
216 @example
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
217 [ sin, (pi) ]
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
218 @end example
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
219
4476
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
220 @noindent
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
221 and will result in an error since the @code{sin} function will be
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
222 called with no arguments. To get around this, you must omit the space
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
223 between @code{sin} and the opening parenthesis, or enclose the
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
224 expression in a set of parentheses:
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
225
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
226 @example
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
227 [ (sin (pi)) ]
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
228 @end example
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
229
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
230 Whitespace surrounding the single quote character (@samp{'}, used as a
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
231 transpose operator and for delimiting character strings) can also cause
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
232 confusion. Given @code{a = 1}, the expression
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
233
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
234 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
235 [ 1 a' ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
236 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
237
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
238 @noindent
4476
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
239 results in the single quote character being treated as a
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
240 transpose operator and the result is the vector @code{[ 1, 1 ]}, but the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
241 expression
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
242
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
243 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
244 [ 1 a ' ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
245 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
246
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
247 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
248 produces the error message
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
249
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
250 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
251 @group
8015
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
252 parse error:
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
253
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
254 syntax error
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
255
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
256 >>> [ 1 a ' ]
30629059b72d Update the manual to reflect the changes in error output
sh@sh-laptop
parents: 7989
diff changeset
257 ^
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
258 @end group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
259 @end example
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 @noindent
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
262 because not doing so would cause trouble when parsing the valid expression
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
263
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
264 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
265 [ a 'foo' ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
266 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
267
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
268 For clarity, it is probably best to always use commas and semicolons to
4476
b7360f8eb035 [project @ 2003-07-30 17:17:21 by jwe]
jwe
parents: 4460
diff changeset
269 separate matrix elements and rows.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
270
12190
66b2c377b38e Add sizemax function to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11573
diff changeset
271 The maximum number of elements in a matrix is fixed when Octave is compiled.
66b2c377b38e Add sizemax function to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11573
diff changeset
272 The allowable number can be queried with the function @code{sizemax}. Note
66b2c377b38e Add sizemax function to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11573
diff changeset
273 that other factors, such as the amount of memory available on your machine,
66b2c377b38e Add sizemax function to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11573
diff changeset
274 may limit the maximum size of matrices to something smaller.
66b2c377b38e Add sizemax function to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11573
diff changeset
275
66b2c377b38e Add sizemax function to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11573
diff changeset
276 @DOCSTRING(sizemax)
66b2c377b38e Add sizemax function to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11573
diff changeset
277
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
278 When you type a matrix or the name of a variable whose value is a
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
279 matrix, Octave responds by printing the matrix in with neatly aligned
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
280 rows and columns. If the rows of the matrix are too large to fit on the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
281 screen, Octave splits the matrix and displays a header before each
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
282 section to indicate which columns are being displayed. You can use the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
283 following variables to control the format of the output.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
284
3321
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3294
diff changeset
285 @DOCSTRING(output_max_field_width)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
286
3321
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3294
diff changeset
287 @DOCSTRING(output_precision)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
288
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
289 It is possible to achieve a wide range of output styles by using
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
290 different values of @code{output_precision} and
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
291 @code{output_max_field_width}. Reasonable combinations can be set using
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
292 the @code{format} function. @xref{Basic Input and Output}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
293
3321
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3294
diff changeset
294 @DOCSTRING(split_long_rows)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
295
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
296 Octave automatically switches to scientific notation when values become
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
297 very large or very small. This guarantees that you will see several
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
298 significant figures for every value in a matrix. If you would prefer to
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
299 see all values in a matrix printed in a fixed point format, you can set
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
300 the built-in variable @code{fixed_point_format} to a nonzero value. But
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
301 doing so is not recommended, because it can produce output that can
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
302 easily be misinterpreted.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
303
3321
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3294
diff changeset
304 @DOCSTRING(fixed_point_format)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
305
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
306 @menu
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
307 * Empty Matrices::
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
308 @end menu
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
309
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 4029
diff changeset
310 @node Empty Matrices
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
311 @subsection Empty Matrices
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
312
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
313 A matrix may have one or both dimensions zero, and operations on empty
10791
3140cb7a05a1 Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents: 9209
diff changeset
314 matrices are handled as described by Carl @nospell{de} Boor in @cite{An Empty
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
315 Exercise}, SIGNUM, Volume 25, pages 2-6, 1990 and C. N. Nett and W. M.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
316 Haddad, in @cite{A System-Theoretic Appropriate Realization of the Empty
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
317 Matrix Concept}, IEEE Transactions on Automatic Control, Volume 38,
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
318 Number 5, May 1993.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
319 @tex
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
320 Briefly, given a scalar $s$, an $m\times n$ matrix $M_{m\times n}$,
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
321 and an $m\times n$ empty matrix $[\,]_{m\times n}$ (with either one or
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
322 both dimensions equal to zero), the following are true:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
323 $$
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
324 \eqalign{%
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
325 s \cdot [\,]_{m\times n} = [\,]_{m\times n} \cdot s &= [\,]_{m\times n}\cr
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
326 [\,]_{m\times n} + [\,]_{m\times n} &= [\,]_{m\times n}\cr
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
327 [\,]_{0\times m} \cdot M_{m\times n} &= [\,]_{0\times n}\cr
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
328 M_{m\times n} \cdot [\,]_{n\times 0} &= [\,]_{m\times 0}\cr
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
329 [\,]_{m\times 0} \cdot [\,]_{0\times n} &= 0_{m\times n}}
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 @end tex
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
332 @ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
333 Briefly, given a scalar @var{s}, an @var{m} by
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
334 @var{n} matrix @code{M(mxn)}, and an @var{m} by @var{n} empty matrix
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
335 @code{[](mxn)} (with either one or both dimensions equal to zero), the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
336 following are true:
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 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
339 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
340 s * [](mxn) = [](mxn) * s = [](mxn)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
341
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
342 [](mxn) + [](mxn) = [](mxn)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
343
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
344 [](0xm) * M(mxn) = [](0xn)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
345
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
346 M(mxn) * [](nx0) = [](mx0)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
347
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
348 [](mx0) * [](0xn) = 0(mxn)
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
349 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
350 @end example
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10791
diff changeset
351
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
352 @end ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
353
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
354 By default, dimensions of the empty matrix are printed along with the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
355 empty matrix symbol, @samp{[]}. The built-in variable
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
356 @code{print_empty_dimensions} controls this behavior.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
357
3321
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3294
diff changeset
358 @DOCSTRING(print_empty_dimensions)
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 Empty matrices may also be used in assignment statements as a convenient
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
361 way to delete rows or columns of matrices.
17097
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 16939
diff changeset
362 @xref{Assignment Ops,,Assignment Expressions}.
3294
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 When Octave parses a matrix expression, it examines the elements of the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
365 list to determine whether they are all constants. If they are, it
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
366 replaces the list with a single matrix constant.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
367
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 4029
diff changeset
368 @node Ranges
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
369 @section Ranges
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
370 @cindex range expressions
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
371 @cindex expression, range
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
372
11403
b8b08b1ac21f Add missing operator functions to doc/interpreter.
Judd Storrs <jstorrs@gmail.com>
parents: 11392
diff changeset
373 @opindex :
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
374
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
375 A @dfn{range} is a convenient way to write a row vector with evenly
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
376 spaced elements. A range expression is defined by the value of the first
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
377 element in the range, an optional value for the increment between
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
378 elements, and a maximum value which the elements of the range will not
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
379 exceed. The base, increment, and limit are separated by colons (the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
380 @samp{:} character) and may contain any arithmetic expressions and
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
381 function calls. If the increment is omitted, it is assumed to be 1.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
382 For example, the range
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
383
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
384 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
385 1 : 5
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
386 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
387
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
388 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
389 defines the set of values @samp{[ 1, 2, 3, 4, 5 ]}, and the range
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
390
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
391 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
392 1 : 3 : 5
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
393 @end example
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 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
396 defines the set of values @samp{[ 1, 4 ]}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
397
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
398 Although a range constant specifies a row vector, Octave does @emph{not}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
399 convert range constants to vectors unless it is necessary to do so.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
400 This allows you to write a constant like @samp{1 : 10000} without using
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
401 80,000 bytes of storage on a typical 32-bit workstation.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
402
11179
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
403 A common example of when it does become necessary to convert ranges into
11573
6f8ffe2c6f76 Grammarcheck txi files for 3.4 release.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
404 vectors occurs when they appear within a vector (i.e., inside square
6f8ffe2c6f76 Grammarcheck txi files for 3.4 release.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
405 brackets). For instance, whereas
11179
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
406
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
407 @example
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
408 x = 0 : 0.1 : 1;
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
409 @end example
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
410
11573
6f8ffe2c6f76 Grammarcheck txi files for 3.4 release.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
411 @noindent
11179
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
412 defines @var{x} to be a variable of type @code{range} and occupies 24
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
413 bytes of memory, the expression
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
414
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
415 @example
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
416 y = [ 0 : 0.1 : 1];
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
417 @end example
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
418
11573
6f8ffe2c6f76 Grammarcheck txi files for 3.4 release.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
419 @noindent
11179
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
420 defines @var{y} to be of type @code{matrix} and occupies 88 bytes of
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
421 memory.
6ead75935ebf Explain that ranges in vectors do get expanded
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 10846
diff changeset
422
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
423 Note that the upper (or lower, if the increment is negative) bound on
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
424 the range is not always included in the set of values, and that ranges
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
425 defined by floating point values can produce surprising results because
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
426 Octave uses floating point arithmetic to compute the values in the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
427 range. If it is important to include the endpoints of a range and the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
428 number of elements is known, you should use the @code{linspace} function
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
429 instead (@pxref{Special Utility Matrices}).
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
430
9158
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
431 When adding a scalar to a range, subtracting a scalar from it (or subtracting a
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
432 range from a scalar) and multiplying by scalar, Octave will attempt to avoid
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
433 unpacking the range and keep the result as a range, too, if it can determine
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
434 that it is safe to do so. For instance, doing
9158
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
435
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
436 @example
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
437 a = 2*(1:1e7) - 1;
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
438 @end example
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
439
10846
a4f482e66b65 Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents: 10828
diff changeset
440 @noindent
9158
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
441 will produce the same result as @samp{1:2:2e7-1}, but without ever forming a
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
442 vector with ten million elements.
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
443
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
444 Using zero as an increment in the colon notation, as @samp{1:0:1} is not
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
445 allowed, because a division by zero would occur in determining the number of
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
446 range elements. However, ranges with zero increment (i.e., all elements equal)
9158
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
447 are useful, especially in indexing, and Octave allows them to be constructed
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
448 using the built-in function @dfn{ones}. Note that because a range must be a row
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10791
diff changeset
449 vector, @samp{ones (1, 10)} produces a range, while @samp{ones (10, 1)} does
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10791
diff changeset
450 not.
9158
48ee8c73ff38 info about ranges
Jaroslav Hajek <highegg@gmail.com>
parents: 9136
diff changeset
451
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
452 When Octave parses a range expression, it examines the elements of the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
453 expression to determine whether they are all constants. If they are, it
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
454 replaces the range expression with a single range constant.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
455
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
456 @node Single Precision Data Types
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
457 @section Single Precision Data Types
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
458
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
459 Octave includes support for single precision data types, and most of the
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
460 functions in Octave accept single precision values and return single
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
461 precision answers. A single precision variable is created with the
8534
0eb83938c8bc Trivial fixes in numbers.txi
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
462 @code{single} function.
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
463
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
464 @DOCSTRING(single)
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
465
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10791
diff changeset
466 for example:
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
467
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
468 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
469 @group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
470 sngl = single (rand (2, 2))
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
471 @result{} sngl =
8534
0eb83938c8bc Trivial fixes in numbers.txi
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
472 0.37569 0.92982
0eb83938c8bc Trivial fixes in numbers.txi
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
473 0.11962 0.50876
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
474 class (sngl)
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
475 @result{} single
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
476 @end group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
477 @end example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
478
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
479 Many functions can also return single precision values directly. For
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
480 example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
481
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
482 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
483 @group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
484 ones (2, 2, "single")
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
485 zeros (2, 2, "single")
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
486 eye (2, 2, "single")
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
487 rand (2, 2, "single")
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
488 NaN (2, 2, "single")
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
489 NA (2, 2, "single")
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
490 Inf (2, 2, "single")
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
491 @end group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
492 @end example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
493
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
494 @noindent
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
495 will all return single precision matrices.
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
496
6549
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
497 @node Integer Data Types
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
498 @section Integer Data Types
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
499
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
500 Octave supports integer matrices as an alternative to using double
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
501 precision. It is possible to use both signed and unsigned integers
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
502 represented by 8, 16, 32, or 64 bits. It should be noted that most
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
503 computations require floating point data, meaning that integers will
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
504 often change type when involved in numeric computations. For this
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
505 reason integers are most often used to store data, and not for
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
506 calculations.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
507
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
508 In general most integer matrices are created by casting
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
509 existing matrices to integers. The following example shows how to cast
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
510 a matrix into 32 bit integers.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
511
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
512 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
513 @group
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
514 float = rand (2, 2)
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
515 @result{} float = 0.37569 0.92982
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
516 0.11962 0.50876
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
517 integer = int32 (float)
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
518 @result{} integer = 0 1
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
519 0 1
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
520 @end group
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
521 @end example
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
522
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
523 @noindent
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
524 As can be seen, floating point values are rounded to the nearest integer
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
525 when converted.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
526
6549
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
527 @DOCSTRING(isinteger)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
528
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
529 @DOCSTRING(int8)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
530
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
531 @DOCSTRING(uint8)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
532
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
533 @DOCSTRING(int16)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
534
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
535 @DOCSTRING(uint16)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
536
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
537 @DOCSTRING(int32)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
538
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
539 @DOCSTRING(uint32)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
540
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
541 @DOCSTRING(int64)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
542
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
543 @DOCSTRING(uint64)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
544
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
545 @DOCSTRING(intmax)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
546
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
547 @DOCSTRING(intmin)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
548
17390
4bcd301754ce Add Matlab-compatible flintmax function
Mike Miller <mtmiller@ieee.org>
parents: 17281
diff changeset
549 @DOCSTRING(flintmax)
4bcd301754ce Add Matlab-compatible flintmax function
Mike Miller <mtmiller@ieee.org>
parents: 17281
diff changeset
550
6624
0d69a50fc5a9 [project @ 2007-05-15 20:17:27 by jwe]
jwe
parents: 6620
diff changeset
551 @menu
0d69a50fc5a9 [project @ 2007-05-15 20:17:27 by jwe]
jwe
parents: 6620
diff changeset
552 * Integer Arithmetic::
0d69a50fc5a9 [project @ 2007-05-15 20:17:27 by jwe]
jwe
parents: 6620
diff changeset
553 @end menu
0d69a50fc5a9 [project @ 2007-05-15 20:17:27 by jwe]
jwe
parents: 6620
diff changeset
554
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
555 @node Integer Arithmetic
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
556 @subsection Integer Arithmetic
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
557
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
558 While many numerical computations can't be carried out in integers,
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
559 Octave does support basic operations like addition and multiplication
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
560 on integers. The operators @code{+}, @code{-}, @code{.*}, and @code{./}
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
561 work on integers of the same type. So, it is possible to add two 32 bit
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
562 integers, but not to add a 32 bit integer and a 16 bit integer.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
563
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
564 When doing integer arithmetic one should consider the possibility of
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
565 underflow and overflow. This happens when the result of the computation
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
566 can't be represented using the chosen integer type. As an example it is
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
567 not possible to represent the result of @math{10 - 20} when using
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
568 unsigned integers. Octave makes sure that the result of integer
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
569 computations is the integer that is closest to the true result. So, the
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
570 result of @math{10 - 20} when using unsigned integers is zero.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
571
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
572 When doing integer division Octave will round the result to the nearest
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
573 integer. This is different from most programming languages, where the
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
574 result is often floored to the nearest integer. So, the result of
14856
c3fd61c59e9c maint: Use Octave coding conventions for cuddling parentheses in doc directory
Rik <octave@nomad.inbox5.com>
parents: 14402
diff changeset
575 @code{int32 (5) ./ int32 (8)} is @code{1}.
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
576
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
577 @DOCSTRING(idivide)
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
578
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
579 @node Bit Manipulations
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
580 @section Bit Manipulations
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
581
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
582 Octave provides a number of functions for the manipulation of numeric
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
583 values on a bit by bit basis. The basic functions to set and obtain the
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
584 values of individual bits are @code{bitset} and @code{bitget}.
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
585
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
586 @DOCSTRING(bitset)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
587
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
588 @DOCSTRING(bitget)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
589
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
590 The arguments to all of Octave's bitwise operations can be scalar or
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
591 arrays, except for @code{bitcmp}, whose @var{k} argument must a
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
592 scalar. In the case where more than one argument is an array, then all
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
593 arguments must have the same shape, and the bitwise operator is applied
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
594 to each of the elements of the argument individually. If at least one
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
595 argument is a scalar and one an array, then the scalar argument is
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
596 duplicated. Therefore
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
597
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
598 @example
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
599 bitget (100, 8:-1:1)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
600 @end example
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
601
10846
a4f482e66b65 Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents: 10828
diff changeset
602 @noindent
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
603 is the same as
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
604
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
605 @example
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
606 bitget (100 * ones (1, 8), 8:-1:1)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
607 @end example
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
608
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
609 It should be noted that all values passed to the bit manipulation
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
610 functions of Octave are treated as integers. Therefore, even though the
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
611 example for @code{bitset} above passes the floating point value
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
612 @code{10}, it is treated as the bits @code{[1, 0, 1, 0]} rather than the
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
613 bits of the native floating point format representation of @code{10}.
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
614
8828
8463d1a2e544 Doc fixes.
Brian Gough <bjg@network-theory.co.uk>
parents: 8534
diff changeset
615 As the maximum value that can be represented by a number is important
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
616 for bit manipulation, particularly when forming masks, Octave supplies
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
617 the function @code{bitmax}.
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
618
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
619 @DOCSTRING(bitmax)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
620
16939
06897f865f0b Add flintmax() as an alias for function bitmax().
Rik <rik@octave.org>
parents: 14856
diff changeset
621 This is the double precision version of the function @code{intmax},
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
622 previously discussed.
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
623
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17152
diff changeset
624 Octave also includes the basic bitwise 'and', 'or', and 'exclusive or'
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
625 operators.
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
626
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
627 @DOCSTRING(bitand)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
628
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
629 @DOCSTRING(bitor)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
630
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
631 @DOCSTRING(bitxor)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
632
8347
fa78cb8d8a5c corrections for typos
Brian Gough<bjg@network-theory.co.uk>
parents: 8325
diff changeset
633 The bitwise 'not' operator is a unary operator that performs a logical
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
634 negation of each of the bits of the value. For this to make sense, the
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
635 mask against which the value is negated must be defined. Octave's
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
636 bitwise 'not' operator is @code{bitcmp}.
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
637
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
638 @DOCSTRING(bitcmp)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
639
8347
fa78cb8d8a5c corrections for typos
Brian Gough<bjg@network-theory.co.uk>
parents: 8325
diff changeset
640 Octave also includes the ability to left-shift and right-shift values bitwise.
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
641
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
642 @DOCSTRING(bitshift)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
643
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
644 Bits that are shifted out of either end of the value are lost. Octave
8347
fa78cb8d8a5c corrections for typos
Brian Gough<bjg@network-theory.co.uk>
parents: 8325
diff changeset
645 also uses arithmetic shifts, where the sign bit of the value is kept
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10791
diff changeset
646 during a right shift. For example:
6781
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
647
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
648 @example
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
649 @group
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
650 bitshift (-10, -1)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
651 @result{} -5
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
652 bitshift (int8 (-1), -1)
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
653 @result{} -1
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
654 @end group
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
655 @end example
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
656
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
657 Note that @code{bitshift (int8 (-1), -1)} is @code{-1} since the bit
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
658 representation of @code{-1} in the @code{int8} data type is @code{[1, 1,
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
659 1, 1, 1, 1, 1, 1]}.
3058060c560f [project @ 2007-07-19 08:07:31 by dbateman]
dbateman
parents: 6778
diff changeset
660
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 4029
diff changeset
661 @node Logical Values
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
662 @section Logical Values
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
663
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
664 Octave has built-in support for logical values, i.e., variables that
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
665 are either @code{true} or @code{false}. When comparing two variables,
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
666 the result will be a logical value whose value depends on whether or
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
667 not the comparison is true.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
668
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
669 The basic logical operations are @code{&}, @code{|}, and @code{!},
8347
fa78cb8d8a5c corrections for typos
Brian Gough<bjg@network-theory.co.uk>
parents: 8325
diff changeset
670 which correspond to ``Logical And'', ``Logical Or'', and ``Logical
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
671 Negation''. These operations all follow the usual rules of logic.
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
672
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
673 It is also possible to use logical values as part of standard numerical
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
674 calculations. In this case @code{true} is converted to @code{1}, and
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
675 @code{false} to 0, both represented using double precision floating
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
676 point numbers. So, the result of @code{true*22 - false/6} is @code{22}.
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
677
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
678 Logical values can also be used to index matrices and cell arrays.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
679 When indexing with a logical array the result will be a vector containing
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
680 the values corresponding to @code{true} parts of the logical array.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
681 The following example illustrates this.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
682
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
683 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
684 @group
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
685 data = [ 1, 2; 3, 4 ];
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
686 idx = (data <= 2);
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
687 data(idx)
9136
537a73861cb7 Fix small mistake in example.
Ansgar Burchard <ansgar@43-1.org>
parents: 9036
diff changeset
688 @result{} ans = [ 1; 2 ]
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
689 @end group
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
690 @end example
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
691
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
692 @noindent
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
693 Instead of creating the @code{idx} array it is possible to replace
11376
567ca09a97aa Remove obsolete documentation about 64-bit integer arithmetic.
Rik <octave@nomad.inbox5.com>
parents: 11179
diff changeset
694 @code{data(idx)} with @w{@code{data( data <= 2 )}} in the above code.
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
695
8828
8463d1a2e544 Doc fixes.
Brian Gough <bjg@network-theory.co.uk>
parents: 8534
diff changeset
696 Logical values can also be constructed by
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
697 casting numeric objects to logical values, or by using the @code{true}
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
698 or @code{false} functions.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
699
6549
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
700 @DOCSTRING(logical)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6501
diff changeset
701
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
702 @DOCSTRING(true)
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
703
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
704 @DOCSTRING(false)
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
705
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
706 @node Promotion and Demotion of Data Types
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
707 @section Promotion and Demotion of Data Types
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
708
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10791
diff changeset
709 Many operators and functions can work with mixed data types. For example,
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
710
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
711 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
712 @group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
713 uint8 (1) + 1
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
714 @result{} 2
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
715 @end group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
716 @end example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
717
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
718 @noindent
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
719 where the above operator works with an 8-bit integer and a double precision
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
720 value and returns an 8-bit integer value. Note that the type is demoted
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
721 to an 8-bit integer, rather than promoted to a double precision value as
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
722 might be expected. The reason is that if Octave promoted values in
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
723 expressions like the above with all numerical constants would need to be
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
724 explicitly cast to the appropriate data type like
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
725
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
726 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
727 @group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
728 uint8 (1) + uint8 (1)
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
729 @result{} 2
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
730 @end group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
731 @end example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
732
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
733 @noindent
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
734 which becomes difficult for the user to apply uniformly and might allow
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
735 hard to find bugs to be introduced. The same applies to single precision
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
736 values where a mixed operation such as
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
737
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
738 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
739 @group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
740 single (1) + 1
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
741 @result{} 2
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
742 @end group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
743 @end example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
744
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
745 @noindent
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
746 returns a single precision value. The mixed operations that are valid
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
747 and their returned data types are
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
748
7989
23c248d415b5 Various doc fixes. Readd cellidx
David Bateman <dbateman@free.fr>
parents: 7984
diff changeset
749 @multitable @columnfractions .2 .3 .3 .2
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
750 @headitem @tab Mixed Operation @tab Result @tab
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
751 @item @tab double OP single @tab single @tab
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
752 @item @tab double OP integer @tab integer @tab
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
753 @item @tab double OP char @tab double @tab
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
754 @item @tab double OP logical @tab double @tab
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
755 @item @tab single OP integer @tab integer @tab
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
756 @item @tab single OP char @tab single @tab
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
757 @item @tab single OP logical @tab single @tab
7989
23c248d415b5 Various doc fixes. Readd cellidx
David Bateman <dbateman@free.fr>
parents: 7984
diff changeset
758 @end multitable
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
759
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
760 The same logic applies to functions with mixed arguments such as
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
761
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
762 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
763 @group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
764 min (single (1), 0)
7989
23c248d415b5 Various doc fixes. Readd cellidx
David Bateman <dbateman@free.fr>
parents: 7984
diff changeset
765 @result{} 0
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
766 @end group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
767 @end example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
768
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
769 @noindent
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
770 where the returned value is single precision.
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
771
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
772 In the case of mixed type indexed assignments, the type is not
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10791
diff changeset
773 changed. For example,
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
774
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
775 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
776 @group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
777 x = ones (2, 2);
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
778 x(1, 1) = single (2)
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
779 @result{} x = 2 1
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
780 1 1
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
781 @end group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
782 @end example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
783
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
784 @noindent
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
785 where @code{x} remains of the double precision type.
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
786
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 4029
diff changeset
787 @node Predicates for Numeric Objects
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
788 @section Predicates for Numeric Objects
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
789
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
790 Since the type of a variable may change during the execution of a
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
791 program, it can be necessary to do type checking at run-time. Doing this
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
792 also allows you to change the behavior of a function depending on the
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
793 type of the input. As an example, this naive implementation of @code{abs}
7001
8b0cfeb06365 [project @ 2007-10-10 18:02:59 by jwe]
jwe
parents: 6781
diff changeset
794 returns the absolute value of the input if it is a real number, and the
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
795 length of the input if it is a complex number.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
796
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
797 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
798 @group
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
799 function a = abs (x)
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
800 if (isreal (x))
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
801 a = sign (x) .* x;
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
802 elseif (iscomplex (x))
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
803 a = sqrt (real(x).^2 + imag(x).^2);
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
804 endif
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
805 endfunction
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9158
diff changeset
806 @end group
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
807 @end example
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
808
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
809 The following functions are available for determining the type of a
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
810 variable.
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 6550
diff changeset
811
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
812 @DOCSTRING(isnumeric)
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
813
12581
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 12488
diff changeset
814 @DOCSTRING(isfloat)
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
815
12581
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 12488
diff changeset
816 @DOCSTRING(isreal)
7638
2df457529cfa implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7018
diff changeset
817
4029
2cc57b6169cf [project @ 2002-08-09 07:36:15 by jwe]
jwe
parents: 3920
diff changeset
818 @DOCSTRING(iscomplex)
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
819
4029
2cc57b6169cf [project @ 2002-08-09 07:36:15 by jwe]
jwe
parents: 3920
diff changeset
820 @DOCSTRING(ismatrix)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
821
4029
2cc57b6169cf [project @ 2002-08-09 07:36:15 by jwe]
jwe
parents: 3920
diff changeset
822 @DOCSTRING(isvector)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
823
12488
bea828c03969 Add new isrow, iscolumn functions.
Rik <octave@nomad.inbox5.com>
parents: 12190
diff changeset
824 @DOCSTRING(isrow)
bea828c03969 Add new isrow, iscolumn functions.
Rik <octave@nomad.inbox5.com>
parents: 12190
diff changeset
825
bea828c03969 Add new isrow, iscolumn functions.
Rik <octave@nomad.inbox5.com>
parents: 12190
diff changeset
826 @DOCSTRING(iscolumn)
bea828c03969 Add new isrow, iscolumn functions.
Rik <octave@nomad.inbox5.com>
parents: 12190
diff changeset
827
4029
2cc57b6169cf [project @ 2002-08-09 07:36:15 by jwe]
jwe
parents: 3920
diff changeset
828 @DOCSTRING(isscalar)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
829
4029
2cc57b6169cf [project @ 2002-08-09 07:36:15 by jwe]
jwe
parents: 3920
diff changeset
830 @DOCSTRING(issquare)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
831
4029
2cc57b6169cf [project @ 2002-08-09 07:36:15 by jwe]
jwe
parents: 3920
diff changeset
832 @DOCSTRING(issymmetric)
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3321
diff changeset
833
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 11403
diff changeset
834 @DOCSTRING(ishermitian)
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 11403
diff changeset
835
6550
1b7a6061a05d [project @ 2007-04-20 07:40:26 by jwe]
jwe
parents: 6549
diff changeset
836 @DOCSTRING(isdefinite)
1b7a6061a05d [project @ 2007-04-20 07:40:26 by jwe]
jwe
parents: 6549
diff changeset
837
6688
b26a8e0e42cd [project @ 2007-06-04 06:25:21 by jwe]
jwe
parents: 6624
diff changeset
838 @DOCSTRING(islogical)
6550
1b7a6061a05d [project @ 2007-04-20 07:40:26 by jwe]
jwe
parents: 6549
diff changeset
839
1b7a6061a05d [project @ 2007-04-20 07:40:26 by jwe]
jwe
parents: 6549
diff changeset
840 @DOCSTRING(isprime)
13017
aaf6fbb2512f doc: Add cross references to "status of variables" in sections for predicates
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12581
diff changeset
841
aaf6fbb2512f doc: Add cross references to "status of variables" in sections for predicates
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12581
diff changeset
842 If instead of knowing properties of variables, you wish to know which
aaf6fbb2512f doc: Add cross references to "status of variables" in sections for predicates
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12581
diff changeset
843 variables are defined and to gather other information about the
17097
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 16939
diff changeset
844 workspace itself, @pxref{Status of Variables}.