Re: Compute area between curves [message #62935 is a reply to message #62821] |
Wed, 15 October 2008 04:44   |
jameskuyper
Messages: 79 Registered: October 2007
|
Member |
|
|
mystea wrote:
> On Oct 14, 4:26 am, James Kuyper <jameskuy...@verizon.net> wrote:
...
>> Could you give a simple example that demonstrates the problem you've seen?
>
> I tried "tsum" and suddenly every problem was solved!
I assume you're referring to
<http://idlastro.gsfc.nasa.gov/ftp/pro/math/tsum.pro>. tsum uses the
trapezoidal rule, which is the two-point Newton-Cotes formula;
INT_TABULATED uses the five-point formula. The higher-order formula
gives you more accurate results, so long as the data is tabulated at
sufficiently close intervals so that is it relatively smooth over any 5
consecutive data points. The lower order formula gives less accurate
results, but is more robust with respect to the errors that can be
created when the tabulated function isn't tabulated sufficiently
closely. This is the typical trade-off you get when comparing
higher-order numerical methods with lower-order ones.
> I found that the warning in the int_tabulated help file must be taken
> very seriously:
>
> Warning:
> Data that is highly oscillatory requires a sufficient number of
> samples for an accurate integral approximation.
>
> My data was not oscillatory. However, I tried to find its first
> derivative using "deriv" and
> found that its first derivatives are oscillatory.
>
> So the motto is: thou shalt not use int_tabulated when the result
> from deriv is oscillatory. huh?
I think that's the wrong conclusion. It's not that int_tabulated
shouldn't be used; it's that the data that was causing int_tabulated
problems shouldn't be used. If possible, you should get the data
tabulated more closely. If not, you should understand that any method
you use will give inaccurate results, though those results will be more
reasonable when you use a lower-order integration method rather than a
higher-order one.
I'd still like to see specific examples of data for which int_tabulated
has problems of this kind.
|
|
|