#include #include // Parameter constants for integration const double A = 0.0; // Lower bound of integration interval const double B = 1.0; // Upper bound of integration interval const int 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() { // -------------------------------------------------- // Numerical integration using Simpson's Rule // -------------------------------------------------- const double delta = (B - A) / N; // Width of a small interval (Delta x) double value = 0.0; // Result of integration (total area) for(int i=0; i