Thread: Integrals In C

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    46

    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. #2
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Thumbs up

    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. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Maths For Game Programming?
    By kolliash in forum Game Programming
    Replies: 13
    Last Post: 09-18-2008, 11:53 AM
  2. What are some good math reference/refresher sites.
    By indigo0086 in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 08-07-2006, 12:50 PM
  3. coding and mathematics of derivatives and integrals
    By musikluvah in forum C Programming
    Replies: 2
    Last Post: 01-30-2006, 02:42 AM
  4. wahoo I know all about the number e, it's totally sweet
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 08-18-2003, 07:17 PM