Plotting of a Bounded Riemann Zeta Function

Riemann's Zeta Function is at the center of the Riemann's Hypothesis which says that all the zeroes for the Zeta Function are of the form ki + 1/2 (in other words, the real part of all zeroes for the Zeta Function is 1/2). The importance of this hypothesis is that, if confirmed to be true (which most mathematicians believe it to be true), it can provide a very well-defined structure for the constructions of Prime Numbers. For example, one of the corollaries of proving the Riemann hypothesis is that we'll have a precise way to determine the number of primes less than a given M. Hence one can then use this formula to calculate any number of primes between two given numbers N and M. The mathematical importance of finding a well-structured behavior for prime numbers is monumental: prime numbers are the basis of number theory, and despite them being infinite (proved first by Euclid in 300 BCE) and seeming random, it is believed that they follow a somewhat (yet to be understood) well defined structure in nature.

The Zeta Function is an infinite summation consisting of the following formula:

Z(s) = 1^-s + 2^-s + 3^-s + ...

It is defined over the set of complex numbers. Plotting the zeta function over the set of real numbers is an easy task but somewhat not a very interesting curve. Basically one way is to bound the zeta function to a certain M (won't make much of a difference since the tail elements of the Zeta function tend to zero very quickly). As you can see below, it comes down very quickly from an +infinite value of Y, approaching a limit of 1. Code is down below, cheers, ACC.

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

namespace BoundedZetaFunction
{
    internal class Program
    {
        static void Main(string[] args)
        {
            for (double s = -20.0; s <= 20.0; s += 0.1)
            {
                double val = BoundedZeta(s, 30);
                Console.WriteLine("{0};{1}", s, val);
            }
        }

        static double BoundedZeta(double s, int n)
        {
            double retVal = 0;

            for (int i = 1; i <= n; i++)
                retVal += Math.Pow(i, -s);

            return retVal;
        }
    }
}

Comments

Popular posts from this blog

Changing the root of a binary tree

ProjectEuler Problem 719 (some hints, but no spoilers)

The Power Sum, a recursive problem by HackerRank