On Divergent and Convergent Series
In a math post, I saw a question that was intriguing:
At a first glance, the first series seems to grow much faster than the second one. But in fact, there is something quite interesting about these two series.
The first one was a problem solved by Euler, the so-called the Basel Problem Basel problem - Wikipedia. The series actually is convergent, and it converges to PI^2 / 6, also known as 1.644934066848226436472415166646... So series1 < 1.65.
The second one, on the other hand, can be transformed into something that is well-known. What you can do is multiply both sides to 40, ending up with the following equation:
The part in red of the equation is the famous Harmonic Series Harmonic series (mathematics) - Wikipedia. Which, despite the very slow growth rate, it is a divergent series, meaning that it keeps growing ad infinitum.
Hence, the answer to the question is that, eventually, Series2 >> Series1. But when exactly does Series2 become larger than Series1? That's where we can write some code.
Code below keeps track of the two series growing simultaneously. Very-very quickly, series1 converges to ~1.65. Series2 keeps growing, albeit slowly. It takes around 90 billion (more precisely 89,737,231,905) steps for series2 to cross over series1. But after that, poor series1 remains stuck while series2 enjoys infinite growth. Code is down below, cheers, ACC.
using System; namespace Series { class Program { static void Main(string[] args) { double convergent = 1; double divergent = 1; long den1 = 2; long den2 = 40; long count = 0; for (; ; ) { if (den1 * den1 > 0) convergent += (1.0 / (den1 * den1)); if (den2 > 0) divergent += (1.0 / den2); den1++; den2 += 40; count++; if (count == 1 || count % 100000000 == 0) Console.WriteLine("Step: {0} = C({1}) : D({2})", count, convergent, divergent); if (divergent >= convergent) break; } Console.WriteLine("Step: {0} = C({1}) : D({2})", count, convergent, divergent); } } }
Comments
Post a Comment