MPI_PI
MPI_PI copied to clipboard
Calculate PI using MPI with 3 different methods
MPI_PI
Caculate PI using MPI with 3 differend methods
Author: KiwenLau
Method 1: using trapezoid rule
f(x)=(1-x^2)^0.5, so PI/4 is the integral of f(x) from 0 to 1. Then PI can be easily caculated using trapezoid rule.
Method 2: using trapezoid rule
f(x)=4/(1+x^2), so PI is the integral of f(x) from 0 to 1. Then PI can be easily caculated using trapezoid rule.