Numerica integration with unequal intervals

  • Context: Graduate 
  • Thread starter Thread starter cris
  • Start date Start date
  • Tags Tags
    Integration intervals
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
5 replies · 3K views
cris
Messages
3
Reaction score
0
Hello,

I have to compute the numerical integral of a function which is expressed at unequal (but almost) intervals. I tried the trapezoidal method, but the error is too large for my application. Is it possible to generalize the Boole's rule to or something on the same order of precision?
 
Physics news on Phys.org
You could try to generalize Simpson's rule. You need to fit quadratics to sequences of three points, with the third point of a sequence being the first point of the next. For each set of three calculate the integral of the quadratic as an estimate of the contribution to the integral.
 
Thanks for your reply. The generalized Simpson rule gives great improvement over the trapezoidal.
Though it appears I need something more ...
 
cris said:
Thanks for your reply. The generalized Simpson rule gives great improvement over the trapezoidal.
Though it appears I need something more ...
What are you looking for?
 
How do you know this is not good enough? What are you measuring against?
 
If it's possible, use MATLAB's numerical integration solver ode45 (or its brothers). It allows you to integrate arbitrary functions (the programmatic sense) very accurately, including exotic ones such as discontinuous or chaotic functions.

I don't get what you mean by 'only expressed at certain unequal intervals'. Does this mean you only know a few data points? Or that the value of the expression only changes every interval? Is it smooth? The best method of numerical integration greatly depends on the properties of the function itself.