Q.Integration of 1/(1+x^2) within the limit (1,6) assuming h=1
#include<
float f(float a)
{
float b;
b=(1/(1+(a*a)));
return b;
}
int main()
{
int i,m=0,n=6;
float y[7],e=0.0,o=0.0,w,h=1.0;
for(i=m;i<=n;i++)
{
y[i]=f(i);
printf("x=%d,y[%d]=%f\n",i,i,y[i]);
}
for(i=1;i<=n-1;i=i+2)
{
o=o+y[i];
}
for(i=2;i<=n-1;i=i+2)
{
e=e+y[i];
}
printf("E=%f, O=%f",e,o);
w=((y[0]+y[n])+4*o+2*e)*(h/3);
printf("\nAns= %f\n",w);
return 0;
}
Nov 18, 2008
Simpson's 1/3 Rule
Posted by
bikash pradhan
at
1:09 AM
Subscribe to:
Post Comments (Atom)
Search
Programs
- backward difference formula c program code (1)
- Bisection Method c program code (1)
- Cramers rule (1)
- False position (1)
- Forward Difference Formula c program code (1)
- Gauss Seidal Method c program code (1)
- Guass Elimination Method c program code (1)
- Method of Successive Approximation c program code (1)
- Newton Raphson Method c program code (1)
- Newton's Backward Interpolation Formula c program code (1)
- Newton's Forward Interpolation Formula c program code (1)
- Regula Falsi on False Position Method c program code (1)
- Simpson's 1/3 Rule c program code (1)
- Simpson's Simpsons' 3/8 rule c program code (1)
- Trapezoidal Rule C program code (1)
0 comments:
Post a Comment