Mercurial > hg > octave-terminal
changeset 9155:ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Add text to help strings to indicate which functions use radians and which use degrees.
Add cross-references to radian function descriptions.
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Sun, 26 Apr 2009 22:19:57 -0700 |
parents | 761fc0d3d980 |
children | b2b8ed43b922 |
files | doc/ChangeLog doc/interpreter/arith.txi scripts/elfun/acosd.m scripts/elfun/acot.m scripts/elfun/acotd.m scripts/elfun/acoth.m scripts/elfun/acsc.m scripts/elfun/acscd.m scripts/elfun/acsch.m scripts/elfun/asec.m scripts/elfun/asecd.m scripts/elfun/asech.m scripts/elfun/asind.m scripts/elfun/atand.m scripts/elfun/cosd.m scripts/elfun/cot.m scripts/elfun/cotd.m scripts/elfun/coth.m scripts/elfun/csc.m scripts/elfun/cscd.m scripts/elfun/csch.m scripts/elfun/sec.m scripts/elfun/secd.m scripts/elfun/sech.m scripts/elfun/sind.m scripts/elfun/tand.m src/data.cc src/mappers.cc |
diffstat | 28 files changed, 105 insertions(+), 71 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.3 (Trigonometry) of arith.txi + 2009-04-24 Rik <rdrider0-list@yahoo.com> * interpreter/arith.txi: Update section 17.2 (Complex Arithmetic) of arith.txi
--- a/doc/interpreter/arith.txi +++ b/doc/interpreter/arith.txi @@ -103,7 +103,7 @@ @node Trigonometry @section Trigonometry -Octave provides the following trigonometric functions. Angles are +Octave provides the following trigonometric functions where angles are specified in radians. To convert from degrees to radians multiply by @iftex @tex @@ -113,7 +113,12 @@ @ifinfo @code{pi/180} @end ifinfo - (e.g., @code{sin (30 * pi/180)} returns the sine of 30 degrees). +(e.g., @code{sin (30 * pi/180)} returns the sine of 30 degrees). As +an alternative, Octave provides a number of trigonometric functions +which work directly on an argument specified in degrees. These functions +are named after the base trigonometric function with a @samp{d} suffix. For +example, @code{sin} expects an angle in radians while @code{sind} expects an +angle in degrees. @DOCSTRING(sin) @DOCSTRING(cos) @@ -143,22 +148,21 @@ @DOCSTRING(acsch) @DOCSTRING(acoth) -Each of these functions expects a single argument. For matrix arguments, -they work on an element by element basis. For example, +@DOCSTRING(atan2) +Octave provides the following trigonometric functions where angles are +specified in degrees. These functions produce true zeros at the appropriate +intervals rather than the small roundoff error that occurs when using +radians. For example: @example @group -sin ([1, 2; 3, 4]) - @result{} 0.84147 0.90930 - 0.14112 -0.75680 +cosd (90) + @result{} 0 +cos (pi/2) + @result{} 6.1230e-17 @end group @end example -@DOCSTRING(atan2) - -In addition to the trigonometric functions that work with radians, -Octave also provides the following functions which work with degrees. - @DOCSTRING(sind) @DOCSTRING(cosd) @DOCSTRING(tand) @@ -193,6 +197,8 @@ @DOCSTRING(ceil) +@DOCSTRING(cross) + @DOCSTRING(del2) @DOCSTRING(factor) @@ -236,9 +242,9 @@ @node Special Functions @section Special Functions -@DOCSTRING(besselj) +@DOCSTRING(airy) -@DOCSTRING(airy) +@DOCSTRING(besselj) @DOCSTRING(beta) @@ -248,6 +254,10 @@ @DOCSTRING(bincoeff) +@DOCSTRING(commutation_matrix) + +@DOCSTRING(duplication_matrix) + @DOCSTRING(erf) @DOCSTRING(erfc) @@ -263,12 +273,6 @@ @anchor{doc-gammaln} @DOCSTRING(lgamma) -@DOCSTRING(cross) - -@DOCSTRING(commutation_matrix) - -@DOCSTRING(duplication_matrix) - @node Coordinate Transformations @section Coordinate Transformations @@ -283,16 +287,16 @@ @node Mathematical Constants @section Mathematical Constants +@DOCSTRING(e) + +@DOCSTRING(pi) + @DOCSTRING(I) @DOCSTRING(Inf) @DOCSTRING(NaN) -@DOCSTRING(pi) - -@DOCSTRING(e) - @DOCSTRING(eps) @DOCSTRING(realmax)
--- a/scripts/elfun/acosd.m +++ b/scripts/elfun/acosd.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} acosd (@var{x}) -## Compute the inverse cosine of an angle in degrees. -## @seealso{acos, cosd, asecd} +## Compute the inverse cosine in degrees for each element of @var{x}. +## @seealso{cosd, acos} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/acot.m +++ b/scripts/elfun/acot.m @@ -19,7 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} acot (@var{x}) -## Compute the inverse cotangent of each element of @var{x}. +## Compute the inverse cotangent in radians for each element of @var{x}. +## @seealso{cot, acotd} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/acotd.m +++ b/scripts/elfun/acotd.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} acotd (@var{x}) -## Compute the inverse cotangent of an angle in degrees. -## @seealso{atan, tand} +## Compute the inverse cotangent in degrees for each element of @var{x}. +## @seealso{cotd, acot} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/acoth.m +++ b/scripts/elfun/acoth.m @@ -20,6 +20,7 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} acoth (@var{x}) ## Compute the inverse hyperbolic cotangent of each element of @var{x}. +## @seealso{coth} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/acsc.m +++ b/scripts/elfun/acsc.m @@ -19,7 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} acsc (@var{x}) -## Compute the inverse cosecant of each element of @var{x}. +## Compute the inverse cosecant in radians for each element of @var{x}. +## @seealso{csc, acscd} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/acscd.m +++ b/scripts/elfun/acscd.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} acscd (@var{x}) -## Compute the inverse cosecant of an angle in degrees. -## @seealso{acsc, cscd, asecd} +## Compute the inverse cosecant in degrees for each element of @var{x}. +## @seealso{cscd, acsc} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/acsch.m +++ b/scripts/elfun/acsch.m @@ -20,6 +20,7 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} acsch (@var{x}) ## Compute the inverse hyperbolic cosecant of each element of @var{x}. +## @seealso{csch} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/asec.m +++ b/scripts/elfun/asec.m @@ -19,7 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} asec (@var{x}) -## Compute the inverse secant of each element of @var{x}. +## Compute the inverse secant in radians for each element of @var{x}. +## @seealso{sec, asecd} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/asecd.m +++ b/scripts/elfun/asecd.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} asecd (@var{x}) -## Compute inverse secant in degrees. -## @seealso{asec, secd, acscd} +## Compute the inverse secant in degrees for each element of @var{x}. +## @seealso{secd, asec} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/asech.m +++ b/scripts/elfun/asech.m @@ -20,6 +20,7 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} asech (@var{x}) ## Compute the inverse hyperbolic secant of each element of @var{x}. +## @seealso{sech} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/asind.m +++ b/scripts/elfun/asind.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} asind (@var{x}) -## Compute the inverse sine of an angle in degrees. -## @seealso{asin, sind, acosd} +## Compute the inverse sine in degrees for each element of @var{x}. +## @seealso{sind, asin} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/atand.m +++ b/scripts/elfun/atand.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} atand (@var{x}) -## Compute the inverse tangent of an angle in degrees. -## @seealso{acot, tand} +## Compute the inverse tangent in degrees for each element of @var{x}. +## @seealso{tand, atan} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/cosd.m +++ b/scripts/elfun/cosd.m @@ -18,9 +18,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} cosd (@var{x}) -## Compute the cosine of an angle in degrees. Returns zero in elements -## for which @code{(@var{x}-90)/180} is an integer. -## @seealso{cos, sind, tand, acosd, asind, atand} +## Compute the cosine for each element of @var{x} in degrees. Returns zero +## for elements where @code{(@var{x}-90)/180} is an integer. +## @seealso{acosd, cos} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/cot.m +++ b/scripts/elfun/cot.m @@ -19,7 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} cot (@var{x}) -## Compute the cotangent of each element of @var{x}. +## Compute the cotangent for each element of @var{x} in radians. +## @seealso{acot, cotd, coth} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/cotd.m +++ b/scripts/elfun/cotd.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} cotd (@var{x}) -## Compute the cotangent of an angle in degrees. -## @seealso{cot, tand} +## Compute the cotangent for each element of @var{x} in degrees. +## @seealso{acotd, cot} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/coth.m +++ b/scripts/elfun/coth.m @@ -20,6 +20,7 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} coth (@var{x}) ## Compute the hyperbolic cotangent of each element of @var{x}. +## @seealso{acoth} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/csc.m +++ b/scripts/elfun/csc.m @@ -19,7 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} csc (@var{x}) -## Compute the cosecant of each element of @var{x}. +## Compute the cosecant for each element of @var{x} in radians. +## @seealso{acsc, cscd, csch} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/cscd.m +++ b/scripts/elfun/cscd.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} cscd (@var{x}) -## Compute the cosecant of an angle in degrees. -## @seealso{csc, secd, sind, cosd} +## Compute the cosecant for each element of @var{x} in degrees. +## @seealso{acscd, csc} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/csch.m +++ b/scripts/elfun/csch.m @@ -20,6 +20,7 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} csch (@var{x}) ## Compute the hyperbolic cosecant of each element of @var{x}. +## @seealso{acsch} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/sec.m +++ b/scripts/elfun/sec.m @@ -19,7 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} sec (@var{x}) -## Compute the secant of each element of @var{x}. +## Compute the secant for each element of @var{x} in radians. +## @seealso{asec, secd, sech} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/secd.m +++ b/scripts/elfun/secd.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} secd (@var{x}) -## Compute the secant of an angle in degrees. -## @seealso{sec, cscd, sind, cosd} +## Compute the secant for each element of @var{x} in degrees. +## @seealso{asecd, sec} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/sech.m +++ b/scripts/elfun/sech.m @@ -20,6 +20,7 @@ ## -*- texinfo -*- ## @deftypefn {Mapping Function} {} sech (@var{x}) ## Compute the hyperbolic secant of each element of @var{x}. +## @seealso{asech} ## @end deftypefn ## Author: jwe
--- a/scripts/elfun/sind.m +++ b/scripts/elfun/sind.m @@ -18,9 +18,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} sind (@var{x}) -## Compute the sine of each element of @var{x}. Returns zero in elements -## for which @code{@var{x}/180} is an integer. -## @seealso{sin, cosd, tand, acosd, asind, atand} +## Compute the sine for each element of @var{x} in degrees. Returns zero +## for elements where @code{@var{x}/180} is an integer. +## @seealso{asind, sin} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/scripts/elfun/tand.m +++ b/scripts/elfun/tand.m @@ -18,10 +18,10 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} tand (@var{x}) -## Compute the tangent of an angle in degrees. Returns zero for elements -## of for which @code{@var{x}/180} is an integer and @code{Inf} for elements -## where @code{(@var{x}-90)/180} is an integer. -## @seealso{tan, cosd, sind, acosd, asind, atand} +## Compute the tangent for each element of @var{x} in degrees. Returns zero +## for elements where @code{@var{x}/180} is an integer and @code{Inf} for +## elements where @code{(@var{x}-90)/180} is an integer. +## @seealso{atand, tan} ## @end deftypefn ## Author: David Bateman <dbateman@free.fr>
--- a/src/data.cc +++ b/src/data.cc @@ -534,7 +534,8 @@ "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} atan2 (@var{y}, @var{x})\n\ Compute atan (@var{y} / @var{x}) for corresponding elements of @var{y}\n\ -and @var{x}. The result is in the range -pi to pi.\n\ +and @var{x}. Signal an error if @var{y} and @var{x} do not match in size\n\ +and orientation.\n\ @end deftypefn") { octave_value retval;
--- a/src/mappers.cc +++ b/src/mappers.cc @@ -90,7 +90,8 @@ DEFUN (acos, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} acos (@var{x})\n\ -Compute the inverse cosine of each element of @var{x}.\n\ +Compute the inverse cosine in radians for each element of @var{x}.\n\ +@seealso{cos, acosd}\n\ @end deftypefn") { octave_value retval; @@ -126,7 +127,8 @@ DEFUN (acosh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} acosh (@var{x})\n\ -Compute the inverse hyperbolic cosine of each element of @var{x}.\n\ +Compute the inverse hyperbolic cosine for each element of @var{x}.\n\ +@seealso{cosh}\n\ @end deftypefn") { octave_value retval; @@ -226,7 +228,8 @@ DEFUN (asin, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} asin (@var{x})\n\ -Compute the inverse sine of each element of @var{x}.\n\ +Compute the inverse sine in radians for each element of @var{x}.\n\ +@seealso{sin, asind}\n\ @end deftypefn") { octave_value retval; @@ -252,7 +255,8 @@ DEFUN (asinh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} asinh (@var{x})\n\ -Compute the inverse hyperbolic sine of each element of @var{x}.\n\ +Compute the inverse hyperbolic sine for each element of @var{x}.\n\ +@seealso{sinh}\n\ @end deftypefn") { octave_value retval; @@ -284,7 +288,8 @@ DEFUN (atan, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} atan (@var{x})\n\ -Compute the inverse tangent of each element of @var{x}.\n\ +Compute the inverse tangent in radians for each element of @var{x}.\n\ +@seealso{tan, atand}\n\ @end deftypefn") { octave_value retval; @@ -320,7 +325,8 @@ DEFUN (atanh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} atanh (@var{x})\n\ -Compute the inverse hyperbolic tangent of each element of @var{x}.\n\ +Compute the inverse hyperbolic tangent for each element of @var{x}.\n\ +@seealso{tanh}\n\ @end deftypefn") { octave_value retval; @@ -438,7 +444,8 @@ DEFUN (cos, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} cos (@var{x})\n\ -Compute the cosine of each element of @var{x}.\n\ +Compute the cosine for each element of @var{x} in radians.\n\ +@seealso{acos, cosd, cosh}\n\ @end deftypefn") { octave_value retval; @@ -474,7 +481,8 @@ DEFUN (cosh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} cosh (@var{x})\n\ -Compute the hyperbolic cosine of each element of @var{x}.\n\ +Compute the hyperbolic cosine for each element of @var{x}.\n\ +@seealso{acosh, sinh, tanh}\n\ @end deftypefn") { octave_value retval; @@ -517,11 +525,13 @@ @ifnottex\n\ \n\ @example\n\ +@group\n\ z\n\ /\n\ erf (z) = (2/sqrt (pi)) | e^(-t^2) dt\n\ /\n\ t=0\n\ +@end group\n\ @end example\n\ @end ifnottex\n\ @seealso{erfc, erfinv}\n\ @@ -1448,7 +1458,8 @@ DEFUN (sin, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} sin (@var{x})\n\ -Compute the sine of each element of @var{x}.\n\ +Compute the sine for each element of @var{x} in radians.\n\ +@seealso{asin, sind, sinh}\n\ @end deftypefn") { octave_value retval; @@ -1484,7 +1495,8 @@ DEFUN (sinh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} sinh (@var{x})\n\ -Compute the hyperbolic sine of each element of @var{x}.\n\ +Compute the hyperbolic sine for each element of @var{x}.\n\ +@seealso{asinh, cosh, tanh}\n\ @end deftypefn") { octave_value retval; @@ -1551,7 +1563,8 @@ DEFUN (tan, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} tan (@var{z})\n\ -Compute tangent of each element of @var{x}.\n\ +Compute the tangent for each element of @var{x} in radians.\n\ +@seealso{atan, tand, tanh}\n\ @end deftypefn") { octave_value retval; @@ -1587,7 +1600,8 @@ DEFUN (tanh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} tanh (@var{x})\n\ -Compute hyperbolic tangent of each element of @var{x}.\n\ +Compute hyperbolic tangent for each element of @var{x}.\n\ +@seealso{atanh, sinh, cosh}\n\ @end deftypefn") { octave_value retval;