Rectangular vs Trapezoidal integration

I have asked more than one question in less than 10 days, I apologize for that.

Attached is a simple experiment, with a spectral wave (specifically, the "second spectrum"), and a frequency wave.

I am trying to integrate the spectrum over a specified range of values. For now, consider it to be the whole range. The rectangular integration

assumes a uniform dx, while the trapezoidal one takes the x wave as well as y wave. In this case, I assume (since my freq is not uniformly spaced) that

only the trapezoidal integration will be accurate. Is this correct? I have a feeling that neither is accurate...
test_1.pxp (133.21 KB)
Your question seems more about principles of numerical integration than practical application with Igor Pro. As such, consider these references ...

https://www.khanacademy.org/math/integral-calculus/indefinite-definite-…

http://demonstrations.wolfram.com/NumericalIntegrationUsingRectanglesTh…

http://math.stackexchange.com/questions/603830/why-does-trapezoidal-rul…

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
In Igor, integration usually requires an X wave that has an extra point. The X values define the edges of the rectangles or trapezoids, and to define the right edge of the last rectangle or trapezoid, it needs an extra X value.

Your X values appear to be uniformly spaced with deltaX=0.00195. You can get around the problem with the X wave by using wave scaling to set the X values. When you do that, Igor can calculate any X values it needs.

In most cases trapezoidal integration gives a result more nearly like what you would get by a true integration, assuming an underlying smooth function. That's because the lines that connect one Y value with the next will usually be a better approximation of a smooth function than a box. But note that I say "smooth".

And yes, either one is just a numerical approximation if the data represent some underlying function that can be evaluated at all values of X. Your data appears to be quite noisy. I would guess that the noise will cause greater inaccuracy than the numerical integration.

I highly recommend learning more about numerical integration. It seems that JJWeimer's reading list would be an excellent start.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com