Computation of the Arcsin/Arccos

The MacLaurin (Taylor series at x=0) series for the arcsin

{\displaystyle{ \arcsin(x) = \sum_{k=0}^{\infty} \frac{(2k-1)!{\kern-1.25pt}!}{(2k)!{\kern-1.25pt}!} \frac{x^{2k+1}}{2k+1} }}

is a very slowly converging one, especially close to the branchpoints at -1 and 1.
The MacLaurin series for arccos is the same as for arcsin because of

{\displaystyle{ \arccos x = \frac{\pi}{2} - \arcsin x }}

so it has the very same problem.

The series for the arctan on the other side is simpler to compute.
Another good reason: I have it already implemented 😉

The arcsin is related to the atan by

{\displaystyle{ \arcsin x  = 2\arctan\biggl(\frac{x}{1 + \sqrt{1 - x^2} } \biggr) }}

which seems to be of no help at all because the fraction does not get very small and the series for atan is also quite slow near -1 and 1. We can use another relation for this range.

{\displaystyle{ \arcsin x  = \mathop{\mathrm{sgn}}(x)\arctan\Biggl(\sqrt{\frac{x^2}{1 - x^2 }} \Biggr) }}

Seems not of much use but we can expand the root

{\displaystyle{ \arcsin x  = \mathop{\mathrm{sgn}}(x)\arctan\biggl(\frac{x}{\sqrt{1 - x^2 }} \biggr) }}

The closer x comes to the branchpoint the larger the fraction, but with

{\displaystyle{ \arctan x = \frac{\pi}{2} -  \arctan \frac{1}{x}  }}

the actual value gets close to zero when x goes close to one and \arctan 0 = 0 so
\arcsin 1 = \frac{\pi}{2} which is correct and as intended. The point where \frac{x}{\sqrt{1 - x^2 }} = 1 is at x = \frac{1}{\sqrt{2}} and at this point \arctan 1 = \arcsin \frac{1}{\sqrt{2}} = \frac{\pi}{4}.

My cutoff points will be \arcsin = 2\arctan \bigl(\frac{x}{1 + \sqrt{1 - x^2} } \bigr) for |x| \le 0.8 and \arctan\bigl(\frac{x}{\sqrt{1 - x^2 }} \bigr) for |x| > 0.8.

No code yet, just twiddling with math, sorry 😉

For x \in\mathbb{R} \land |x| > 1 the real part of the result is always \frac{\pi}{2} and the imaginary part \mathop{\mathrm{sgn}}(z)  \log\bigl(x + \sqrt{x^2-1}\bigr) . This comes from one of the definitions

{\displaystyle{ \arcsin x  = -i\log\biggl(ix + \sqrt{1 - x^2 }\biggr)  }}

I will use this definition for complex arguments.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s