# FINT

## Recommended Posts

does anybody know of a realible and fast way of calculating a definate integral? It also needs to take into account abs(). the abs really messes things up.

##### Share on other sites
Numerically or analytically?

Analytic evaluation of an expression containing moduli is often, but not always, possible by separating the integrand into terms with known sign. After doing this, all the moduli may be ironed out.

Numerical integration, on the other hand, has no problems with such badly-behaved operators. A common term for definite numerical integration is 'quadrature' - people spend their lives researching this. The general problem is balancing accuracy, speed and simplicity.

Tell us which you're after, where the data came from and what resources you have at your disposal and we'll try to suggest a good approach.

##### Share on other sites
Numerical Recipes in C (Free e-Book)
-> Chapter 4: "Integration of Functions".

##### Share on other sites
Quote:
 Original post by TheAdmiralThe general problem is balancing accuracy, speed and simplicity.Tell us which you're after, where the data came from and what resources you have at your disposal and we'll try to suggest a good approach.

I would be mostly after accuracy. The user enters in a function and I need to be able to integrate it.

##### Share on other sites
Okay, that's half an answer. I'll assume that you want to integrate numerically.

Perhaps the best all-round method out there is to use Romberg's method (a generalisation of Simpson's Rule) on abscissas derived and adapted from the Chebyshev Roots. This is probably overkill for your needs. If you need a one-off calculation of a reasonably tame curve, you'll probably get away with applying the Trapezium Rule on a mesh of paranoidly high resolution. All such situations will take good care of your absolute function.

Then again, you could just ask Maple or Matlab to do it for you. Again, tell us more.

##### Share on other sites
Quote:
Original post by HappyCoder
Quote:
 Original post by TheAdmiralThe general problem is balancing accuracy, speed and simplicity.Tell us which you're after, where the data came from and what resources you have at your disposal and we'll try to suggest a good approach.

I would be mostly after accuracy. The user enters in a function and I need to be able to integrate it.

No, I think what he wants is to take the user input of "x2</sup + sin(2x)" and generate the output of "[2x + 2cos(2x)]dx" and so on.

##### Share on other sites
Quote:
 Original post by TheAdmiralOkay, that's half an answer. I'll assume that you want to integrate numerically.

Sorry, I'm not being clear. I do want it numerically.

Quote:
 Original post by erissianNo, I think what he wants is to take the user input of "x2

Though thats not what I want exactly, It still could be a bonus.

[Edited by - HappyCoder on May 9, 2007 9:55:19 PM]

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628367
• Total Posts
2982284

• 10
• 9
• 13
• 24
• 11