Friday, September 15, 2017

Tangent of a Googol

There's an interesting math problem (with a fun backstory) in Feynman's autobiography "Surely You're Joking, Mr. Feynman!" The question is simply to calculate
tan(10100).
I'm considering the problem in radians, but it's also challenging in degrees.
The number 10100  can also be written as
10,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.
This is a very big number that is also known as "a googol," which is pronounced the same as "Google."
Usual methods of calculating the tangent ("tan") function don't work well on very large numbers. If you Google "tan(googol)" or "tan(10^100)" you actually get different results (both wrong). You do get the correct result if you use Wolfram Alpha.
One way to get the right answer is to find a multiple of π that is very near a googol (call it nπ for some integer n). Then, because tangent is a π-periodic function,
tan(10100)=tan(10100-nπ),
and, since 10100-nπ is a fairly small number, its tangent can be calculated accurately by normal methods.
Finding the number n and, say, 9 digits of 10100-nπ requires knowing 109 digits of π, but this is easy to look up.
After some Googling, I couldn't find anyone that actually stated a decimal answer to this question, which is my main purpose here. It's about 0.401231962.