I'm coding some numerical methods and I do not know what the correct analysis would be for choosing the implementation for $arcsin$ and $arctan$ for real numbers. Here's what I know:
Both functions have Taylor series about the origin that converge in $(-1, 1)$. The actual domain of $\arcsin$ is $[1, 1]$, and the domain of $\arctan$ is $(-\infty, \infty)$.
For $\arcsin$, I can cover the whole domain by using $\arcsin(x) = \frac{\pi}2 - \arcsin\sqrt{1 - x^2}$. This guarantees $x^2 < \frac 12$, and the Taylor series can be used.
For $\arctan$, I can reduce $|x|$ by a factor greater than $2$ by using $\arctan(x) = 2\arctan\left(\frac x{1 + \sqrt{1 + x^2}}\right)$. This reduction can be repeated until $|x|$ is smaller than a prespecified value, but one reduction is enough to get inside the convergent region. Note also that the Taylor series of $\arctan$ has alternating signs, but the Taylor series of $arcsin$ has only one sign.
I also know that
- $\arctan(x) = \arcsin\left(\frac x{\sqrt{x^2 + 1}}\right)$
- $\arcsin(x) = 2\arctan\left(\frac x{1 + \sqrt{1 - x^2}}\right)$
That means I can use the first equation to reduce $\arctan$ to $\arcsin$ then use method 1, or use the second equation to reduce $\arcsin$ to $\arctan$ then use method 2.
My question is what should I use? I am under the impression that the Taylor series of $\arcsin(x)$ converges a little faster than $\arctan(x)$ termwise, so method 1 may be better. But method 2 allows arbitrary reduction of $|x|$ (at the cost of one square root per reduction), so convergence could be made faster(?). I'm a bit concerned about alternating signs in the Taylor series of $\arctan$ too.
I think I may not know enough numerical analysis to decide. Please help...