Skip to main content

Posts

Showing posts with the label trapezoidal rule

trapezoidal rule

///Bismillahir Rahmanir Rahim ///Tanvir Ahmmad ///Dept.CSE,IU,Bangladesh #include<iostream> using namespace std; int main() {     double up,low,h,arr_y[1009],sum=0;     cout<<"Given function f(x)=1/(1+X)"<<endl<<"Given the upper limit of integration : ";     cin>>up;     cout<<"Given the lower limit of integration : ";     cin>>low;     cout<<"Given the value of h : ";     cin>>h;     int n=(up-low)/h;     cout<<"So the value of n = "<<n<<endl;     for(int i=0; i<=n; i++)     {         arr_y[i]=(1.0/(1.0+(i*h)));         if(i==0) cout<<"X=X0        Y["<<i<<"]="<<arr_y[i]<<endl;         else cout<<"X=X0+"<<i<<"h"<<"     Y["<<i<<"]="<<arr_y[i]...