Numerical Integration

Numerical Integration Numerical Integration

files.vlsi.uwindsor.ca
from files.vlsi.uwindsor.ca More from this publisher
22.04.2015 Views

Simpson’s 1/3 Code (p.1) class Integration { private: double x0, xn; // limits of integration double (*f)(double x); //function to be integrated public: Integration(double (*F)(double x), double a, double b) { f=F; x0=a; xn=b;} double Trapezoidal(int n); double Simpsons13(int n); }; © 2003-2006 Roberto Muscedere 28

Simpson’s 1/3 Code (p.2) double Integration::Trapezoidal(int n) { double h=(xn-x0)/n; double sum=0.0; double x=x0; double I; for(int i=1; i

Simpson’s 1/3 Code (p.2)<br />

double <strong>Integration</strong>::Trapezoidal(int n)<br />

{<br />

double h=(xn-x0)/n;<br />

double sum=0.0;<br />

double x=x0;<br />

double I;<br />

for(int i=1; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!