diff --git a/help/Makefile b/help/Makefile index 12e1027..f1ef9c0 100644 --- a/help/Makefile +++ b/help/Makefile @@ -200,18 +200,19 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \ # to keep this list in nice sorted order. # DETAIL_HELP= abs access acos acosh acot acoth acovercos acoversin \ - acsc acsch address agd append appr arg argv arrow asec asech asin \ - asinh assign atan atan2 atanh avercos aversin avg base base2 bernoulli \ - bit blk blkcpy blkfree blocks bround btrunc calc_tty calclevel \ - calcpath catalan ceil cfappr cfsim char cmdbuf cmp comb conj cos cosh \ - cot coth count covercos coversin cp csc csch ctime d2dm d2dms d2g d2r \ - delete den dereference det digit digits display dms2d dp epsilon \ - errcount errmax errno error errsym estr euler eval exp fact factor \ - fclose fcnt feof ferror fflush fgetc fgetfield fgetfile fgetline fgets \ - fgetstr fib files floor fopen forall fpathopen fprintf fputc fputs \ - fputstr frac free freebernoulli freeeuler freeglobals freeredc \ - freestatics frem freopen fscan fscanf fseek fsize ftell g2d g2gm g2gms \ - g2r gcd gcdrem gd getenv gms2g h2hm h2hms hash head highbit hmean \ + acsc acsch address agd ahacovercos ahacoversin ahavercos ahaversin \ + append appr arg argv arrow asec asech asin asinh assign atan atan2 \ + atanh avercos aversin avg base base2 bernoulli bit blk blkcpy blkfree \ + blocks bround btrunc calc_tty calclevel calcpath catalan ceil cfappr \ + cfsim char cmdbuf cmp comb conj cos cosh cot coth count covercos \ + coversin cp csc csch ctime d2dm d2dms d2g d2r delete den dereference \ + det digit digits display dms2d dp epsilon errcount errmax errno error \ + errsym estr euler eval exp fact factor fclose fcnt feof ferror fflush \ + fgetc fgetfield fgetfile fgetline fgets fgetstr fib files floor fopen \ + forall fpathopen fprintf fputc fputs fputstr frac free freebernoulli \ + freeeuler freeglobals freeredc freestatics frem freopen fscan fscanf \ + fseek fsize ftell g2d g2gm g2gms g2r gcd gcdrem gd getenv gms2g h2hm \ + h2hms hacovercos hacoversin hash havercos haversin head highbit hmean \ hms2h hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert int \ inverse iroot isalnum isalpha isassoc isatty isblk iscntrl isconfig \ isdefined isdigit iserror iseven isfile isgraph ishash isident isint \ diff --git a/help/acos b/help/acos index ba7f6ca..eb770ca 100644 --- a/help/acos +++ b/help/acos @@ -11,18 +11,18 @@ TYPES return real DESCRIPTION - Returns the inverse cosine of x to a multiple of eps with error less in + Returns the inverse trigonometric cosine of x to a multiple of eps with error less in absolute value than .75 * eps. - This function is sometimes called arccos, is such that: - - cos(acos(x)) = x - - and such that: - - acos(x) = asrc(1/x) + This function is sometimes called arccos. EXAMPLE + ; print acos(0), acos(0.5), acos(1) + 1.57079632679489661923 1.04719755119659774615 0 + + ; print acos(-0.5), acos(-1) + 2.09439510239319549231 3.14159265358979323846 + ; print acos(.5, 1e-5), acos(.5, 1e-10), acos(.5, 1e-15), acos(.5, 1e-20) 1.0472 1.0471975512 1.047197551196598 1.04719755119659774615 @@ -32,6 +32,13 @@ EXAMPLE ; print acos(5+5i) 0.79039774680951249644-2.64919617780647114961i + ; pi = pi(1e-20) + ; print acos(pi/6), acos(pi/3) + 1.01972674369545025075 0.30604210861326573755i + + ; print acos(4*pi/3) + 2.11099630859669864896i + LIMITS 0 < eps < 1 @@ -42,8 +49,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2023 Landon Curt Noll diff --git a/help/acot b/help/acot index 56ad66e..664bacc 100644 --- a/help/acot +++ b/help/acot @@ -11,26 +11,33 @@ TYPES return real DESCRIPTION - Returns the inverse cotangent of x to a multiple of eps with error less in + Returns the inverse trigonometric cotangent of x to a multiple of eps with error less in absolute value than .75 * eps. - This function is sometimes called arccot, is such that: - - cot(acot(x)) = x - - and such that: - - acot(x) = atan(1/x) + This function is sometimes called arccot. EXAMPLE - ; print acot(2, 1e-5), acot(2, 1e-10), acot(2, 1e-15), acot(2, 1e-20) - 0.46365 0.463647609 0.463647609000806 0.46364760900080611621 + ; print acot(0), acot(0.5), acot(1) + 1.57079632679489661923 1.10714871779409050302 0.78539816339744830962 + + ; print acot(-0.5), acot(-1) + 2.03444393579570273544 2.35619449019234492885 + + ; print acot(.5, 1e-5), acot(.5, 1e-10), acot(.5, 1e-15), acot(.5, 1e-20) + 1.10715 1.1071487178 1.107148717794091 1.10714871779409050302 ; print acot(5), acot(5i) 0.19739555984988075837 -0.20273255405408219099i - ; print acos(5+5i) - 0.79039774680951249644-2.64919617780647114961i + ; print acot(5+5i) + 0.10065855418732038003-0.09932544936725086122i + + ; pi = pi(1e-20) + ; print acot(pi/6), acot(pi/3) + 1.08844841969387164375 0.76234753416487458792 + + ; print acot(4*pi/3) + 0.23434608748833616077 LIMITS 0 < eps < 1 @@ -42,8 +49,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2021,2023 Landon Curt Noll diff --git a/help/acovercos b/help/acovercos index 1c1fbdb..f97540c 100644 --- a/help/acovercos +++ b/help/acovercos @@ -19,11 +19,24 @@ DESCRIPTION acovercos(x) = asin(x - 1) EXAMPLE + ; print acovercos(0), acovercos(0.5), acovercos(1) + 1.57079632679489661923 0.52359877559829887308 0 + + ; print acovercos(-0.5), acovercos(-1) + -1.57079632679489661923+0.96242365011920689498i -1.57079632679489661923+1.31695789692481670863i + ; print acovercos(.5, 1e-5), acovercos(.5, 1e-10), acovercos(.5, 1e-15), acovercos(.5, 1e-20) 0.5236 0.5235987756 0.523598775598299 0.52359877559829887308 - ; print acovercos(1), acovercos(-5), acovercos(2 + 3i) - 0 -1.57079632679489661923+2.47788873028847500485i 0.30760364953071124992+1.86416154415788242834i + ; print acovercos(5), acovercos(5i) + 1.57079632679489661923-2.06343706889556054673i -0.19379313655493218978+2.33097465304931241744i + + ; print acovercos(5+5i) + 0.66881657532592728975+2.5513216254756988588i + + ; pi = pi(1e-20) + ; print acovercos(pi/6), acovercos(pi/3), acovercos(4*pi/3) + 0.49655704344777825545 -0.04721509173238348552 1.57079632679489661923-1.82724307729474887791i LIMITS 0 < eps < 1 @@ -35,8 +48,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 2023 Landon Curt Noll diff --git a/help/acoversin b/help/acoversin index 0f13fd5..63db895 100644 --- a/help/acoversin +++ b/help/acoversin @@ -19,11 +19,24 @@ DESCRIPTION acoversin(x) = asin(1 - x) EXAMPLE + ; print acoversin(0), acoversin(0.5), acoversin(1) + 1.57079632679489661923 0.52359877559829887308 0 + + ; print acoversin(-0.5), acoversin(-1) + 1.57079632679489661923-0.96242365011920689499i 1.57079632679489661923-1.31695789692481670863i + ; print acoversin(.5, 1e-5), acoversin(.5, 1e-10), acoversin(.5, 1e-15), acoversin(.5, 1e-20) 0.5236 0.5235987756 0.523598775598299 0.52359877559829887308 - ; print acoversin(1), acoversin(-5), acoversin(2 + 3i) - 0 1.57079632679489661923-2.47788873028847500481i -0.30760364953071124992-1.86416154415788242834i + ; print acoversin(5), acoversin(5i) + -1.57079632679489661923+2.06343706889556054673i 0.19379313655493218978-2.33097465304931241744i + + ; print acoversin(5+5i) + -0.66881657532592728975-2.5513216254756988588i + + ; pi = pi(1e-20) + ; print acoversin(pi/6), acoversin(pi/3), acoversin(4*pi/3) + 0.49655704344777825545 -0.04721509173238348552 -1.57079632679489661923+1.82724307729474887792i LIMITS 0 < eps < 1 @@ -35,8 +48,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 2023 Landon Curt Noll diff --git a/help/acsc b/help/acsc index dfa5d7e..50fb12d 100644 --- a/help/acsc +++ b/help/acsc @@ -11,26 +11,36 @@ TYPES return real DESCRIPTION - Returns the inverse cosecant of x to a multiple of eps with error less in + Returns the inverse trigonometric cosecant of x to a multiple of eps with error less in absolute value than .75 * eps. - This function is sometimes called arccsc, is such that: - - csc(acsc(x)) = x - - and such that: - - acsc(x) = asin(1/x) + This function is sometimes called arccsc. EXAMPLE - ; print acsc(2, 1e-5), acsc(2, 1e-10), acsc(2, 1e-15), acsc(2, 1e-20) - 0.5236 0.5235987756 0.523598775598299 0.52359877559829887308 + ; print acsc(0), acsc(0.5), acsc(1) + Error 10454 1.57079632679489661923-1.31695789692481670863i 1.57079632679489661923 + + ; print acsc(-0.5), acsc(-1) + -1.57079632679489661923+1.31695789692481670863i -1.57079632679489661923 + + ; print acsc(.5, 1e-5), acsc(.5, 1e-10), acsc(.5, 1e-15) + 1.5708-1.31696i 1.5707963268-1.3169578969i 1.570796326794897-1.316957896924817i + + ; print acsc(.5, 1e-20) + 1.57079632679489661923-1.31695789692481670863i ; print acsc(5), acsc(5i) 0.20135792079033079145 -0.19869011034924140648i - ; print acos(5+5i) - 0.79039774680951249644-2.64919617780647114961i + ; print acsc(5+5i) + 0.09966370285979516002-0.10033029811220500594i + + ; pi = pi(1e-20) + ; print acsc(pi/6), acsc(pi/3) + 1.57079632679489661923-1.26327680856656556834i 1.2694227170496051647 + + ; print acsc(4*pi/3) + 0.24106031273407362824 LIMITS 0 < eps < 1 @@ -42,8 +52,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, asec - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2021,2023 Landon Curt Noll diff --git a/help/ahacovercos b/help/ahacovercos new file mode 100644 index 0000000..d42184c --- /dev/null +++ b/help/ahacovercos @@ -0,0 +1,80 @@ +NAME + ahacovercos - inverse half coversed trigonometric cosine + +SYNOPSIS + ahacovercos(x [,eps]) + +TYPES + x number (real or complex) + eps 0 < real < 1, defaults to epsilon() + + return number + +DESCRIPTION + Calculate the inverse half coversed trigonometric cosine of x to a multiple of eps with error less in + absolute value than .75 * eps. + + This function is sometimes called ahacvc, or archacovercos, or archacovercosine, is equivalent to: + + ahacovercos(x) = asin(2*x - 1) + +EXAMPLE + ; print ahacovercos(0), ahacovercos(0.5), ahacovercos(1) + -1.57079632679489661923 0 1.57079632679489661923 + + ; print ahacovercos(-0.5), ahacovercos(-1) + -1.57079632679489661923+1.31695789692481670863i -1.57079632679489661923+1.76274717403908605045i + + ; print ahacovercos(.5, 1e-5), ahacovercos(.5, 1e-10), ahacovercos(.5, 1e-15), ahacovercos(.5, 1e-20) + 0 0 0 0 + + ; print ahacovercos(5), ahacovercos(5i) + 1.57079632679489661923-2.88727095035762068499i -0.09918204387849273625+3.00312524371312921749i + + ; print ahacovercos(5+5i) + 0.73144212314418701068+3.29254348147605425075i + + ; pi = pi(1e-20) + ; print ahacovercos(pi/6), ahacovercos(pi/3) + 0.04721509173238348552 1.57079632679489661923-0.4311526751624601302i + + ; print ahacovercos(4*pi/3) + 1.57079632679489661923-2.68696776930293700505i + +LIMITS + 0 < eps < 1 + +LINK LIBRARY + NUMBER *qahacovercos(NUMBER *x, NUMBER *eps) + COMPLEX *c_ahacovercos(COMPLEX *x, NUMBER *eps) + +SEE ALSO + sin, cos, tan, cot, sec, csc + asin, acos, atan, acot, asec, acsc + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos + epsilon + +## Copyright (C) 2023 Landon Curt Noll +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc 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 Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/09/24 11:16:08 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/ahacoversin b/help/ahacoversin new file mode 100644 index 0000000..7440f20 --- /dev/null +++ b/help/ahacoversin @@ -0,0 +1,80 @@ +NAME + ahacoversin - inverse half coversed trigonometric sine + +SYNOPSIS + ahacoversin(x [,eps]) + +TYPES + x number (real or complex) + eps 0 < real < 1, defaults to epsilon() + + return number + +DESCRIPTION + Calculate the inverse half coversed trigonometric sine of x to a multiple of eps with error less in + absolute value than .75 * eps. + + This function is sometimes called ahacovers, or ahacvs, or archacoversin, is equivalent to: + + ahacoversin(x) = asin(1 - 2*x) + +EXAMPLE + ; print ahacoversin(0), ahacoversin(0.5), ahacoversin(1) + 1.57079632679489661923 0 -1.57079632679489661923 + + ; print ahacoversin(-0.5), ahacoversin(-1) + 1.57079632679489661923-1.31695789692481670863i 1.57079632679489661923-1.76274717403908605046i + + ; print ahacoversin(.5, 1e-5), ahacoversin(.5, 1e-10), ahacoversin(.5, 1e-15), ahacoversin(.5, 1e-20) + 0 0 0 0 + + ; print ahacoversin(5), ahacoversin(5i) + -1.57079632679489661923+2.88727095035762068505i 0.09918204387849273625-3.00312524371312921749i + + ; print ahacoversin(5+5i) + -0.73144212314418701068-3.29254348147605425075i + + ; pi = pi(1e-20) + ; print ahacoversin(pi/6), ahacoversin(pi/3) + -0.04721509173238348552 -1.57079632679489661923+0.4311526751624601302i + + ; print ahacoversin(4*pi/3) + -1.57079632679489661923+2.6869677693029370051i + +LIMITS + 0 < eps < 1 + +LINK LIBRARY + NUMBER *qahacoversin(NUMBER *x, NUMBER *eps) + COMPLEX *c_ahacoversin(COMPLEX *x, NUMBER *eps) + +SEE ALSO + sin, cos, tan, cot, sec, csc + asin, acos, atan, acot, asec, acsc + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, havercos, ahacovercos + epsilon + +## Copyright (C) 2023 Landon Curt Noll +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc 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 Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/09/24 11:17:28 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/ahavercos b/help/ahavercos new file mode 100644 index 0000000..61cc821 --- /dev/null +++ b/help/ahavercos @@ -0,0 +1,81 @@ +NAME + ahavercos - inverse half versed trigonometric cosine + +SYNOPSIS + ahavercos(x [,eps]) + +TYPES + x number (real or complex) + eps 0 < real < 1, defaults to epsilon() + + return real + +DESCRIPTION + Returns the inverse half versed trigonometric cosine of x to a multiple of eps with error less in + absolute value than .75 * eps. + + This function is sometimes called ahaverc, or archavercos, or archavercosine, is equivalent to: + + ahavercos(x) = acos(2*x - 1) + +EXAMPLE + ; print ahavercos(0), ahavercos(0.5), ahavercos(1) + 3.14159265358979323846 1.57079632679489661923 0 + + ; print ahavercos(-0.5), ahavercos(-1) + 3.14159265358979323846-1.31695789692481670863i 3.14159265358979323846-1.76274717403908605046i + + ; print ahavercos(.5, 1e-5), ahavercos(.5, 1e-10), ahavercos(.5, 1e-15), ahavercos(.5, 1e-20) + 1.5708 1.5707963268 1.570796326794897 1.57079632679489661923 + + ; print ahavercos(5), ahavercos(5i) + 2.88727095035762068505i 1.66997837067338935548-3.00312524371312921749i + + ; print ahavercos(5+5i) + 0.83935420365070960856-3.29254348147605425075i + + ; pi = pi(1e-20) + ; print ahavercos(pi/6), ahavercos(pi/3) + 1.52358123506251313372 0.4311526751624601302i + + ; print ahavercos(4*pi/3) + 2.6869677693029370051i + +LIMITS + 0 < eps < 1 + +LINK LIBRARY + NUMBER *qahavercos_or_NULL(NUMBER *q, NUMBER *epsilon); + NUMBER *qahavercos(NUMBER *q, NUMBER *epsilon); + COMPLEX *c_ahavercos(COMPLEX *c, NUMBER *epsilon); + +SEE ALSO + sin, cos, tan, cot, sec, csc + asin, acos, atan, acot, asec, acsc + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, ahacovercos + epsilon + +## Copyright (C) 2023 Landon Curt Noll +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc 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 Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/09/24 11:18:04 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/ahaversin b/help/ahaversin new file mode 100644 index 0000000..6a129a4 --- /dev/null +++ b/help/ahaversin @@ -0,0 +1,81 @@ +NAME + ahaversin - inverse half versed trigonometric sine + +SYNOPSIS + ahaversin(x [,eps]) + +TYPES + x number (real or complex) + eps 0 < real < 1, defaults to epsilon() + + return real + +DESCRIPTION + Returns the inverse half versed trigonometric sine of x to a multiple of eps with error less in + absolute value than .75 * eps. + + This function is sometimes called ahavers, or archaversin, is equivalent to: + + ahaversin(x) = acos(1 - 2*x) + +EXAMPLE + ; print ahaversin(0), ahaversin(0.5), ahaversin(1) + 0 1.57079632679489661923 3.14159265358979323846 + + ; print ahaversin(-0.5), ahaversin(-1) + 1.31695789692481670863i 1.76274717403908605045i + + ; print ahaversin(.5, 1e-5), ahaversin(.5, 1e-10), ahaversin(.5, 1e-15), ahaversin(.5, 1e-20) + 1.5708 1.5707963268 1.570796326794897 1.57079632679489661923 + + ; print ahaversin(5), ahaversin(5i) + 3.14159265358979323846-2.88727095035762068499i 1.47161428291640388291+3.0031252437131292174i + + ; print ahaversin(5+5i) + 2.30223844993908362988+3.29254348147605425081i + + ; pi = pi(1e-20) + ; print ahaversin(pi/6), ahaversin(pi/3) + 1.61801141852728010475 3.14159265358979323846-0.4311526751624601302i + + ; print ahaversin(4*pi/3) + 3.14159265358979323846-2.68696776930293700505i + +LIMITS + 0 < eps < 1 + +LINK LIBRARY + NUMBER *qahaversin_or_NULL(NUMBER *q, NUMBER *epsilon); + NUMBER *qahaversin(NUMBER *q, NUMBER *epsilon); + COMPLEX *c_ahaversin(COMPLEX *c, NUMBER *epsilon); + +SEE ALSO + sin, cos, tan, cot, sec, csc + asin, acos, atan, acot, asec, acsc + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + hacoversin, havercos, ahacovercos + epsilon + +## Copyright (C) 2023 Landon Curt Noll +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc 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 Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/09/24 11:19:54 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/asec b/help/asec index 596a43d..0b5f210 100644 --- a/help/asec +++ b/help/asec @@ -11,26 +11,33 @@ TYPES return real DESCRIPTION - Returns the inverse secant of x to a multiple of eps with error less in + Returns the inverse trigonometric secant of x to a multiple of eps with error less in absolute value than .75 * eps. - This function is sometimes called arcsec, is such that: - - sec(asec(x)) = x - - and such that: - - asec(x) = acos(1/x) + This function is sometimes called arcsec. EXAMPLE - ; print asec(2, 1e-5), asec(2, 1e-10), asec(2, 1e-15), asec(2, 1e-20) - 1.0472 1.0471975512 1.047197551196598 1.04719755119659774615 + ; print asec(0), asec(0.5), asec(1) + Error 10453 1.31695789692481670863i 0 + + ; print asec(-0.5), asec(-1) + 3.14159265358979323846-1.31695789692481670863i 3.14159265358979323846 + + ; print asec(.5, 1e-5), asec(.5, 1e-10), asec(.5, 1e-15), asec(.5, 1e-20) + 1.31695i 1.316957897i 1.316957896924816i 1.31695789692481670863i ; print asec(5), asec(5i) 1.36943840600456582778 1.57079632679489661923+0.19869011034924140647i - ; print acos(5+5i) - 0.79039774680951249644-2.64919617780647114961i + ; print asec(5+5i) + 1.4711326239351014592+0.10033029811220500594i + + ; pi = pi(1e-20) + ; print asec(pi/6), asec(pi/3) + 1.26327680856656556836i 0.30137360974529145454 + + ; print asec(4*pi/3) + 1.32973601406082299099 LIMITS 0 < eps < 1 @@ -42,8 +49,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2021,2023 Landon Curt Noll diff --git a/help/asin b/help/asin index 7a5a01e..a19946c 100644 --- a/help/asin +++ b/help/asin @@ -11,18 +11,18 @@ TYPES return real DESCRIPTION - Returns the inverse sine of x to a multiple of eps with error less in + Returns the inverse trigonometric sine of x to a multiple of eps with error less in absolute value than .75 * eps. - This function is sometimes called arcsin, is such that: - - sin(asin(x)) = x - - and such that: - - asin(x) = acsc(1/x) + This function is sometimes called arcsin. EXAMPLE + ; print asin(0), asin(0.5), asin(1) + 0 0.52359877559829887308 1.57079632679489661923 + + ; print asin(-0.5), asin(-1) + -0.52359877559829887308 -1.57079632679489661923 + ; print asin(.5, 1e-5), asin(.5, 1e-10), asin(.5, 1e-15), asin(.5, 1e-20) 0.5236 0.5235987756 0.523598775598299 0.52359877559829887308 @@ -32,6 +32,13 @@ EXAMPLE ; print asin(5+5i) 0.78039857998538412279+2.64919617780647114961i + ; pi = pi(1e-20) + ; print asin(pi/6), asin(pi/3) + 0.55106958309944636848 1.57079632679489661923-0.30604210861326573756i + + ; print asin(4*pi/3) + 1.57079632679489661923-2.11099630859669864896i + LIMITS 0 < eps < 1 @@ -42,8 +49,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2021,2023 Landon Curt Noll diff --git a/help/atan b/help/atan index dc99649..ed0399d 100644 --- a/help/atan +++ b/help/atan @@ -11,26 +11,33 @@ TYPES return real DESCRIPTION - Returns the inverse tangent of x to a multiple of eps with error less in + Returns the inverse trigonometric tangent of x to a multiple of eps with error less in absolute value than .75 * eps. - This function is sometimes called arctan, is such that: - - tan(atan(x)) = x - - and such that: - - atan(x) = acot(1/x) + This function is sometimes called arctan. EXAMPLE - ; print atan(2, 1e-5), atan(2, 1e-10), atan(2, 1e-15), atan(2, 1e-20) - 1.10715 1.1071487178 1.107148717794091 1.10714871779409050302 + ; print atan(0), atan(0.5), atan(1) + 0 0.46364760900080611621 0.78539816339744830962 + + ; print atan(-0.5), atan(-1) + -0.46364760900080611621 -0.78539816339744830962 + + ; print atan(.5, 1e-5), atan(.5, 1e-10), atan(.5, 1e-15), atan(.5, 1e-20) + 0.46365 0.463647609 0.463647609000806 0.46364760900080611621 ; print atan(5), atan(5i) 1.37340076694501586086 1.57079632679489661923+0.20273255405408219099i - ; print acos(5+5i) - 0.79039774680951249644-2.64919617780647114961i + ; print atan(5+5i) + ~1.47013777260757623920+0.09932544936725086122i + + ; pi = pi(1e-20) + ; print atan(pi/6), atan(pi/3) + 0.48234790710102497548 0.80844879263002203131 + + ; print atan(4*pi/3) + 1.33645023930656045846 LIMITS 0 < eps < 1 @@ -42,8 +49,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2023 Landon Curt Noll diff --git a/help/avercos b/help/avercos index 31e4dab..4b01396 100644 --- a/help/avercos +++ b/help/avercos @@ -19,11 +19,24 @@ DESCRIPTION avercos(x) = acos(x - 1) EXAMPLE + ; print avercos(0), avercos(0.5), avercos(1) + 3.14159265358979323846 2.09439510239319549231 1.57079632679489661923 + + ; print avercos(-0.5), avercos(-1) + 3.14159265358979323846-0.96242365011920689499i 3.14159265358979323846-1.31695789692481670863i + ; print avercos(.5, 1e-5), avercos(.5, 1e-10), avercos(.5, 1e-15), avercos(.5, 1e-20) 2.0944 2.0943951024 2.094395102393195 2.09439510239319549231 - ; print avercos(2), avercos(-5), avercos(2 + 3i) - 0 3.14159265358979323846-2.47788873028847500481i 1.26319267726418536931-1.86416154415788242834i + ; print avercos(5), avercos(5i) + 2.06343706889556054673i 1.76458946334982880901-2.33097465304931241744i + + ; print avercos(5+5i) + 0.90197975146896932949-2.5513216254756988588i + + ; pi = pi(1e-20) + ; print avercos(pi/6), avercos(pi/3), avercos(4*pi/3) + 2.06735337024267487468 1.52358123506251313372 1.82724307729474887792i LIMITS 0 < eps < 1 @@ -36,8 +49,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 2023 Landon Curt Noll diff --git a/help/aversin b/help/aversin index 85c4b27..11d78ac 100644 --- a/help/aversin +++ b/help/aversin @@ -19,11 +19,24 @@ DESCRIPTION aversin(x) = acos(1 - x) EXAMPLE + ; print aversin(0), aversin(0.5), aversin(1) + 0 1.04719755119659774615 1.57079632679489661923 + + ; print aversin(-0.5), aversin(-1) + 0.96242365011920689498i 1.31695789692481670863i + ; print aversin(.5, 1e-5), aversin(.5, 1e-10), aversin(.5, 1e-15), aversin(.5, 1e-20) 1.0472 1.0471975512 1.047197551196598 1.04719755119659774615 - ; print aversin(0), aversin(-5), aversin(2 + 3i) - 0 2.47788873028847500485i 1.87839997632560786916+1.86416154415788242831i + ; print aversin(5), aversin(5i) + 3.14159265358979323846-2.06343706889556054673i 1.37700319023996442947+2.33097465304931241742i + + ; print aversin(5+5i) + 2.23961290212082390892+2.55132162547569885882i + + ; pi = pi(1e-20) + ; print aversin(pi/6), aversin(pi/3), aversin(4*pi/3) + 1.07423928334711836378 1.61801141852728010475 3.14159265358979323846-1.82724307729474887791i LIMITS 0 < eps < 1 @@ -36,8 +49,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin - acoversin + versin, coversin, vercos, covercos + acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 2023 Landon Curt Noll diff --git a/help/cos b/help/cos index 00f9d2f..4ddff01 100644 --- a/help/cos +++ b/help/cos @@ -11,10 +11,13 @@ TYPES return number DESCRIPTION - Calculate the cosine of x to a multiple of eps with error less in + Calculate the trigonometric cosine of x to a multiple of eps with error less in absolute value than .75 * eps. EXAMPLE + ; print cos(1/2), cos(5/7), cos(42/7) + 0.87758256189037271612 0.75556134670069659847 0.96017028665036602055 + ; print cos(1, 1e-5), cos(1, 1e-10), cos(1, 1e-15), cos(1, 1e-20) 0.5403 0.5403023059 0.54030230586814 0.5403023058681397174 @@ -22,11 +25,8 @@ EXAMPLE -4.18963-9.10923i -4.189625691-9.1092278938i ; pi = pi(1e-20) - ; print cos(pi/3, 1e-10), cos(pi/2, 1e-10), cos(pi, 1e-10) - 0.5 0 -1 - - ; print cos(1/2), cos(5/7), cos(42/7) - 0.87758256189037271612 0.75556134670069659847 0.96017028665036602055 + ; print cos(pi/6), cos(pi/2), cos(pi) + 0.86602540378443864676 0 -1 LIMITS 0 < eps < 1 @@ -38,8 +38,10 @@ LINK LIBRARY SEE ALSO sin, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2021,2023 Landon Curt Noll diff --git a/help/cot b/help/cot index 793267b..f40e104 100644 --- a/help/cot +++ b/help/cot @@ -11,7 +11,7 @@ TYPES return real DESCRIPTION - Calculate the cotangent of x to a multiple of eps, with error less + Calculate the trigonometric cotangent of x to a multiple of eps, with error less in absolute value than .75 * eps. This function is equivalent to: @@ -19,6 +19,9 @@ DESCRIPTION cot(x) = cos(x) / sin(x) EXAMPLE + ; print cot(1/2), cot(5/7), cot(42/7) + 1.83048772171245191927 1.15339160419695060142 -3.43635300418012783207 + ; print cot(1, 1e-5), cot(1, 1e-10), cot(1, 1e-15), cot(1, 1e-20) 0.64209 0.6420926159 0.642092615934331 0.64209261593433070301 @@ -26,11 +29,10 @@ EXAMPLE ~-0.00373977357605613583-~0.99675796378381737782i ~-0.00373971037383300017-~0.99675779657435500069i ; pi = pi(1e-20) - ; print cot(pi/12, 1e-10), cot(pi/6, 1e-10), cot(pi/3, 1e-10), cot(pi/2, 1e-10) - 3.7320508076 1.7320508076 0.5773502692 0 + ; print cot(pi/6), cot(pi/2), cot(pi) + 1.73205080756887729353 0 -378303066284076833726.92240766640467212978 - ; print cot(1/2), cot(5/7), cot(42/7) - 1.83048772171245191927 1.15339160419695060142 -3.43635300418012783207 + ; # NOTE: The huge value for cot(pi) is due to the fact that pi is not exact. LIMITS 0 < eps < 1 @@ -42,8 +44,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2021,2023 Landon Curt Noll diff --git a/help/covercos b/help/covercos index e08806d..547c165 100644 --- a/help/covercos +++ b/help/covercos @@ -14,13 +14,13 @@ DESCRIPTION Calculate the coversed trigonometric cosine of x to a multiple of eps with error less in absolute value than .75 * eps. - This function is sometimes called cvc, is equivalent to: + This function is sometimes called cvc, or covercosine, is equivalent to: covercos(x) = 1 + sin(x) EXAMPLE - ; print covercos(0.2), covercos(3/7), covercos(-31) - 1.19866933079506121546 1.41557185499305200807 1.40403764532306500605 + ; print covercos(1/2), covercos(5/7), covercos(42/7) + 1.47942553860420300027 1.6550778971785185742 0.72058450180107412719 ; print covercos(1, 1e-5), covercos(1, 1e-10), covercos(1, 1e-15), covercos(1, 1e-20) 1.84147 1.8414709848 1.841470984807896 1.84147098480789650665 @@ -29,8 +29,8 @@ EXAMPLE 10.1545-4.16891i 10.1544991469-4.16890696i ; pi = pi(1e-20) - ; print covercos(pi/6, 1e-10), covercos(pi/2, 1e-10), covercos(pi, 1e-10), covercos(3*pi/2, 1e-10) - 1.5 2 1 0 + ; print covercos(pi/6), covercos(pi/2), covercos(pi) + 1.5 2 1 LIMITS 0 < eps < 1 @@ -42,8 +42,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 2023 Landon Curt Noll diff --git a/help/coversin b/help/coversin index a0d5b51..f639c11 100644 --- a/help/coversin +++ b/help/coversin @@ -19,8 +19,8 @@ DESCRIPTION coversin(x) = 1 - sin(x) EXAMPLE - ; print coversin(0.2), coversin(3/7), coversin(-31) - 0.80133066920493878454 0.58442814500694799193 0.59596235467693499395 + ; print coversin(1/2), coversin(5/7), coversin(42/7) + 0.52057446139579699973 0.3449221028214814258 1.27941549819892587281 ; print coversin(1, 1e-5), coversin(1, 1e-10), coversin(1, 1e-15), coversin(1, 1e-20) 0.15853 0.1585290152 0.158529015192104 0.15852901519210349335 @@ -29,8 +29,8 @@ EXAMPLE -8.1545+4.16891i -8.1544991469+4.16890696i ; pi = pi(1e-20) - ; print coversin(pi/6, 1e-10), coversin(pi/2, 1e-10), coversin(pi, 1e-10), coversin(3*pi/2, 1e-10) - 0.5 0 1 2 + ; print coversin(pi/6), coversin(pi/2), coversin(pi) + 0.5 0 1 LIMITS 0 < eps < 1 @@ -42,8 +42,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 2023 Landon Curt Noll diff --git a/help/csc b/help/csc index a90b21d..c0ae382 100644 --- a/help/csc +++ b/help/csc @@ -11,7 +11,7 @@ TYPES return real DESCRIPTION - Calculate the cosecant of x to a multiple of eps, with error less + Calculate the trigonometric cosecant of x to a multiple of eps, with error less in absolute value than .75 * eps. This function is equivalent to: @@ -19,6 +19,9 @@ DESCRIPTION csc(x) = 1 / sin(x) EXAMPLE + ; print csc(1/2), csc(5/7), csc(42/7) + 2.08582964293348818577 1.52653601091884339347 -3.57889954725440563736 + ; print csc(1, 1e-5), csc(1, 1e-10), csc(1, 1e-15), csc(1, 1e-20) 1.1884 1.1883951058 1.188395105778121 1.18839510577812121626 @@ -26,11 +29,10 @@ EXAMPLE ~0.09047318155450436310+~0.04120099965201690801i ~0.09047320975303232503+~0.04120098628887626238i ; pi = pi(1e-20) - ; print csc(pi/6, 1e-10), csc(pi/3, 1e-10), csc(4*pi/3, 1e-10) - 2 1.1547005384 -1.1547005384 + ; print csc(pi/6), csc(pi/2), csc(pi) + 2 1 378303066284076833726.92240766640467212978 - ; print csc(1/2), csc(5/7), csc(42/7) - 2.08582964293348818577 1.52653601091884339347 -3.57889954725440563736 + ; # NOTE: The huge value for csc(pi) is because pi, as calculated, is not exact. LIMITS 0 < eps < 1 @@ -42,8 +44,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2023 Landon Curt Noll diff --git a/help/hacovercos b/help/hacovercos new file mode 100644 index 0000000..1bed198 --- /dev/null +++ b/help/hacovercos @@ -0,0 +1,71 @@ +NAME + hacovercos - half coversed trigonometric cosine + +SYNOPSIS + hacovercos(x [,eps]) + +TYPES + x number (real or complex) + eps 0 < real < 1, defaults to epsilon() + + return number + +DESCRIPTION + Calculate the half coversed trigonometric cosine of x to a multiple of eps with error less in + absolute value than .75 * eps. + + This function is sometimes called hacvc, or hacovercosine, is equivalent to: + + hacovercos(x) = covercos(x) / 2 = (1 + sin(x)) / 2 + +EXAMPLE + ; print hacovercos(1/2), hacovercos(5/7), hacovercos(42/7) + ~0.73971276930210150014 0.8275389485892592871 ~0.36029225090053706360 + + ; print hacovercos(1, 1e-5), hacovercos(1, 1e-10), hacovercos(1, 1e-15), hacovercos(1, 1e-20) + 0.920735 0.9207354924 0.920735492403948 ~0.92073549240394825332 + + ; print hacovercos(2 + 3i, 1e-5), hacovercos(2 + 3i, 1e-10) + 5.07725-2.084455i 5.07724957345-2.08445348i + + ; pi = pi(1e-20) + ; print hacovercos(pi/6), hacovercos(pi/2), hacovercos(pi) + 0.75 1 0.5 + +LIMITS + 0 < eps < 1 + +LINK LIBRARY + NUMBER *qhacovercos(NUMBER *x, NUMBER *eps) + COMPLEX *c_hacovercos(COMPLEX *x, NUMBER *eps) + +SEE ALSO + sin, cos, tan, cot, sec, csc + asin, acos, atan, acot, asec, acsc + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos + ahaversin, hacoversin, havercos, ahacovercos + epsilon + +## Copyright (C) 2023 Landon Curt Noll +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc 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 Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/09/24 11:10:08 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/hacoversin b/help/hacoversin new file mode 100644 index 0000000..7826a44 --- /dev/null +++ b/help/hacoversin @@ -0,0 +1,71 @@ +NAME + hacoversin - half coversed trigonometric sine + +SYNOPSIS + hacoversin(x [,eps]) + +TYPES + x number (real or complex) + eps 0 < real < 1, defaults to epsilon() + + return number + +DESCRIPTION + Calculate the half coversed trigonometric sine of x to a multiple of eps with error less in + absolute value than .75 * eps. + + This function is sometimes called hacovers, or hacvs, is equivalent to: + + hacoversin(x) = coversin(x) / 2 = (1 - sin(x)) / 2 + +EXAMPLE + ; print hacoversin(1/2), hacoversin(5/7), hacoversin(42/7) + ~0.26028723069789849986 0.1724610514107407129 ~0.63970774909946293640 + + ; print hacoversin(1, 1e-5), hacoversin(1, 1e-10), hacoversin(1, 1e-15), hacoversin(1, 1e-20) + 0.079265 0.0792645076 0.079264507596052 ~0.07926450759605174668 + + ; print hacoversin(2 + 3i, 1e-5), hacoversin(2 + 3i, 1e-10) + -4.07725+2.084455i -4.07724957345+2.08445348i + + ; pi = pi(1e-20) + ; print hacoversin(pi/6), hacoversin(pi/2), hacoversin(pi) + 0.25 0 0.5 + +LIMITS + 0 < eps < 1 + +LINK LIBRARY + NUMBER *qhacoversin(NUMBER *x, NUMBER *eps) + COMPLEX *c_hacoversin(COMPLEX *x, NUMBER *eps) + +SEE ALSO + sin, cos, tan, cot, sec, csc + asin, acos, atan, acot, asec, acsc + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos + epsilon + +## Copyright (C) 2023 Landon Curt Noll +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc 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 Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/09/24 11:11:11 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/hash b/help/hash index 2c7311d..c81c956 100644 --- a/help/hash +++ b/help/hash @@ -47,7 +47,7 @@ LINK LIBRARY SEE ALSO ishash, fnv, sha1 -## Copyright (C) 1999-2007,2014,2021 Landon Curt Noll +## Copyright (C) 2023 Landon Curt Noll ## ## Calc is open software; you can redistribute it and/or modify it under ## the terms of the version 2.1 of the GNU Lesser General Public License @@ -63,8 +63,8 @@ SEE ALSO ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## -## Under source code control: 1996/03/12 23:10:01 -## File existed as early as: 1996 +## Under source code control: 2023/09/24 11:12:16 +## File existed as early as: 2023 ## ## chongo /\oo/\ http://www.isthe.com/chongo/ ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/havercos b/help/havercos new file mode 100644 index 0000000..d007618 --- /dev/null +++ b/help/havercos @@ -0,0 +1,71 @@ +NAME + havercos - half versed trigonometric cosine + +SYNOPSIS + havercos(x [,eps]) + +TYPES + x number (real or complex) + eps 0 < real < 1, defaults to epsilon() + + return number + +DESCRIPTION + Calculate the half versed trigonometric cosine of x to a multiple of eps with error less in + absolute value than .75 * eps. + + This function is sometimes called haverc, or haverconsine, is equivalent to: + + havercos(x) = vercos(x) / 2 = (1 + cos(x)) / 2 + +EXAMPLE + ; print havercos(1/2), havercos(5/7), havercos(42/7) + 0.93879128094518635806 ~0.87778067335034829924 ~0.98008514332518301028 + + ; print havercos(1, 1e-5), havercos(1, 1e-10), havercos(1, 1e-15), havercos(1, 1e-20) + 0.77015 0.77015115295 0.77015115293407 0.7701511529340698587 + + ; print havercos(2 + 3i, 1e-5), havercos(2 + 3i, 1e-10) + -1.594815-4.554615i -1.5948128455-4.5546139469i + + ; pi = pi(1e-20) + ; print havercos(pi/6), havercos(pi/2), havercos(pi) + 0.93301270189221932338 0.5 0 + +LIMITS + 0 < eps < 1 + +LINK LIBRARY + NUMBER *qhavercos(NUMBER *x, NUMBER *eps) + COMPLEX *c_havercos(COMPLEX *x, NUMBER *eps) + +SEE ALSO + sin, cos, tan, cot, sec, csc + asin, acos, atan, acot, asec, acsc + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, hacovercos + ahaversin, hacoversin, havercos, ahacovercos + epsilon + +## Copyright (C) 2023 Landon Curt Noll +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc 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 Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/09/24 11:13:28 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/haversin b/help/haversin new file mode 100644 index 0000000..fc93772 --- /dev/null +++ b/help/haversin @@ -0,0 +1,71 @@ +NAME + haversin - half versed trigonometric sine + +SYNOPSIS + haversin(x [,eps]) + +TYPES + x number (real or complex) + eps 0 < real < 1, defaults to epsilon() + + return number + +DESCRIPTION + Calculate the half versed trigonometric sine of x to a multiple of eps with error less in + absolute value than .75 * eps. + + This function is sometimes called havers, is equivalent to: + + haversin(x) = versin(x) / 2 = (1 - cos(x)) / 2 + +EXAMPLE + ; print haversin(1/2), haversin(5/7), haversin(42/7) + 0.06120871905481364194 ~0.12221932664965170076 ~0.01991485667481698972 + + ; print haversin(1, 1e-5), haversin(1, 1e-10), haversin(1, 1e-15), haversin(1, 1e-20) + 0.22985 0.22984884705 0.22984884706593 0.2298488470659301413 + + ; print haversin(2 + 3i, 1e-5), haversin(2 + 3i, 1e-10) + 2.594815+4.554615i 2.5948128455+4.5546139469i + + ; pi = pi(1e-20) + ; print haversin(pi/6), haversin(pi/2), haversin(pi) + 0.06698729810778067662 0.5 1 + +LIMITS + 0 < eps < 1 + +LINK LIBRARY + NUMBER *qhaversin(NUMBER *x, NUMBER *eps) + COMPLEX *c_haversin(COMPLEX *x, NUMBER *eps) + +SEE ALSO + sin, cos, tan, cot, sec, csc + asin, acos, atan, acot, asec, acsc + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos + epsilon + +## Copyright (C) 2023 Landon Curt Noll +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc 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 Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/09/24 11:14:48 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/sec b/help/sec index 4726bb3..3953cbc 100644 --- a/help/sec +++ b/help/sec @@ -11,7 +11,7 @@ TYPES return real DESCRIPTION - Calculate the secant of x to a multiple of eps, with error less + Calculate the trigonometric secant of x to a multiple of eps, with error less in absolute value than .75 * eps. This function is equivalent to: @@ -19,6 +19,9 @@ DESCRIPTION sec(x) = 1 / cos(x) EXAMPLE + ; print sec(1/2), sec(5/7), sec(42/7) + 1.13949392732454912231 1.3235192673191814545 1.04148192659510767648 + ; print sec(1, 1e-5), sec(1, 1e-10), sec(1, 1e-15), sec(1, 1e-20) 1.85082 1.8508157177 1.850815717680926 1.85081571768092561791 @@ -26,11 +29,10 @@ EXAMPLE ~-0.04167497639869547021+~0.09061109101765280898i ~-0.04167496441100888150+~0.09061113719571288336i ; pi = pi(1e-20) - ; print 1e-10), sec(pi/6, 1e-10), sec(pi/3, 1e-10), sec(pi, 1e-10) - 1.1547005384 2 -1 + ; print sec(pi/6), sec(pi/2), sec(pi) + 1.15470053837925152902 756606132568153667453.84481533280934425956 -1 - ; print sec(1/2), sec(5/7), sec(42/7) - 1.13949392732454912231 1.3235192673191814545 1.04148192659510767648 + ; # NOTE: The huge value for sec(pi/2) is because pi, as calculated, is not exact. LIMITS 0 < eps < 1 @@ -42,8 +44,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2023 Landon Curt Noll diff --git a/help/sin b/help/sin index 5be97ef..216ad63 100644 --- a/help/sin +++ b/help/sin @@ -11,10 +11,13 @@ TYPES return number DESCRIPTION - Calculate the sine of x to a multiple of eps with error less in + Calculate the trigonometric sine of x to a multiple of eps with error less in absolute value than .75 * eps. EXAMPLE + ; print sin(1/2), sin(5/7), sin(42/7) + 0.47942553860420300027 0.6550778971785185742 -0.27941549819892587281 + ; print sin(1, 1e-5), sin(1, 1e-10), sin(1, 1e-15), sin(1, 1e-20) 0.84147 0.8414709848 0.841470984807896 0.84147098480789650665 @@ -22,12 +25,9 @@ EXAMPLE 9.1545-4.16891i 9.1544991469-4.16890696i ; pi = pi(1e-20) - ; print sin(pi/6, 1e-10), sin(pi/2, 1e-10), sin(pi, 1e-10) + ; print sin(pi/6), sin(pi/2), sin(pi) 0.5 1 0 - ; print sin(1/2), sin(5/7), sin(42/7) - 0.47942553860420300027 0.6550778971785185742 -0.27941549819892587281 - LIMITS 0 < eps < 1 @@ -38,8 +38,10 @@ LINK LIBRARY SEE ALSO cos, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2021,2023 Landon Curt Noll diff --git a/help/tan b/help/tan index 44afa55..65b72d7 100644 --- a/help/tan +++ b/help/tan @@ -11,7 +11,7 @@ TYPES return real DESCRIPTION - Calculate the tangent of x to a multiple of eps, with error less + Calculate the trigonometric tangent of x to a multiple of eps, with error less in absolute value than .75 * eps. This function is equivalent to: @@ -19,6 +19,9 @@ DESCRIPTION tan(x) = sin(x) / cos(x) EXAMPLE + ; print tan(1/2), tan(5/7), tan(42/7) + 0.54630248984379051326 0.8670082185107029875 -0.29100619138474915705 + ; print tan(1, 1e-5), tan(1, 1e-10), tan(1, 1e-15), tan(1, 1e-20) 1.55741 1.5574077247 1.557407724654902 1.55740772465490223051 @@ -26,11 +29,10 @@ EXAMPLE ~-0.00376408798745471014+~1.00323845857938817252i ~-0.00376402563894634508+~1.00323862734859967572i ; pi = pi(1e-20) - ; print tan(0, 1e-10), tan(pi/6, 1e-10), tan(pi/3, 1e-10), tan(pi, 1e-10) - 0 0.5773502692 1.7320508076 0 + ; print tan(pi/6), tan(pi/2), tan(pi) + 0.57735026918962576451 756606132568153667453.84481533280934425956 0 - ; print tan(1/2), tan(5/7), tan(42/7) - 0.54630248984379051326 0.8670082185107029875 -0.29100619138474915705 + ; # NOTE: The huge value for tan(pi/2) is due to the fact that pi is not exact. LIMITS 0 < eps < 1 @@ -42,8 +44,10 @@ LINK LIBRARY SEE ALSO sin, cos, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 1999,2023 Landon Curt Noll diff --git a/help/vercos b/help/vercos index 16077df..35a7adf 100644 --- a/help/vercos +++ b/help/vercos @@ -14,13 +14,13 @@ DESCRIPTION Calculate the versed trigonometric cosine of x to a multiple of eps with error less in absolute value than .75 * eps. - This function is sometimes called verc, is equivalent to: + This function is sometimes called verc, or vercosin, is equivalent to: vercos(x) = 1 + cos(x) EXAMPLE - ; print vercos(0.2), vercos(3/7), vercos(-31) - 1.98006657784124163112 1.90956035167416667403 1.91474235780453127896 + ; print vercos(1/2), vercos(5/7), vercos(42/7) + 1.87758256189037271612 1.75556134670069659847 1.96017028665036602055 ; print vercos(1, 1e-5), vercos(1, 1e-10), vercos(1, 1e-15), vercos(1, 1e-20) 1.5403 1.5403023059 1.54030230586814 1.5403023058681397174 @@ -29,8 +29,8 @@ EXAMPLE -3.18963-9.10923i -3.189625691-9.1092278938i ; pi = pi(1e-20) - ; print vercos(pi/3, 1e-10), vercos(pi/2, 1e-10), vercos(pi, 1e-10), vercos(3*pi/2, 1e-10) - 1.5 1 0 1 + ; print vercos(pi/6), vercos(pi/2), vercos(pi) + 1.86602540378443864676 1 0 LIMITS 0 < eps < 1 @@ -42,8 +42,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + versin, coversin, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 2023 Landon Curt Noll diff --git a/help/versin b/help/versin index 2195d07..dcfd027 100644 --- a/help/versin +++ b/help/versin @@ -19,8 +19,8 @@ DESCRIPTION versin(x) = 1 - cos(x) EXAMPLE - ; print versin(0.2), versin(3/7), versin(-31) - 0.01993342215875836888 0.09043964832583332597 0.08525764219546872104 + ; print versin(1/2), versin(5/7), versin(42/7) + 0.12241743810962728388 0.24443865329930340153 0.03982971334963397945 ; print versin(1, 1e-5), versin(1, 1e-10), versin(1, 1e-15), versin(1, 1e-20) 0.4597 0.4596976941 0.45969769413186 0.4596976941318602826 @@ -29,8 +29,8 @@ EXAMPLE 5.18963+9.10923i 5.189625691+9.1092278938i ; pi = pi(1e-20) - ; print versin(pi/3, 1e-10), versin(pi/2, 1e-10), versin(pi, 1e-10), versin(3*pi/2, 1e-10) - 0.5 1 2 1 + ; print versin(pi/6), versin(pi/2), versin(pi) + 0.13397459621556135324 1 2 LIMITS 0 < eps < 1 @@ -42,8 +42,10 @@ LINK LIBRARY SEE ALSO sin, cos, tan, cot, sec, csc asin, acos, atan, acot, asec, acsc - versin, coversin, vercos, avercos - aversin, acoversin, covercos, acovercos + coversin, vercos, covercos + aversin, acoversin, avercos, acovercos + haversin, hacoversin, havercos, hacovercos + ahaversin, hacoversin, havercos, ahacovercos epsilon ## Copyright (C) 2023 Landon Curt Noll