function "_ARCSEC()" is wrong? - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: function "_ARCSEC()" is wrong? (/showthread.php?tid=2125) Pages:
1
2
|
function "_ARCSEC()" is wrong? - BSpinoza - 10-28-2023 One example: Code: (Select All)
results in "illegal function call". But " .... the domain of sec inverse x is (-∞, -1] U [1, ∞) (being the range of secant function) and the range of arcsec is [0, π/2) U (π/2, π] (principal branch of sec x). ..." From: https://www.cuemath.com/trigonometry/sec-inverse-x/ The result should be 1.982313172862385. An alternative formula gives the correct result: arcsec(x) = acos(1/x) Code: (Select All)
This works fine and delivers: 1.982313172862385. The Help says: Quote: FUNCTION ARCSEC (x) ' Inverse SecantI think this is not correct! Correct for the domain is: |x| > 1 What do our mathematical specialists think? RE: function "_ARCSEC()" is wrong? - Kernelpanic - 10-28-2023 Quote:What do our mathematical specialists think?If x < 1, the result cannot be correct because there is an error message. If x > 1 the result is zero. I should first go through the formula in peace . . . RE: function "_ARCSEC()" is wrong? - bplus - 10-28-2023 When x < 1 do what you did @BSpinoza because even the help says you can't do it with a straight function call. Your solution looks simpler, so if it works, GO FOR IT! RE: function "_ARCSEC()" is wrong? - SMcNeill - 10-28-2023 Looks like a glitch to me. ARCSEC should work in a range from: x ≤ -1 or x ≥ 1 RE: function "_ARCSEC()" is wrong? - bplus - 10-28-2023 Why is there a forumla for ArcSec given below for Wiki on _ArcSec Keyword? Something is wrong? a typo a wrong word? something... Update: Oh that was from old QB stuff, who cares? water under the bridge RE: function "_ARCSEC()" is wrong? - bplus - 10-28-2023 (10-28-2023, 02:42 PM)bplus Wrote: Why is there a forumla for ArcSec given below for Wiki on _ArcSec Keyword? PRINT _ARCSEC(-2.5) OK it's broken! RE: function "_ARCSEC()" is wrong? - Kernelpanic - 10-28-2023 The formula in the wiki seems to be wrong. Is the result of the formula from the QBasic-Manual correct? Code: (Select All)
RE: function "_ARCSEC()" is wrong? - bplus - 10-28-2023 How does BSpinoza's solution look to you, seems like good idea to me. RE: function "_ARCSEC()" is wrong? - Kernelpanic - 10-28-2023 Something else comes out of it too. Wait for @Spinoza. Code: (Select All)
RE: function "_ARCSEC()" is wrong? - Kernelpanic - 10-28-2023 Correction: @BSpinoza's formula is correct. Code: (Select All)
|