This is a simple script which produces the Legendre-Gauss weights and nodes for computing the definite integral of a continuous function on some interval [a,b]. Users are encouraged to improve and redistribute this script. See also the script Chebyshev-Gauss-Lobatto quadrature (File ID 4461).
How did you choose the initial guess for y?
DUDE I LOVE YOU.
It works perfectly for my computation. Thanks you.
I've implemented similar function, but it's twice as fast. I've compared the results with yours and the relative error was less then 1e-12%, numerical error basically.
Fill free to submit Pull request if you have something to add.
Thank you Greg
Thanks!!! Its really help me!
excellent, thanks a lot
a code with great accuracy and speed! Well done!
very good, thanks
very handy, thanks!!
This is a very useful script. Thanks for sharing. I noticed that you are storing a lot of memory for items you don't need. As an example you never use the full Lp, set to zeros(N1,N2). Only the highest order is needed. If I comment out all but the last occurrence of Lp the script generates the same results. You could do the same for L(N1,N2) since you only need 3 values of k at any step in the calculation. Just a thought.
Very Good, thanks.
Brilliant piece of code! I have been using this quite a lot without trouble. I'm always amazed that how quickly Gaussian quadrature converges.
Thank you very much. The results are good and there are no problems with the accuracy of the approach nor are there any issues with normalization as some people above suggested. I have checked the integration for a wide range of reasonable functions and the numbers check out just right. Thanks!
very handy tool! thanks!
Excellent! Thanks for sharing. Do you have a reference for your algorithm?
Neat program. Well done!
Works pretty well - thanx
I would like Tabulated Gauss points
works well in emag apps for tough integrands, fast and simple function
My QUADG function in the quadrature category contains a subfunction called "gausslegendre" that does an equivalent computation using EIG; it can be used as a separate function if desired.
I don't know about the accuracy of your approach, but if I remember correctly the algorithm I had used is considered quite accurate. It's also very fast.
Very nice quadrature routine!.
Very handy tool, which for some reason is missing in matlab, like the zeros of the bessel functions.
I did notice the weights are not normalized to 1 however, which seemed to result in an over estimation of the integral.
Good work and thank you
Found a bug in scaling of weights. Also slight improvement to speed.