math - double integration using rectangular method in C -
i know how can calculate double integral shown in picture below

i need calculate in c using rectangular method know how calculate integral not double 1 have calculated above integral in c integral(1/(1+x^2)) x 0 1 not understand how should proceed further
if can point me right direction on how should approach solution.
you can use definition of (cascading) riemann integral:
int n = 5000;//or large number, discretization step double dxy = 1.0d/n; double integral = 0.0d; for(int yi = 0; yi < n; yi++) { double y = yi*dxy; //the y-value for(int xi = 0; xi < n; xi++) { double x = xi*dxy; //the x-value integral += 1.0d/(1.0d+x*x+y*y); //function call } } return integral*dxy*dxy; in other words, calculate integral like:

Comments
Post a Comment