Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extended Trig Methods
#13
(01-15-2024, 02:34 PM)dbox Wrote: In the process of trying to expand QBJS' support for QB64 keywords I noticed a curiosity with the extended trigonometric functions.  It looks like this has been the case for some time and predates "the incident".

There is a bit of inconsistency with the documentation in the wiki(s) for the support of these keywords.  Some are well documented and have their own page like: _acos, _asin, _hypot, etc..  Many of them, however, are only referenced in the "Derived Mathematical Functions" section of the Mathematical Operations page.  This section, though, is really just a reference of how to implement your own trig functions and doesn't really indicate that many (but not all) of those methods are actually available in the language.

The following functions from this section have first-class keyword support:
_sec, _csc, _cot, _arcsec, _arccsc, _arccot, _sinh, _cosh, _tanh, _sech, _csch, _coth

...while these do not have a dedicated keyword:
_arcsin, arccos, _arcsinh, _arccosh, _arccsch, _arccoth

So the curiosity that I found is related to the _arccsc method.  If you run the following example you will see that you get two different answers for built-in function vs the provided logic in the wiki:

Code: (Select All)
Print _Arccsc(x)
Print Atn(1 / Sqr(1 - x * x)) + (Sgn(x) - 1) * (2 * Atn(1))

Which one is right?
Arcus cosecant(x) is the same as sin^-1(1/x)

Code: (Select All)
x = 1.5 '(example value)

PRINT _ARCCSC(x)
'PRINT ATN(1 / SQR(1 - x * x)) + (SGN(x) - 1) * (2 * ATN(1))
PRINT _ASIN(1 / x)
Reply


Messages In This Thread
Extended Trig Methods - by dbox - 01-15-2024, 02:34 PM
RE: Extended Trig Methods - by SpriggsySpriggs - 01-15-2024, 02:38 PM
RE: Extended Trig Methods - by TerryRitchie - 01-15-2024, 04:32 PM
RE: Extended Trig Methods - by SMcNeill - 01-15-2024, 02:43 PM
RE: Extended Trig Methods - by SMcNeill - 01-15-2024, 02:49 PM
RE: Extended Trig Methods - by dbox - 01-15-2024, 04:11 PM
RE: Extended Trig Methods - by RhoSigma - 01-15-2024, 04:56 PM
RE: Extended Trig Methods - by FellippeHeitor - 01-15-2024, 05:00 PM
RE: Extended Trig Methods - by bplus - 01-15-2024, 06:42 PM
RE: Extended Trig Methods - by dbox - 01-15-2024, 07:28 PM
RE: Extended Trig Methods - by SMcNeill - 01-15-2024, 07:55 PM
RE: Extended Trig Methods - by bplus - 01-15-2024, 08:04 PM
RE: Extended Trig Methods - by BSpinoza - 01-16-2024, 10:31 AM
RE: Extended Trig Methods - by dbox - 01-16-2024, 03:20 PM
RE: Extended Trig Methods - by Kernelpanic - 01-16-2024, 11:33 PM
RE: Extended Trig Methods - by bplus - 01-16-2024, 11:54 PM
RE: Extended Trig Methods - by Kernelpanic - 01-17-2024, 09:07 PM
RE: Extended Trig Methods - by TerryRitchie - 01-17-2024, 10:26 PM
RE: Extended Trig Methods - by Kernelpanic - 01-17-2024, 11:24 PM
RE: Extended Trig Methods - by TerryRitchie - 01-18-2024, 03:15 AM



Users browsing this thread: 7 Guest(s)