Authored by Lee Chao Yuan <charles620016@gmail.com>
doublecomputePi_v1(size_tN)
{
doublepi=0.0;
doubledt=1.0 / N; // dt = (b-a)/N, b = 1, a = 0for (size_ti=0; i<N; i++) {
doublex= (double) i / N; // x = ti = a+(b-a)*i/N = i/Npi+=dt / (1.0+x*x); // integrate 1/(1+x^2), i = 0....N
}
returnpi*4.0;
}


