MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / integrate

Function integrate

code/mathematics/numeric_integration.cpp:1–7  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1double integrate(double (*f)(double), double a, double b,
2 double delta = 1e-6) {
3 if (abs(a - b) < delta)
4 return (b-a)/8 *
5 (f(a) + 3*f((2*a+b)/3) + 3*f((a+2*b)/3) + f(b));
6 return integrate(f, a,
7 (a+b)/2, delta) + integrate(f, (a+b)/2, b, delta); }
8// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 1

fFunction · 0.85

Tested by

no test coverage detected