On the approximation of Riemann's Zeta Function for S=3 (Apéry's constant)

Recently I've been obsessed with the Riemann's Hypothesis (RH). RH states that the zeroes for a particular type of equation called the "Zeta Function" lies on a particular line. The main corollary of proving such conjecture is that due to Euler, it will be possible to come up with a precise formula for the distribution of primes. It will be an interesting phenomenal when RH is proved: not only we'll know that the primes are distributed randomly, but they will also behave according to some predictable formula. Meaning that primes will be, at the same time, random but predictable, something that humans can't really grasp yet.

The Zeta Function has well-known values, especially for positive even numbers. Zeta(2) and Zeta(4) were discovered by Euler, and both follow the pattern (k * PI^n)/m.

Question is, can we write some code to approximate Zeta(3) using the same structure? Yes, we can.

First have a code which implements Zeta (straightforward). The main loop will iterate over k, n and m looking for the solution that minimizes the difference between the true Zeta(3) and the computed one using each k, n and m, and the structure (k * PI^n)/m. First prove that it gives you the right result for Zeta(2) and Zeta(4), which it does:

Zeta(2) = (1 * PI^2) / 6
Zeta(4) = (1 * PI^4) / 90

Now run for s=3. The result... is this one, insanely close to the true Zeta(3):


Code is below, cheers, ACC.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Riemman
{
 class Program
 {
  static void Main(string[] args)
  {
   ZetaFunctionConjecture(Convert.ToDouble(args[0]));
  }

  static void ZetaFunctionConjecture(double s)
  {
   double zeta = ZetaFunction(s);

   double minDelta = double.MaxValue;
   int bestK = -1;
   int bestN = -1;
   int bestM = -1;

   int si = (int)s;
   int limit1 = si % 2 == 1 ? si * si + 1 : si + 1;
   int limit2 = si % 2 == 1 ? si * si + 1 : si + 1;
   int limit3 = si % 2 == 1 ? si * 1000000 : si * 10000;
   for (int k = 1; k <= limit1; k++)
   {
    for (int n = 1; n <= limit2; n++)
    {
     for (int m = 1; m <= limit3; m++)
     {
      double current = 0;

      current = Math.Abs(zeta - ((k * Math.Pow(Math.PI, n)) / m));
      if (current < minDelta)
      {
       minDelta = current;
       bestK = k;
       bestN = n;
       bestM = m;
      }
     }
    }
   }

   Console.WriteLine("Zeta({0}) = ({1} * PI^{2}) / {3}", s, bestK, bestN, bestM);
  }

  static double ZetaFunction(double s)
  {
   double result = 0;
   int MAX = 1000;

   for (int i = 1; i <= MAX; i++)
   {
    result += (1.0 / Math.Pow(i, s));
   }

   return result;
  }
 }
}

Comments

  1. This comment has been removed by a blog administrator.

    ReplyDelete

Post a Comment

Popular posts from this blog

Count Binary Substrings

Count Vowels Permutation: Standard DP

Maximum Number of Balloons