Archive for January, 2009


January 21, 2009



A simple program to computing Pi using the Monte Carlo method:


#include “stdlib.h”

#include “stdio.h”

#include “time.h”

int isinside(int , int);

int main()



        double pi;

        int x,y;

        int i=0;

        int inside=0;

        int n=10000;









        printf(“pi = %lf\n”,inside*4.0/n);


int isinside(int x,int y)






        if((x==5 && y==0) || (x==4 && y<4) || (x==3 && y<5) || (x==2 && y<5) || (x==1 && y<5) || x==0 )

                return 1;


                return 0;


bramani@chassis01:/home/bramani/toyprojs> cc pi.c

bramani@chassis01:/home/bramani/toyprojs> a.out


pi = 2.664800 [oops]

bramani@chassis01:/home/bramani/toyprojs> a.out


pi = 2.724800 [aiyo]


These pi values are for r=5.

As r increases pi tends to 3.14. 



I loved this experiment and thought of sharing.
Inspired by Fooled by randomness ~ Nassim Nicholas Taleb.

I am. No, I am Not.

January 7, 2009

There was Schrodinger. There was no Schrodinger.


January 3, 2009

Was dabbling with python this lazy saturday afternoon.

Surprise.  I could write and run useful programs in no time at all.

I am Impressed.  This is very true.



A to Z

January 2, 2009

A to Z.