Post Reply 
Question for Trig Gurus
07-31-2022, 09:54 PM
Post: #28
RE: Question for Trig Gurus
(07-31-2022 11:08 AM)Thomas Klemm Wrote:  Inverse Cosine

It turns out that we can not use \(d(2, 2)\) here as well to get 5 correct figures.
So we need to compute \(d(3, 3)\) ...

There is no difference in convergence rate, whether we pick atan, asin, or acos
All based on extrapolation of sequence ak = (c1/2^k) / tan(c2/2^k) ⇒ a = c1/c2

Basing all from atan(x) is better, because acot(x) = atan(1/x), without using square roots.
Using d(3,3), and atan argument reduced to within to ±1/√3, we get 9+ correct digits.
(with simpler d(2,2), we have 6+ digits accuracy)

Code:
function atand(x) -- = deg(atan(x)), 9+ digits accuracy
    if signbit(x) then return -atand(-x) end
    if x > 1 then return 90 - atand(1/x) end
    if x > 1/sqrt(3) then return 45 - atand((1-x*x)/(2*x))/2 end
    local g = sqrt(1+x*x)   -- g0
    local a = (1+g)/2       -- a1
    local s = -1 + 84*a
    g = sqrt(a*g)           -- g1
    a = (a+g)/2             -- a2
    s = s + 704*a + 2048*sqrt(a*g)
    return x/s * 510300/pi
end

lua> function asind(x) return atand(x/sqrt(1-x*x)) end -- range = -90 .. 90
lua> function acosd(x) return 90 - asind(x) end -- range = 0 .. 180

lua> deg(atan(0.6)) , atand(0.6)
30.96375653207352  30.963756534561696
lua> deg(acos(0.6)) , acosd(0.6)
53.13010235415598  53.13010235413812
lua> deg(acos(0.7)) , acosd(0.7)
45.5729959991943    45.5729959991943
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Question for Trig Gurus - Namir - 12-01-2014, 07:49 PM
RE: Question for Trig Gurus - toml_12953 - 12-01-2014, 08:08 PM
RE: Question for Trig Gurus - PANAMATIK - 12-01-2014, 08:46 PM
RE: Question for Trig Gurus - Namir - 12-01-2014, 10:54 PM
RE: Question for Trig Gurus - toml_12953 - 12-02-2014, 02:30 AM
RE: Question for Trig Gurus - Namir - 12-02-2014, 09:21 AM
RE: Question for Trig Gurus - Namir - 12-02-2014, 04:57 PM
RE: Question for Trig Gurus - Albert Chan - 07-29-2022, 03:19 PM
RE: Question for Trig Gurus - Mark Hardman - 12-01-2014, 11:00 PM
RE: Question for Trig Gurus - Thomas Klemm - 12-02-2014, 12:09 AM
RE: Question for Trig Gurus - Namir - 12-02-2014, 12:16 AM
RE: Question for Trig Gurus - Thomas Klemm - 12-02-2014, 01:12 AM
RE: Question for Trig Gurus - Namir - 12-02-2014, 01:50 AM
RE: Question for Trig Gurus - Namir - 12-02-2014, 01:49 AM
RE: Question for Trig Gurus - Namir - 12-05-2014, 02:48 AM
RE: Question for Trig Gurus - Namir - 12-09-2014, 02:19 PM
RE: Question for Trig Gurus - Thomas Klemm - 07-29-2022, 12:59 PM
RE: Question for Trig Gurus - ttw - 07-29-2022, 10:19 PM
RE: Question for Trig Gurus - Thomas Klemm - 07-30-2022, 08:26 AM
RE: Question for Trig Gurus - Albert Chan - 07-30-2022, 06:27 PM
RE: Question for Trig Gurus - Thomas Klemm - 07-30-2022, 09:38 AM
RE: Question for Trig Gurus - Thomas Klemm - 07-31-2022, 11:08 AM
RE: Question for Trig Gurus - Albert Chan - 07-31-2022 09:54 PM
RE: Question for Trig Gurus - Thomas Klemm - 08-01-2022, 05:19 AM
RE: Question for Trig Gurus - Albert Chan - 08-01-2022, 02:36 PM
RE: Question for Trig Gurus - Thomas Klemm - 08-02-2022, 06:35 AM
RE: Question for Trig Gurus - Albert Chan - 08-02-2022, 05:28 PM
RE: Question for Trig Gurus - Thomas Klemm - 08-03-2022, 04:42 PM



User(s) browsing this thread: 1 Guest(s)