17.11.2012 Views

Numerical recipes

Numerical recipes

Numerical recipes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7.6 Simple Monte Carlo Integration 307<br />

#include "nrutil.h"<br />

...<br />

n=... Set to the number of sample points desired.<br />

den=... Set to the constant value of the density.<br />

sw=swx=swy=swz=0.0; Zero the various sums to be accumulated.<br />

varw=varx=vary=varz=0.0;<br />

vol=3.0*7.0*2.0; Volume of the sampled region.<br />

for(j=1;j

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

Saved successfully!

Ooh no, something went wrong!