Tau Day MMXVIII

                                     int
        O=19,I=19;typedef long double f 
    ;long fac(long n){return n?n--*fac( 
  n):1;}f pow(f x,int p){return p--?x   
 *pow(x,p):1;}f sin(f x){f v=0;for      
(int           k=~0;++k                 
<=             O;)k%2&&                 
              (v+=(~-k                  
             %4?-1:1)*                  
             pow(x,k)                   
            /fac(k));                   
            return v                    
           ;}main()                     
           {f a=6,b                     
          =7, tau;                      
          for (int                      
         j=~0;++j                       
         <I;)sin(           tau         
        =a+(b-a)           /2           
        )>0? (b=          tau           
        ):(a=tau        )  ;            
        printf (      "%ca"             
        "u ~ %.*Lf",116,                
           O,tau);}                     

Try it online!

Happy tau day.

Tau Day MMXVII

Today it is June the 28th which means that it is \tau day!
The irrational and transcendental constant \tau 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 \tau by randomly creating 9-dimensional points inside the 9-dimensional hypercube and testing if they are inside the 9-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).

Today’s \tau 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 \tau times.

            ;b$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$b
        h$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 
     .$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ 
    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$  
  ,$$$$$$$$$kn}~I"`($$$$$$$x````````````````   
 )$$$m             $$$$$$$$                    
+$$c              q$$$$$$$>                    
$$                $$$$$$$$                     
                 $$$$$$$$.                     
                '$$$$$$$$                      
                $$$$$$$$                       
               ?$$$$$$$a                       
               $$$$$$$$                        
              Q$$$$$$$f                        
              $$$$$$$$                         
             $$$$$$$$i                         
             $$$$$$$$                          
            $$$$$$$$;                          
            $$$$$$$$                           
           J$$$$$$$w                           
           $$$$$$$$;             $$~           
           $$$$$$$$             $$$            
          '$$$$$$$$C          "$$$             
           $$$$$$$$$w       '$$$$              
           $$$$$$$$$$$$$$$$$$$$B               
            $$$$$$$$$$$$$$$$$$.                
             $$$$$$$$$$$$$$$'                  
                8$$$$$$$q                      

The formula used for calculating \tau is derived from a 9-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 \tau = 6.283185 \dots, 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. 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 \tau are The Tau Manifesto and 2 Pi or Not 2 Pi?. I wish everybody a happy \tau day.


// C Code
// Jonathan Frech, 27th of June 2017

Continue reading