\CPP
Definite_Integration.c
From: Craig Schroeder [schroeder@santel.net] Sent: Thursday, December 23, 1999 01:59 To: JoshS@santsys.com Subject: Definite Integration. /* This program performs definite integration. It integrates a given function, f(x), on the interval [a,b]. N can be set as a variable to control precision. The algorithm in use is Simpson's Rule, and it is VERY fast. */ #include#include double f(double x) {return cos(x)+sin(x);} // function to integrate. double I(double (*f)(double), double a, double b, unsigned long N) { double w=(b-a)/N, s=0, k=a; for(unsigned long i=0; i