March 11th, 2005, 8:52 pm
Maxi,I am not sure I understand your question, but I'll give you some advice anyway:The huge power of the quadrature is that the abscissas (x_i) and weights (w_i) are "independent" of the function you integrate (I used quotation because in fact they are dependent: Gauss-Legendre works for functions defined of a finite interval [a,b], Gauss-Hermite on (-infinity, +infinity) so on; but once you have established the class of functions to be integrated, the "independence" appears).SO, you produce abscissas and weights for the interval [a,b] ONCE, and compute the integral of ANY function (if it is in the right class, which we assume anyway) f as follows: sum_i^N f(x_i)*w_i. You see: x_i's and w_i's are frozen, while f can be changed. The number N of points is up to you (it does not have to be too big, but too small is not good either; about 100 will do it).Find "Numerical Recipes in C/C++" and find "gauleg" function in index. You can rewrite it yourself, you do not need pre-packaged things, and is good exercise and reading anyway.Take care