Search code examples
xmgrace

What numerical integration technique is used for integration of data sets performed in xmgrace?


From the information on topic - Integration of xmgrace,

... the item marked cumulative sum will construct a set composed of the current value of the integral at a given X. Sum only reports just the value on the next line. ...

I couldn't find information on the integration technique (Trapezoidal rule, Simpson's method ...) which thus motivates the question,

What numerical integration technique does xmgrace use to integrate the data sets chosen?


Solution

  • After downloading the latest xmgrace (a.k.a. Grace) source code I first searched through all files for the word "integration". I found a number of methods used for numerical integration. They all lead me to a function called trapint(), which is helpfully commented as shown:

    /*
     * trapezoidal rule
     */
    

    It can be found in the file computils.c for anyone who wishes to investigate further.

    Secondly, when I searched for "Simpson" I did not find anything.

    According to this page, even MatLab does not have a built-in implementation of Simpson's method (I don't know how recent that page is, but I believe this is still true and couldn't find any other evidence of such a method). Therefore, I would not expect xmgrace to have one either, since it is a much smaller program with only a few contributors.

    Also, if Simpson's method had been implemented in xmgrace in addition to the Trapezoidal rule method, there would surely be an option in the Transformations > Integration menu, so that users could choose which method they wanted.

    All this evidence strongly suggests to me that xmgrace uses just the Trapezoidal rule for numerical integration. I hope this answer satisfies you.