Featured Post

Step Wise Project Planning

Planning is the most difficult process in project management. The framework described is called the Stepwise method to help to distinguis...

To implement Numerical Integration using Simpsons Rule

To implement Numerical Integration using Simpsons Rule

#include<stdio.h>
#include<conio.h>
#include<math.h>

float y(float x)
{
return 1/(1+x*x);
}
void main()
{
float x0,xn,h,s;
int i,n;
clrscr();
puts("Enter x0,xn,no. of sub intervals");
scanf("%f%f%d",&x0,&xn,&n);
h=(xn-x0)/n;
s=y(x0)+y(xn)+4*y(x0+h);
for(i=3;i<=n-1;i+=2)
s+=4*y(x0+i*h)+2*y(x0+(i-1)*h);
printf("Value of integral is %6.4f  \n",(h/3)*s);
getch();
}


















Output



Simpson Rule




Previous
Next Post »