Question:
Can anybody tell me how to use gauss-legendre quadrature for discrete set of data?
Suppose if I have (x_i,y_i), i=1,....n , 'n' pair of points, where x coordinates are unequally spaced. With these data sets I need to perform Gauss legendre integration. I studied in the books that gauss quadratures can be used for smooth functions, here my case is discrete. I don't know how to proceed.
Answear:
First interpolate for these points and find the values at the nodes of Gauss-Legendre formula and find the numerical integral.
Please convert the interval of the integral into (-1,1) and find the values of given interpolated function at the nodes which are transferred to original range of data.
Then divide the interval [x0, xn] into smaller sub intervals [x0,xk], [xk, xk+1],...and so on. Now apply above procedure to each sub interval to find the corresponding integrals. Add all these integrals to find required integral.