Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function "_ARCSEC()" is wrong?
#12
The same problem with QB64 _ARCCSC-Funktion: domain of x for real result: |x| >1  !
Pls. check this sources:
https://en.wikipedia.org/wiki/Inverse_tr..._functions
https://mathworld.wolfram.com/InverseCosecant.html
https://www.wolframalpha.com/input/?i=arccosec%28x%29

But in the QB64 help and WIKI:

Code: (Select All)

FUNCTION ARCCSC (x) ' Inverse CoSecant
    IF x < 1 THEN ARCCSC = ATN(1 / SQR(1 - x * x)) + (SGN(x) - 1) * (2 * ATN(1)) ELSE BEEP
END FUNCTION


Example:

Code: (Select All)
PRINT _ARCCSC(0.5) 
  
gives: 0.52358...

But arccosec(0.5) is not defined!

The alternative formula for  _ARCCSC(x):

arccosec(x) = arcsin(1/x)

Code: (Select All)
PRINT _ARCCSC(0.5)
PRINT _ASIN(1 / 0.5)

This delivers:

0.52358...
nan

"nan" is correct here. 

conclusion:
I think both functions _ARCSEC and _ARCCSC are not correct in QB64!
Reply


Messages In This Thread
function "_ARCSEC()" is wrong? - by BSpinoza - 10-28-2023, 05:44 AM
RE: function "_ARCSEC()" is wrong? - by bplus - 10-28-2023, 01:40 PM
RE: function "_ARCSEC()" is wrong? - by SMcNeill - 10-28-2023, 01:53 PM
RE: function "_ARCSEC()" is wrong? - by bplus - 10-28-2023, 02:42 PM
RE: function "_ARCSEC()" is wrong? - by bplus - 10-28-2023, 02:56 PM
RE: function "_ARCSEC()" is wrong? - by bplus - 10-28-2023, 04:42 PM
RE: function "_ARCSEC()" is wrong? - by BSpinoza - 10-29-2023, 06:04 AM
RE: function "_ARCSEC()" is wrong? - by BSpinoza - 10-30-2023, 09:22 AM
RE: function "_ARCSEC()" is wrong? - by SMcNeill - 10-30-2023, 10:24 AM
RE: function "_ARCSEC()" is wrong? - by SMcNeill - 10-30-2023, 02:42 PM
RE: function "_ARCSEC()" is wrong? - by SMcNeill - 10-31-2023, 04:23 PM



Users browsing this thread: 6 Guest(s)