2017-06-28, post № 173

C, mathematics, programming, #constant

Today it is June the 28th which means that it is 𝜏 day!
The irrational and transcendental constant 𝜏 is what defines \pi=\frac{\tau}{2}, which obviously makes it an important constant. To celebrate this day, I created a C program which calculates 𝜏 by randomly creating 𝟫-dimensional points inside the 𝟫-dimensional hypercube and testing if they are inside the 𝟫-dimensional hypersphere with its center located at (0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5) [1].

Today’s 𝜏 time is 3:18:53 as \tau=6.2831853\dots. As one does not know if the time is specified as ante or post meridiem, there are actually two perfectly acceptable 𝜏 times.

 )$$$m             $$$$$$$$                    
+$$c              q$$$$$$$>                    
$$                $$$$$$$$                     
           $$$$$$$$;             $$~           
           $$$$$$$$             $$$            
          '$$$$$$$$C          "$$$             
           $$$$$$$$$w       '$$$$              

The formula used for calculating 𝜏 is derived from a 𝟫-dimensional hypersphere’s hypervolume formula V=\frac{32\cdot\pi^4}{945}\cdot R^9 (see this Wikipedia article).

    V = \frac{2^5 \cdot \tau^4 \cdot R^9}{945 \cdot 2^4} = \frac{2 \cdot R^9}{945} \cdot \tau^4\\
    \tau^4 = \frac{V \cdot 945}{2 \cdot R^9}; R = 0.5\\
    \tau^4 = \frac{V \cdot 945 \cdot 2^9}{2}\\
    \tau = \sqrt[4]{V \cdot 241920}

The constant gets calculated to \tau^*=6.293700. The real value is approximately 𝜏 = 𝟨.𝟤𝟪𝟥𝟣𝟪𝟧…, which makes the percent error

\left|\frac{\tau^*-\tau}{\tau}\right|=\left|\frac{6.293700-6.283185}{6.283185}\right|=0.001673514 = 0.167\%.

Thereby, this C program’s approximation is not too far off. [2] The source code is listed below and can also be downloaded here. Instructions on how to compile it using GCC can be seen below or in the source code.

gcc tau.c -o tau -lm; ./tau
tau = 6.293700

Resources worth checking out regarding 𝜏 are The Tau Manifesto and 2 Pi or Not 2 Pi? I wish everybody a happy 𝜏 day.

Source code: tau-day-mmxvii.c


  1. [2020-07-30] More concisely, \frac 12\sum_je_j\in\mathbb{R}^9.
  2. [2020-07-30] Whatever that means …
Jonathan Frech's blog; built 2024/05/27 06:43:58 CEST