comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Compute area between curves
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Compute area between curves [message #62934 is a reply to message #62821] Wed, 15 October 2008 05:05 Go to previous messageGo to previous message
jameskuyper is currently offline  jameskuyper
Messages: 79
Registered: October 2007
Member
James Kuyper wrote:
> 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 can be more specific about this. According to
<http://en.wikipedia.org/wiki/Newton%E2%80%93Cotes_formulas>, the error
terms are

trapezoidal (two-point) rule: -(h^3/12) *f2(zeta)
Boole's (five-point) rule: -(8*h^7/945)*f6(zeta)

where 'h' is the spacing of the data, f2(zeta) is the second derivative
of the function being integrated, evaluated at some unspecified location
in the range of integration, and f6(zeta) is the sixth derivative,
evaluated at some unspecified and probably different location in the
range of integration.

Therefore, if f2_max is the maximum value of the magnitude of the second
derivative over the range of integration, and f6_max is the same thing
for the sixth derivative, then it is better to use TSUM if

h > (315*f2_max/(32*f6_max))^0.25

if h is less than that limiting value, you'll get better results with
INT_TABULATED.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Contour Issues... Help please
Next Topic: IDL User Group Meeting Huge Success: Correction

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 09:45:33 PDT 2025

Total time taken to generate the page: 0.24108 seconds