I want to wirte aprogram in c for integration of a mathematical function plz help
Topics

Integration of a function is summation of the finite elements of the same function. In numerical analysis there are many ways to do it such as : Simpson's Rule, Trapezoidal Rule 1/3 and 3/8 etc etc. depending upon the function and error minimization
So all u need to do is to run a *for* loop from a to b and divide it into a good number of pieces to get good results else there would be large errors(smaller the increment, better the results , though it affects ur computational time) and define the finite element function of the mathematical function.
Your starting point > http://en.wikipedia.org/wiki/Numerical_integration
Rest all is a 10 min job
Cheers !! 
Composite Simpson's Rule
To approximate the integral I = J: f(x) dx:
INPUT endpoints a, b; even positive integer n.
OUTPUT approximation X I to I.
Step 1 Set h = (b  a)/n.
Step 2 Set XI 0 = f(a) + feb);
XI 1 = 0; (Summation of f(x2i1).)
X I2 = O. (Summation of f (X2i)')
Step 3 For i = 1, ... ,n  1 do Steps 4 and 5.
Step 4 Set X = a + ih.
Step 5 If i is even then set XI2 = X/2 + f(X)
else set XIl = XIl + f(X).
Step 6 Set XI = h(XIO + 2· XI2 + 4· XIl)/3.
Step 7 OUTPUT (Xl);
STOP. 
Look for" Numerical recipes in c the art of scientific computing" its good book for all kind of mathematical computation ,I used only that its very good !!
Thanks 
you should absolutely take a look at http://www.gnu.org/software/gsl/
it's an open scientific C library
 Views 6036
 Followers 8
 Answers 4
All Answers (4)