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.1)<br />

class <strong>Integration</strong> {<br />

private:<br />

double x0, xn; // limits of integration<br />

double (*f)(double x); //function to be integrated<br />

public:<br />

<strong>Integration</strong>(double (*F)(double x), double a,<br />

double b) {<br />

f=F;<br />

x0=a;<br />

xn=b;}<br />

double Trapezoidal(int n);<br />

double Simpsons13(int n);<br />

};<br />

© 2003-2006 Roberto Muscedere 28

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

Saved successfully!

Ooh no, something went wrong!