I have two very connected questions:
Is there really no built-in function to integrate a list of pairs without converting to a function? Something like:
NIntegrate[{{x1, y1}, ..., {xn, yn}}]
I am aware of Interpolation, but do not want to use it.
If there is no built-in function, is there a possibility to improve my following function (I stole the important part from here)?
rangeSelect[table_, range_] :=
Select[table, range[[1]] <= #[[1]] <= range[[2]] &]
trapezoidIntegration[list_, range_] :=
Differences[#1].MovingAverage[#2, 2] & @@ Transpose[rangeSelect[list, range]]
=======1. Edit
I think I have to clarify what I intended with defining rangeSelect[matrix,{a,b}] This function should slice out all those rows from the 2D array "matrix" in the form of {{x1,y1},...,{xn,yn}} where the x value is larger than a and smaller than b.
=======2. Edit
My function introduces errors at the beginning and end of the integration interval. Since my data is automatically sampled hence has a lot of points this is not so important for me. This is also the reason, why I did not think about non integrable 1 element lists. For the same data as in m_goldberg's answer but with n=10^4 trapezoidIntegrationand Integrate[Interpolation[...]] give the same result.
InterpolationOrder. – J. M.'s missing motivation Oct 09 '15 at 18:30rangeSelect? – Michael E2 Oct 09 '15 at 22:44