#include #include // Parameter constants for integration #define A 0.0 // Lower bound of integration interval #define B 1.0 // Upper bound of integration interval #define N 10 // Number of small intervals (larger = finer = more accurate) // The function to be integrated: f(x) = cos(x) double f(double x) { return cos(x); } int main(void) { // -------------------------------------------------- // Numerical integration using Simpson's Rule // -------------------------------------------------- double delta = (B - A) / N; // Width of a small interval (Delta x) double value = 0.0; // Result of integration (total area) int i; for(i=0; i