annotate scripts/specfun/reallog.m @ 20162:2645f9ef8c88 stable

doc: Update more docstrings to have one sentence summary as first line. Reviewed specfun, special-matrix, testfun, and time script directories. * scripts/specfun/expint.m, scripts/specfun/isprime.m, scripts/specfun/legendre.m, scripts/specfun/primes.m, scripts/specfun/reallog.m, scripts/specfun/realsqrt.m, scripts/special-matrix/gallery.m, scripts/special-matrix/hadamard.m, scripts/special-matrix/hankel.m, scripts/special-matrix/hilb.m, scripts/special-matrix/invhilb.m, scripts/special-matrix/magic.m, scripts/special-matrix/pascal.m, scripts/special-matrix/rosser.m, scripts/special-matrix/toeplitz.m, scripts/special-matrix/vander.m, scripts/special-matrix/wilkinson.m, scripts/testfun/assert.m, scripts/testfun/demo.m, scripts/testfun/example.m, scripts/testfun/fail.m, scripts/testfun/rundemos.m, scripts/testfun/runtests.m, scripts/testfun/speed.m, scripts/time/asctime.m, scripts/time/calendar.m, scripts/time/clock.m, scripts/time/ctime.m, scripts/time/datenum.m, scripts/time/datestr.m, scripts/time/datevec.m, scripts/time/etime.m, scripts/time/is_leap_year.m, scripts/time/now.m, scripts/time/weekday.m: Update more docstrings to have one sentence summary as first line.
author Rik <rik@octave.org>
date Sun, 03 May 2015 17:00:11 -0700
parents 4197fc428c7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19102
diff changeset
1 ## Copyright (C) 2008-2015 David Bateman
7621
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
2 ##
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
3 ## This file is part of Octave.
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
4 ##
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 ## your option) any later version.
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
9 ##
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
13 ## General Public License for more details.
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 ##
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
18
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
19 ## -*- texinfo -*-
7986
3eb2094eefe5 Fix help string.
Ben Abbott <bpabbott@mac.com>
parents: 7621
diff changeset
20 ## @deftypefn {Function File} {} reallog (@var{x})
19102
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
21 ## Return the real-valued natural logarithm of each element of @var{x}.
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
22 ##
20162
2645f9ef8c88 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
23 ## If any element results in a complex return value @code{reallog} aborts and
2645f9ef8c88 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
24 ## issues an error.
9141
c1fff751b5a8 Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
25 ## @seealso{log, realpow, realsqrt}
7621
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
26 ## @end deftypefn
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
27
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
28 function y = reallog (x)
19102
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
29
7621
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
30 if (nargin != 1)
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
31 print_usage ();
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
32 elseif (iscomplex (x) || any (x(:) < 0))
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
33 error ("reallog: produced complex result");
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
34 else
7621
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
35 y = log (x);
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
36 endif
19102
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
37
7621
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
38 endfunction
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
39
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
40
19102
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
41 %!assert (reallog (1:5), log (1:5))
7621
4682dda22527 Add the reallog, realsqrt and realpow functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
42 %!test
19102
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
43 %! x = rand (10, 10);
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
44 %! assert (reallog (x), log (x));
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
45
19102
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
46 %!error reallog ()
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
47 %!error reallog (1,2)
bb20384acf7b doc: Overhaul documentation for some functions in specfun/ dir.
Rik <rik@octave.org>
parents: 17744
diff changeset
48 %!error <produced complex result> reallog (2i)
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
49 %!error <produced complex result> reallog (-1)
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
50