Is it possible to calculate inverse sine without using pi?

656 Views Asked by At

I'm asking this in a programming context (because I'm a programmer) but I'm looking for general answers as well.

In programming, all of the implementations of asin ($\arcsin$) that I have seen involve, at some point, the use of a constant directly derived from $\pi$ (for example, this implementation uses a hard-coded $\pi/2$).

My question is: Is there another method of calculating $\arcsin$ that doesn't rely on knowing $\pi$?

The only method I have been able to imagine is to substitute calculated approximations of $\pi$ in place for the hard-coded values in the implementations (e.g. approximate the area of a circle by counting discrete pairs $(x,y)$ that satisfy $x^2+y^2<r^2$ and dividing by $r^2$, or using a Taylor series approximation). This is not really in the "spirit" of what I'm looking for. I am more wondering if a method exists that doesn't involve calculating an approximation of $\pi$ to directly substitute in place of a constant.

2

There are 2 best solutions below

2
On BEST ANSWER

We can use power series to compute $$ \begin{align} \sin^{-1}(x) &=\int_0^x\frac{\mathrm{d}t}{\sqrt{1-t^2}}\tag{1}\\ &=\int_0^x\sum_{k=0}^\infty\binom{2k}{k}\left(\frac t2\right)^{2k}\,\mathrm{d}t\tag{2}\\ &=\sum_{k=0}^\infty\frac2{2k+1}\binom{2k}{k}\left(\frac x2\right)^{2k+1}\tag{3} \end{align} $$ $(2)$ follows from the Generalized Binomial Theorem.

To get better convergence near $x=1$, we can use $$ \sin^{-1}(x)=3\sin^{-1}\left(\frac12\right)-\sin^{-1}\left(\sqrt{1-x^2}\right)\tag{4} $$ Of course, you might consider this cheating since $3\sin^{-1}\left(\frac12\right)=\pi/2$.

0
On

You can use the Taylor series $x+x^3/6+(3 x^5)/40+(5 x^7)/112+(35 x^9)/1152+(63 x^{11})/2816+O(x^{12})$, which doesn't use $\pi$. To improve accuracy, you can use the half-angle formula to reduce the argument. You can test against a hard-coded $\frac 12$ or something convenient to know when you can stop.