# HG changeset patch # User jwe # Date 1168469639 0 # Node ID 82185e38eea8f44bd4e93a9e3334f16414282b32 # Parent 3ecd8d2c5654931683b973728e5e89b4e4eb2323 [project @ 2007-01-10 22:53:58 by jwe] diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/ChangeLog --- a/scripts/ChangeLog Wed Jan 10 21:13:22 2007 +0000 +++ b/scripts/ChangeLog Wed Jan 10 22:53:59 2007 +0000 @@ -1,3 +1,10 @@ +2007-01-10 David Bateman + + * elfun/acosd.m, elfun/acotd.m, elfun/acscd.m, elfun/asecd.m, + elfun/asind.m, elfun/atand.m, elfun/cosd.m, elfun/cotd.m, + elfun/cscd.m, elfun/secd.m, elfun/sind.m, elfun/tand.m: + New files. + 2007-01-09 Søren Hauberg * pkg/pkg.m: Allow filenames to contain glob patterns. diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/acosd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/acosd.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,32 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} acosd (@var{x}) +## Compute the inverse cosine of an angle in degrees. +## @seealso{acos, cosd, asecd} +## @end deftypefn + +function y = acosd (x) + if (nargin != 1) + print_usage (); + endif + y = acos(x) .* 180 ./ pi; +endfunction + +%!error(acosd()) +%!error(acosd(1,2)) +%!assert(acosd(0:0.1:1),180/pi*acos(0:0.1:1),-10*eps) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/acotd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/acotd.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,32 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} acotd (@var{x}) +## Compute the inverse cotangent of an angle in degrees. +## @seealso{atan, tand} +## @end deftypefn + +function y = acotd (x) + if (nargin != 1) + print_usage (); + endif + y = atand (1 ./ x); +endfunction + +%!error(acotd()) +%!error(acotd(1,2)) +%!assert(acotd(0:10:90),180./pi.*acot(0:10:90),-10*eps) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/acscd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/acscd.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,32 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} acscd (@var{x}) +## Compute the inverse cosecant of an angle in degrees. +## @seealso{acsc, cscd, asecd} +## @end deftypefn + +function y = acscd (x) + if (nargin != 1) + print_usage (); + endif + y = acsc(x) .* 180 ./ pi; +endfunction + +%!error(acscd()) +%!error(acscd(1,2)) +%!assert(acscd(0:10:90),180/pi*acsc(0:10:90),-10*eps) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/asecd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/asecd.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,32 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} asecd (@var{x}) +## Compute inverse secant in degrees. +## @seealso{asec, secd, acscd} +## @end deftypefn + +function y = asecd (x) + if (nargin != 1) + print_usage (); + endif + y = asec (x) .* 180 ./ pi; +endfunction; + +%!error(asecd()) +%!error(asecd(1,2)) +%!assert(asecd(0:10:90),180./pi.*asec(0:10:90),-10*eps) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/asind.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/asind.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,32 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} asind (@var{x}) +## Compute the inverse sine of an angle in degrees. +## @seealso{asin, sind, acosd} +## @end deftypefn + +function y = asind (x) + if (nargin != 1) + print_usage (); + endif + y = asin(x) .* 180 ./ pi; +endfunction + +%!error(asind()) +%!error(asind(1,2)) +%!assert(asind(0:0.1:1),180/pi*asin(0:0.1:1),-10*eps) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/atand.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/atand.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,32 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} atand (@var{x}) +## Compute the inverse tangent of an angle in degrees. +## @seealso{acot, tand} +## @end deftypefn + +function y = atand (x) + if (nargin != 1) + print_usage (); + endif + y = 180 ./ pi .* atan (x); +endfunction + +%!error(atand()) +%!error(atand(1,2)) +%!assert(atand(0:10:90),180./pi.*atan(0:10:90),-10*eps) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/cosd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/cosd.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,38 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- 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} +## @end deftypefn + +function y = cosd (x) + if (nargin != 1) + print_usage (); + endif + I = x / 180; + y = cos (I .* pi); + I = I + 0.5; + y(I == round (I) & finite (I)) = 0; +endfunction + +%!error(cosd()) +%!error(cosd(1,2)) +%!assert(cosd(0:10:80),cos(pi*[0:10:80]/180),-10*eps) +%!assert(cosd([0,180,360]) != 0) +%!assert(cosd([90,270]) == 0) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/cotd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/cotd.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} cotd (@var{x}) +## Compute the cotangent of an angle in degrees. +## @seealso{cot, tand} +## @end deftypefn + +function y = cotd (x) + if (nargin != 1) + print_usage (); + endif + y = 1 ./ tand (x); +endfunction + +%!error(cotd()) +%!error(cotd(1,2)) +%!assert(cotd(10:10:80),cot(pi*[10:10:80]/180),-10*eps) +%!assert(cotd([0,180,360]) == Inf) +%!assert(cotd([90,270]) == 0) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/cscd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/cscd.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,35 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} cscd (@var{x}) +## Compute the cosecant of an angle in degrees. +## @seealso{csc, secd, sind, cosd} +## @end deftypefn + +function y = cscd (x) + if (nargin != 1) + print_usage (); + endif + y = 1 ./ sind (x); +endfunction + +%!error(cscd()) +%!error(cscd(1,2)) +%!assert(cscd(10:10:90),csc(pi*[10:10:90]/180),-10*eps) +%!assert(cscd([0,180,360]) == Inf) +%!assert(cscd([90,270]) != Inf) + diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/secd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/secd.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} secd (@var{x}) +## Compute the secant of an angle in degrees. +## @seealso{sec, cscd, sind, cosd} +## @end deftypefn + +function y = secd (x) + if (nargin != 1) + print_usage (); + endif + y = 1 ./ cosd (x); +endfunction + +%!error(secd()) +%!error(secd(1,2)) +%!assert(secd(0:10:80),sec(pi*[0:10:80]/180),-10*eps) +%!assert(secd([0,180,360]) != Inf) +%!assert(secd([90,270]) == Inf) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/sind.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/sind.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,37 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- 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} +## @end deftypefn + +function y = sind (x) + if (nargin != 1) + print_usage (); + endif + I = x / 180; + y = sin (I .* pi); + y(I == round (I) & finite (I)) = 0; +endfunction + +%!error(sind()) +%!error(sind(1,2)) +%!assert(sind(10:10:90),sin(pi*[10:10:90]/180),-10*eps) +%!assert(sind([0,180,360]) == 0) +%!assert(sind([90,270]) != 0) diff -r 3ecd8d2c5654 -r 82185e38eea8 scripts/elfun/tand.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/elfun/tand.m Wed Jan 10 22:53:59 2007 +0000 @@ -0,0 +1,40 @@ +## Copyright (C) 2006 David Bateman +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## -*- 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} +## @end deftypefn + +function y = tand (x) + if (nargin != 1) + print_usage (); + endif + I0 = x / 180; + I90 = (x-90) / 180; + y = tan (I0 .* pi); + y(I0 == round (I0) & finite (I0)) = 0; + y(I90 == round (I90) & finite (I90)) = Inf; +endfunction; + +%!error(tand()) +%!error(tand(1,2)) +%!assert(tand(10:10:80),tan(pi*[10:10:80]/180),-10*eps) +%!assert(tand([0,180,360]) == 0) +%!assert(tand([90,270]) == Inf)