Re: replace integration by summation [message #84909 is a reply to message #84906] |
Tue, 18 June 2013 09:04   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Tuesday, June 18, 2013 10:13:38 AM UTC-4, fd_...@mail.com wrote:
> Oh, I see. I had check it and your guess is right. There is any other function that I can use instead of INT_TABULATED?
To build on what Helder said, INT_TABULATED() and TOTAL() are approximations based on assumptions about the data.
Your TOTAL() method is basically equivalent to the Trapezoid rule, which assumes that your function can be approximated as piecewise linear.
Also, by using (t[1]-t[0]) you are also assuming that your points are exactly regularly spaced. Is that a correct assumption?
INT_TABULATED uses a fifth order Newton-Cotes method, so it basically assumes the tabulated function is a smooth fifth-order polynomial (I think).
If these assumptions are wrong, then you won't get the answer you want. But only you know which assumption is appropriate. You don't really say what is "wrong" about the results you got, so it's hard to judge.
There are other functions like QTRAP, QSIMP, QROMB (and my own QPINT1D), but these methods require you to express your function not as a table, but as an IDL function that can be evaluated at any point. These more advanced functions can be more accurate because they can concentrate on the parts of the function where the integration error is greatest and reduce the error.
IDL doesn't have any other built-in subroutines for integration of tabulated values.
Craig Markwardt
|
|
|