h = (b-a)/n; s =f(a); s += f(b); s = s/2.0; for (var i=1; i<=n-1; i++) { s += f(a+i*h); } s = s*h;n =
-
h = (b-a)/n; s = f(a); s += 4.0*f(a+h); s += f(b)); for (var i=2; i<=n-2; i+=2) { s += 2.0*f(a + i*h); s += 4.0*f(a + (i+1)*h); } s = s*h/3.0;n =
-