Intereting Posts

The first Stiefel-Whitney class is zero if and only if the bundle is orientable
Show that $G\to\operatorname{Aut}(G)$, $g\mapsto (x\mapsto gxg^{-1})$ is a homomorphism
Globally generated vector bundle
Automorphisms of a non-abelian group of order $p^{3}$
Random walk $< 0$
Harmonic Numbers series I
Is $x^6 + 3x^3 -2$ irreducible over $\mathbb Q$?
Give an example to show that a factor ring of a ring with divisors of 0 may be an integral domain
Geometrico-Harmonic Progression
Almost-identity: $ \prod_{k=0}^N\text{sinc}\left(\frac{x}{2k+1}\right) = \frac{1}{2}$
prove change of basis matrix is unitary
How to determine highest power of $2$ in $3^{1024}-1$?
Holomorphic function with zero derivative is constant on an open connected set
Localisation is isomorphic to a quotient of polynomial ring
Foundational proof for Mersenne primes

For several days, I’ve been wondering how it would be possible to compute the sine of huge numbers like `100000!`

(radians). I obviously don’t use `double`

but `cpp_rational`

from the boost multiprecision library. But I can’t simply do `100000! mod 2pi`

and then use the builtin function `sinl`

(I don’t need more than 10 decimal digits..) as I’d need several million digits of pi to compute this accurately.

Is there any way to achieve this?

- Is there a mathematical property which could help “sum up” information from certain matrix areas?
- The Digits of Pi and e

- Find intersection of two lines given subtended angle
- Defining sine and cosine
- Closed form for this sum with hyperbolic cotangent $\sum _{n=1}^{\infty }\frac{\coth (xn)}{n^3}$
- Prove $\cos 3x =4\cos^3x-3\cos x$
- Is there a way to get trig functions without a calculator?
- A Golden Ratio Symphony! Why so many golden ratios in a relatively simple golden ratio construction with square and circle?
- Finite Series $\sum_{k=1}^{n-1}\frac1{1-\cos(\frac{2k\pi}{n})}$
- How to prove that $\lim\limits_{x\to0}\frac{\tan x}x=1$?
- How to prove that the problem cannot be solved by the four Arithmetic Operations?
- How to derive compositions of trigonometric and inverse trigonometric functions?

I believe you may be able to calculate this without obscene numbers of digits of $\pi$ if you take advantage of the fact that these are factorials. To simplify the algebra, we can calculate $a_n=e^{i(n!)}$ instead (you want the imaginary part). Then $$a_{n+1}=e^{i(n!)(n+1)}=a_n^{n+1},$$ and it’s perfectly reasonable to calculate $a_{100000}$ recursively with a high-precision library.

The downside is that to start the recursion you need a very good approximation of $e^i$, and I don’t know if the error dependence works out any differently than in the $\pmod{2\pi}$ approach.

But to answer your actual question, Mathematica doesn’t even break a sweat with the mere million digits needed for this:

```
> Block[{$MaxExtraPrecision = 1000000}, N[Sin[100000!], 10]]
-0.9282669319
```

takes about 15 ms on my computer.

For calculating the sine or cosine of a large arbitrary precision *real* number $x$, the gains of this method (which are tuned for $\sin n$ for integer $n$) are mostly lost, so I would recommend your original idea of reducing the argument $\bmod 2\pi$. As has been noted, the main bottleneck is a high-precision estimation of $\pi$. Your answer will be useless unless you can at least calculate $\frac{x}{\pi}$ to within $1$ (otherwise you may as well answer “somewhere between $-1$ and $1$”), so you need at least $\log_2(x/\pi^2)$ bits of precision for $\pi$. With $x\approx100000!$, that’s about $1516701$ bits or $456572$ digits. Add to this the number $a$ of bits of precision you want in the result, so about $1516734$ digits of $\pi$ to calculate $33$ bits ($\approx 10$ digits) of $\sin x$ in the range $x\approx 100000!$.

Once you have an integer $n$ such that $y=2\pi n$ is close to $x$ (ideally $|x-2\pi n|\le2\pi$, it doesn’t have to be perfectly rounded), calculate $\pi$ to precision $a+\log_2(n)$, so that $y$ is known to precision $a$, and then $x-y$ is precision $a$ and $\sin x=\sin (x-y)$ can be calculated to precision $a$ as well.

- $f(x^2) = xf(x)$ implies that $ f(x) = mx$?
- Finding $ \prod_{n=1}^{999}\sin\left(\frac{n \pi}{1999}\right)$
- $X$ is a basis for free abelian group $A_{n}$ if and only if $\det (M) = \pm 1$
- How would you find the exact roots of $y=x^3+x^2-2x-1$?
- How to proof that more than half binary algebraic operations on a finite set are non-commutative?
- Sudoku puzzle with exactly 3 solutions
- Rings with isomorphic proper subrings
- Number of homomorphisms between two cyclic groups.
- Is Infinity =Undefined?
- Prove that the sequence converges
- Metrizable compactifications
- What does Structure-Preserving mean?
- Proving that all integers are even or odd
- Show that $x^2\equiv a \pmod {2^n}$ has a solution where $a\equiv1 \pmod 8$ and $n\ge3$
- Solving complex numbers equation $z^3 = \overline{z} $