Processing math: 100%

 

 

 

Dissection of trapezoidal rule

We use MPI_reduce to collect data from each process. Note also the use of the function MPI_Wtime.

//  this function defines the function to integrate
double int_function(double x)
{
  double value = 4./(1.+x*x);
  return value;
} // end of function to evaluate