Integrating a 2-dimensional function

I have the following class, which will integrate a 1-dimensional function and need to figure out how to change it to integrate a 2-dimensional function.


class fIntegrator : public VegasMC {

public:

fIntegrator(int Ndim, int NF = 0): VegasMC(Ndim), nf(NF){}

int nf;

double Integrand(DVector & X){
return f(X[1],nf);
}

};


Ndim is the dimension, and nf is the number to put into the function.

It seems like the only changes I'd have to make would be to set Ndim=2 and to change the "return" statement to something like:

return f(X[1][1],nf)

Is this even close to being right?
First please put your code in [cod e][/code ] tags. Second, are numerically or analytically integrating the function?
Topic archived. No new replies allowed.