# Integrals In C

This is a discussion on Integrals In C within the C Programming forums, part of the General Programming Boards category; This is posted more for discussion than anything else. Anyone who's taken calculus know's what an integral is. They're the ...

1. ## Integrals In C

This is posted more for discussion than anything else.

Anyone who's taken calculus know's what an integral is. They're the area under a curve governed by a function f(x) from a to b. What I'm wondering is, how does one program integrals in C/C++? Being that a computer can't antidifferentiate like a human can, how would you tackle the problem?

What I'm thinking right now is it would be easy to simply use a Rhemann sum, and apply Simpson's rule.... But then we run into the issue of approximations...

Any thoughts people?

2. As far as my memory goes, I used the Simpsons 1/3rd rule and solved it also using Newton-Ralphson method and Gauss formulas... I remeber using a limit variable for the number of iterations.

3. >But then we run into the issue of approximations...

That's right. Remember that differentiation and integration are continuus operations, you work with infinite small elements. Since the computer can't work with the term infinite, you'll always have approximations. A computer simply can't work with infinite small numbers or calclulate integrals or even series which run from for example zero to infinity. So numerical methods are always approximations of the continuus reality. There are many methods to compute integrals, you'll find a lot with Google when searching for "numerical methods" and especially integrating.