// A program to test the expression in SliverPot typedef double R; #include #include R sq(R t){return t*t;} // const R x = 0, y = 0.5; void m(R x, R y){ R s = 0; const int z = 1000000; for(R r = 0.5/z; r<1; r += 1./z) { s += r*r/sqrt(sq(x-r) + sq(y));} printf("%8.3f %8.3f %14.11f\n", x, y, s/z);} int main(){m(0, 0.5); m(0, 0); m(0.43, 1.29); m(-0.46, 0.61); m(1.2, 1.3); m(0.43, 0.61); return 0;} // x y val Scheme // 0 1/2 0.37856255998 0.37856255997759614 // 0 0 0.50000000000 0.4999999999... // 0.43 1.29 0.24846960745 0.24846960745205882 // -0.46 0.61 0.24978622877 0.249786228774684 // 1.2 1.3 0.24089488892 0.24089488892210287 // 0.43 0.61 0.47282696270 0.47282696269790586