General Discussion > Math and Science
Computing Arcsine
(1/1)
Xeda112358:
I'm really peeved that I cannot seem to find an algorithm for computing arcsine that works like what I have. This algorithm is based on my work from years ago to compute sine and I have no idea why I never reversed it before now. Anyways, the algorithm:
ArcSine(x), ##x\in[-1,1]##MathJax.Hub.Queue(["Typeset", MathJax.Hub, document.getElementById("bbclatex66311a0b12f11")]);console.log("Queued!");
--- Code: --- x=2x
s=z=sign(x)
iterate n times
x=x*x-2
if x<0
s=-s
z=2z+s
return pi*z*2^(-n-2)
--- End code ---
This algorithm extracts one bit each iteration, so for 16 bit of accuracy, you would iterate 16 times. I think it is a pretty cute and compact algorithm, so where is it? @_@
As a note, at the endpoints {-1,1} it may not give the expected answer. In both cases, if allowed to run infinitely, it would return (in binary): ##\frac{\pi}{2}.1111111111111..._{2}##MathJax.Hub.Queue(["Typeset", MathJax.Hub, document.getElementById("bbclatex66311a0b12f2e")]);console.log("Queued!"); which of course is equivalent to ##\frac{\pi}{2}##MathJax.Hub.Queue(["Typeset", MathJax.Hub, document.getElementById("bbclatex66311a0b12f36")]);console.log("Queued!");.
Navigation
[0] Message Index
Go to full version