Mercurial > hg > octave-lyh
changeset 9165:8c71a86c4bf4
Update section 17.5 (Utility Functions) of arith.txi
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Fri, 01 May 2009 10:06:16 -0700 |
parents | 7dbc91a66f2a |
children | 69088b7b139c |
files | doc/ChangeLog doc/interpreter/arith.txi scripts/elfun/lcm.m scripts/general/del2.m scripts/general/gradient.m scripts/linear-algebra/cross.m scripts/miscellaneous/list_primes.m scripts/specfun/factorial.m scripts/specfun/primes.m src/DLD-FUNCTIONS/max.cc src/data.cc src/mappers.cc |
diffstat | 12 files changed, 55 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,6 @@ +2009-04-26 Rik <rdrider0-list@yahoo.com> + * interpreter/arith.txi: Update section 17.5 (Utility Functions) of arith.txi + 2009-04-26 Rik <rdrider0-list@yahoo.com> * interpreter/arith.txi: Update section 17.4 (Sums and Products) of arith.txi
--- a/doc/interpreter/arith.txi +++ b/doc/interpreter/arith.txi @@ -219,6 +219,8 @@ @DOCSTRING(lcm) +@DOCSTRING(list_primes) + @DOCSTRING(max) @DOCSTRING(min)
--- a/scripts/elfun/lcm.m +++ b/scripts/elfun/lcm.m @@ -18,7 +18,8 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Mapping Function} {} lcm (@var{x}, @dots{}) +## @deftypefn {Mapping Function} {} lcm (@var{x}) +## @deftypefnx {Mapping Function} {} lcm (@var{x}, @dots{}) ## Compute the least common multiple of the elements of @var{x}, or ## of the list of all arguments. For example, ##
--- a/scripts/general/del2.m +++ b/scripts/general/del2.m @@ -22,14 +22,18 @@ ## @deftypefnx {Function File} {@var{d} =} del2 (@var{m}, @var{h}) ## @deftypefnx {Function File} {@var{d} =} del2 (@var{m}, @var{dx}, @var{dy}, @dots{}) ## -## Calculate the discrete Laplace operator. If @var{m} is a matrix this is -## defined as +## Calculate the discrete Laplace +## @tex +## operator $( \nabla^2 )$. +## @end tex +## @ifnottex +## operator. +## @end ifnottex +## For a 2-dimensional matrix @var{m} this is defined as ## -## @iftex ## @tex ## $$d = {1 \over 4} \left( {d^2 \over dx^2} M(x,y) + {d^2 \over dy^2} M(x,y) \right)$$ ## @end tex -## @end iftex ## @ifnottex ## @example ## @group @@ -40,15 +44,14 @@ ## @end example ## @end ifnottex ## -## The above to continued to N-dimensional arrays calculating the second -## derivative over the higher dimensions. +## For N-dimensional arrays the sum in parentheses is expanded to include second derivatives +## over the additional higher dimensions. ## ## The spacing between evaluation points may be defined by @var{h}, which is a ## scalar defining the equidistant spacing in all dimensions. Alternatively, -## the spacing -## in each dimension may be defined separately by @var{dx}, @var{dy}, etc. -## Scalar spacing values give equidistant spacing, whereas vector spacing -## values can be used to specify variable spacing. The length of the vectors +## the spacing in each dimension may be defined separately by @var{dx}, @var{dy}, +## etc. A scalar spacing argument defines equidistant spacing, whereas a vector +## argument can be used to specify variable spacing. The length of the spacing vectors ## must match the respective dimension of @var{m}. The default spacing value ## is 1. ##
--- a/scripts/general/gradient.m +++ b/scripts/general/gradient.m @@ -25,8 +25,8 @@ ## @deftypefnx {Function File} {[@dots{}] =} gradient (@var{f}, @var{x0}, @var{s}) ## @deftypefnx {Function File} {[@dots{}] =} gradient (@var{f}, @var{x0}, @var{x}, @var{y}, @dots{}) ## -## Calculate the gradient of sampled data or of a function. If @var{m} -## is a vector, calculate the one dimensional gradient of @var{m}. If +## Calculate the gradient of sampled data or a function. If @var{m} +## is a vector, calculate the one-dimensional gradient of @var{m}. If ## @var{m} is a matrix the gradient is calculated for each dimension. ## ## @code{[@var{dx}, @var{dy}] = gradient (@var{m})} calculates the one
--- a/scripts/linear-algebra/cross.m +++ b/scripts/linear-algebra/cross.m @@ -18,8 +18,9 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {} cross (@var{x}, @var{y}, @var{dim}) -## Computes the vector cross product of the two 3-dimensional vectors +## @deftypefn {Function File} {} cross (@var{x}, @var{y}) +## @deftypefnx {Function File} {} cross (@var{x}, @var{y}, @var{dim}) +## Compute the vector cross product of two 3-dimensional vectors ## @var{x} and @var{y}. ## ## @example @@ -31,8 +32,9 @@ ## ## If @var{x} and @var{y} are matrices, the cross product is applied ## along the first dimension with 3 elements. The optional argument -## @var{dim} is used to force the cross product to be calculated along -## the dimension defined by @var{dim}. +## @var{dim} forces the cross product to be calculated along +## the specified dimension. +## @seealso{dot} ## @end deftypefn ## Author: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
--- a/scripts/miscellaneous/list_primes.m +++ b/scripts/miscellaneous/list_primes.m @@ -20,17 +20,10 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} list_primes (@var{n}) ## List the first @var{n} primes. If @var{n} is unspecified, the first -## 30 primes are listed. +## 25 primes are listed. ## -## The algorithm used is from page 218 of the -## @iftex -## @tex -## {\TeX}book. -## @end tex -## @end iftex -## @ifnottex -## TeXbook. -## @end ifnottex +## The algorithm used is from page 218 of the @TeX{}book. +## @seealso{primes, isprime} ## @end deftypefn ## Author: jwe @@ -44,7 +37,7 @@ endif if (nargin == 0) - n = 30; + n = 25; endif if (n == 1)
--- a/scripts/specfun/factorial.m +++ b/scripts/specfun/factorial.m @@ -18,9 +18,12 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} factorial (@var{n}) -## Return the factorial of @var{n}. If @var{n} is a scalar, this is -## equivalent to @code{prod (1:@var{n})}. For vector or matrix arguments, -## return the factorial of each element in the array. +## Return the factorial of @var{n} where @var{n} is a positive integer. If +## @var{n} is a scalar, this is equivalent to @code{prod (1:@var{n})}. For +## vector or matrix arguments, return the factorial of each element in the +## array. For non-integers see the generalized factorial function +## @code{gamma}. +## @seealso{prod, gamma} ## @end deftypefn function x = factorial (n)
--- a/scripts/specfun/primes.m +++ b/scripts/specfun/primes.m @@ -23,10 +23,17 @@ ## ## The algorithm used is the Sieve of Erastothenes. ## -## Note that if you need a specific number of primes, you can use the -## fact the distance from one prime to the next is on average -## proportional to the logarithm of the prime. Integrating, you find -## that there are about @math{k} primes less than @math{k \log (5 k)}. +## Note that if you need a specific number of primes you can use the +## fact the distance from one prime to the next is, on average, +## proportional to the logarithm of the prime. Integrating, one finds +## that there are about @math{k} primes less than +## @tex +## $k \log (5 k)$. +## @end tex +## @ifnottex +## k*log(5*k). +## @end ifnottex +## @seealso{list_primes, isprime} ## @end deftypefn ## Author: Paul Kienzle
--- a/src/DLD-FUNCTIONS/max.cc +++ b/src/DLD-FUNCTIONS/max.cc @@ -720,7 +720,7 @@ \n\ @example\n\ @group\n\ -[x, ix] = min ([1, 3, 0, 2, 5])\n\ +[x, ix] = min ([1, 3, 0, 2, 0])\n\ @result{} x = 0\n\ ix = 3\n\ @end group\n\
--- a/src/data.cc +++ b/src/data.cc @@ -737,10 +737,10 @@ DEFUN (hypot, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} hypot (@var{x}, @var{y})\n\ -Compute the element-by-element square root of the squares of @var{x} and\n\ -@var{y}. This is equivalent to @code{sqrt (@var{x}.^ 2 + @var{y}\n\ -.^ 2)}, but calculated in a manner that avoids overflows for large\n\ -values of @var{x} or @var{y}.\n\ +Compute the element-by-element square root of the sum of the squares of\n\ +@var{x} and @var{y}. This is equivalent to\n\ +@code{sqrt (@var{x}.^2 + @var{y}.^2)}, but calculated in a manner that\n\ +avoids overflows for large values of @var{x} or @var{y}.\n\ @end deftypefn") { octave_value retval;
--- a/src/mappers.cc +++ b/src/mappers.cc @@ -712,7 +712,7 @@ DEFUN (fix, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} fix (@var{x})\n\ -Truncate fractional portion of @var{x} and return integer portion. This\n\ +Truncate fractional portion of @var{x} and return the integer portion. This\n\ is equivalent to rounding towards zero. If @var{x} is complex, return\n\ @code{fix (real (@var{x})) + fix (imag (@var{x})) * I}.\n\ @example\n\