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.
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.
Admiral
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.
Admiral
Quote:Original post by TheAdmiral
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.
I would be mostly after accuracy. The user enters in a function and I need to be able to integrate it.
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.
Admiral
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.
Admiral
Quote:Original post by HappyCoderQuote:Original post by TheAdmiral
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.
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.
Quote:Original post by TheAdmiral
Okay, 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 erissian
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.
Though thats not what I want exactly, It still could be a bonus.
[Edited by - HappyCoder on May 9, 2007 9:55:19 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement