Simpson’s 3/8 rule or Second rule is completely based on the cubic interpolation rather than the quadratic interpolation. Simpson’s 3/8 or three-eight rule is given by:
∫ab f(x) dx = 3h/8[(y0+yn)+3(y1+y2+y4+y5+….+yn-1)+2(y3+y6+y9+…..+yn-3)]
This rule is more accurate than the standard method(Simpson first rule or 1/3 rule), as it uses one more functional value. For 3/8 rule, the composite Simpson’s 3/8 rule also exists which is similar to the generalized form.
- With GCC installed on your machine:
gcc -o simpsonsecondrule main.c tinyexpr.c
to run it:
./simpsonsecondrule
- With docker
docker build -t simpson-second-rule-app .
docker run -it --rm --name simpson-second-rule simpson-second-rule-app