6
$\begingroup$

If we want to calculate $\sin(x)$ and $\cos(x)$ for very large $x$ , lets say $10^5$ , the usual way is to reduce the number $x$ modulo $2\pi$.

If the number is a large power of a small number, for example $2^{200}$, we could also use $$\cos(2x)=\cos^2x-\sin^2x$$ and $$\sin(2x)=2\sin(x)\cos(x)$$ multiple times.

Do we have any chance, if the power is too high for both methods ? For example, can we calculate $\sin(x)$ and $\cos(x)$ for $x=10^{10^{10^{10}}}$ ?

Note, that the power tower must be calculated from above. So, we have

$$x=10^{(10^{(10^{10))}}}$$

In tetration-notation, we can write $x=10\uparrow\uparrow 4$

$\endgroup$
  • 1
    $\begingroup$ If I have a small (oldstager) advice, don't ask yourself too artificial questions. There are enough interesting things with "natural" issues. Moreover, the barrier is not of mathematical order : you will reach the computional limit of your machine (machine's epsilon or machine's NaN). $\endgroup$ – Jean Marie Oct 6 '16 at 20:44
  • 1
    $\begingroup$ @JeanMarie I don't understand what you're trying to say. $\endgroup$ – Jam Oct 6 '16 at 20:51
  • 1
    $\begingroup$ If the direct method on machines has a limit, this does not necessarily mean that there is no way to use mathamtical properties to get beyond that limit. For example, it is possible to calculate $\ln(10^{10^{100000}})$, although the direct method gives an overflow. $\endgroup$ – Peter Oct 6 '16 at 20:55
  • 2
    $\begingroup$ @JeanMarie $1)$ I am not young, I am $46$ years old. $2)$ I do not think that I lose time if I think about the limits of computability $3)$ Maybe someone knows properties about the trigonometric functions that can actually calculate what I want. In this case, it is not at all a loss of time to ask such a question. From a pragmatical point of view, you are probably right. But impractible mathematical topics are often much more interesting. $\endgroup$ – Peter Oct 6 '16 at 21:06
  • 1
    $\begingroup$ @JeanMarie I see what you're saying and while I agree that we shouldn't waste time on dead ends (I, for one, wasted at least a day of my summer when I was 17 trying to integrate $\int e^{\sin x}$ before I learnt that Galois Theory was a thing) but this definitely isn't a completely niche and inapplicable question, I actually wanted to know just a couple of weeks ago what $\sin(10^{10^{10^{10}}})$ was. And like Peter says, if we can calculate $\ln10^{10^{10^{10}}}$, it wouldn't be stupid to wonder if we can calculate $\sin10^{10^{10^{10}}}$, especially given that we know it's in $[-1,1]$. $\endgroup$ – Jam Oct 6 '16 at 21:07
3
$\begingroup$

By computing $\cos(x)$ and $\sin(x)$ (and thus $\exp(ix)$), you are in effect computing the fractional part of $x/(2\pi)$. Any numerical procedure that attempts to do this (approximately) must deal with the fact this is extremely sensitive to small relative errors in $x$, when $x$ is large. Thus if you want to approximate $\cos\left(10^{10^{10}}\right)$ to any accuracy, you'd need to do computations with at least $10^{10}$ significant digits. This might be near the boundary of feasibility with today's computers. But for $\cos\left(10^{10^{10^{10}}}\right)$, you'd need $10^{10^{10}}$ significant digits; the known universe wouldn't be big enough to store that many digits.

| cite | improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ I agree that the reduction modulo $2\pi$ cannot be done in this case, but there might be completely other approaches. $\endgroup$ – Peter Oct 6 '16 at 21:12
  • $\begingroup$ Any formula for $\cos(Nx)$ (where $N$ is a large integer) in terms of $\cos(x)$ and $\sin(x)$ suffers from the same sensitivity problem. You might do $\cos(N x)$ algebraically if $x$ is a rational multiple of $\pi$ (since you just need to know $N$ modulo twice the denominator), but $\pi$ is irrational so this won't help for $x=1$. $\endgroup$ – Robert Israel Oct 6 '16 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.