Talk:Gaussian quadrature

First Comment(s)
It seems like the J matrix may have Bn and An switched! — Preceding unsigned comment added by 171.64.221.179 (talk) 00:46, 1 November 2012 (UTC) We need an expert here please! the part of Computation of Gaussian quadrature rules is a mess. What is A, what is B? somebody needs to define these;  also, we define k as an index variable and instead of it we use i and so on. Wihenao Nov 1, 2009 —Preceding undated comment added 22:06, 1 November 2009 (UTC).

This page isn't linked from Quadrature, although that page does link to Numerical integration. I suspect a cleanup/merge is in order.

Also, somewhere should be mentioned quadrature over a simplex, which is useful for Finite element analysis. BenFrantzDale 04:37, Feb 17, 2005 (UTC)


 * I guess I'm not seeing what should be merged. Numerical integration is an overview of the topic, and mentions Gaussian quadrature in passing, along with several other techniques. Further detail is in the Gaussian quadrature article. This is as it should be, no? Wile E. Heresiarch 07:54, 18 Feb 2005 (UTC)

The formula (eq. 25.4.45 of Abramowitz and Stegun) referred to for Laguerre quadrature is incorrect. Or rather it is if the formulae for the Laguerre polynomial in chapter 22 of the same book are used. I suspect the authors of the two chapters have adopted different definitions of the Laguerre polynomials. GeordieMcBain 01:24, 9 March 2006 (UTC)


 * What printing of A&S? In the tenth printing, eqn 25.4.45 is marked with an asterisk, indicating a correction. And what is wrong about the formula? -- Jitse Niesen (talk) 09:32, 10 March 2006 (UTC)

When it says : ... "which make the computed integral exact for all polynomials of degree up to 2n − 1" ..., is it including or excluding all the polynomials of degree 2n-1 ?

132.69.230.37 15:58, 3 September 2007 (UTC)


 * Including. I think "up to" always means including. Anyway, I reformulated it to say "all polynomials of degree 2n − 1 or less", which is definitely clearer. -- Jitse Niesen (talk) 01:33, 4 September 2007 (UTC)

Divide by zero?
In the Gauss-Lobatto section, we have Weights: $$w_i = \frac{2}{n(n-1)[P_{n-1}(x_i)]^2} \quad (x_i \ne \pm 1)$$ What happens when $$x_i = 0$$, as it does once for every second legendre? --naught101 (talk) 01:57, 21 January 2011 (UTC)

Gauss-Legendre
I am no expert in this but is this also not known as gauss legendres method ? Poticecream (talk) 10:03, 28 October 2011 (UTC)
 * Yes, the case with $W(x) = 1$ given at Gaussian quadrature is often called Gauss-Legendre quadrature. Qwfp (talk) 12:43, 29 October 2011 (UTC)

n=5 quadrature wrong?
I think the abscissas for the n=5 quadrature rule are wrong. I implemented it in my code and it gave incorrect answers, so I checked on mathworld, and their abscissas are slightly different, http://mathworld.wolfram.com/Legendre-GaussQuadrature.html 128.83.68.153 (talk) 18:30, 27 July 2012 (UTC)

Error estimate wrong?
I can't quite believe the error estimate:


 * $$ \int_a^b \omega(x)\,f(x)\,dx - \sum_{i=1}^n w_i\,f(x_i)

= \frac{f^{(2n)}(\xi)}{(2n)!} \, (p_n,p_n) $$

The normalisation for the orthogonal polynomials is unspecified (monic, normalised, whatever, ...) thus the right hand side can have *any* dependence on $n$ here. Just take $\tilde p_n(x)=g(n) p_n(x)$, which also defines orthogonal polynomial for the given weighting function, and you get a factor of $g(n)^2$ in the estimate. (ezander) 89.182.48.90 (talk) 09:22, 9 July 2013 (UTC)
 * Ok. I checked it in Bulirsch-Stoer. Must be the monic polynomials. I'll edit the article accordingly. (ezander) 89.182.48.90 (talk) 09:56, 9 July 2013 (UTC)

where &omega; is a known function?
Known to whom? I would say, $f(x) = &omega;(x) &middot; g(x)$ always, where $&omega; = f$ and $g &equiv; 1$. I suppose it should mean one of the a priori supported functions; the text is unclear. Moreover, I suppose the preferred points of evaluation change as well. --Yecril (talk) 11:05, 14 January 2014 (UTC)

Example
This website rosettacode has a worked example in nearly 30 different programming languages.--Billymac00 (talk) 01:12, 22 March 2017 (UTC)

Picture
I think the example in the picture at the beginning might need some more explanation. It will, for instance not be clear to the reader, even with some experience, that the integral of the black dashed line just equals $$y(-w)+y(w)$$ with $$w = \scriptstyle{-\sqrt{1/3}}$$. Madyno (talk) 16:51, 15 January 2018 (UTC)

Alternative names
Can we add the alternative names to the first part of the title similar to here? (e.g. Gauss-Legendre quadrature, Legendre quadrature) The WP:LEDE and table of contents is a bit confusing: On first reading, I thought Gauss-Legendre quadrature was a special case of Gauss quadrature rather than an alternative name. --David Tornheim (talk) 02:11, 22 December 2018 (UTC)

Typesetting
I read about as much of MOS:FORMULA as I could before my eyes glazed over. When I tried to read the article, I found sections with inconsistent formatting for variable and functions quite distracting:


 * For the simplest integration problem stated above, i.e., f(x) is well-approximated by polynomials on $$[-1,1]$$, the associated orthogonal polynomials are Legendre polynomials, denoted by Pn(x). With the $n$-th polynomial normalized to give Pn(1) = 1, the $i$-th Gauss node, $x_{i}$, is the $i$-th root of $P_{n}$ and the weights are given by the formula

Because we have some things that are formatted with LaTex:
 * $$[-1,1]$$

or

and others that are similar that are simply italicized (and might use undefined ):
 * f(x)
 * Pn(x)

Other places in the article text I have seen [-1, 1] rather $$[-1,1]$$ or $$h(x)$$ rather than h(x). It's somewhat unclear what is preferred in a complex article like this one, but I suggest we keep it consistent, whichever we choose.

--David Tornheim (talk) 02:55, 22 December 2018 (UTC)


 * Hello. As required, here are some of my opinions.
 * Latex everywhere, i.e. $$...$$ everywhere. A same thing is to be uniformly typesetted across a whole article. In any case, this only requires a batch latex --> wiki, written once in a life.
 * Normalization. We have a large choice: monic polynomials ($$k_n$$=1), global weight ($$h_n$$=1), evaluation at some point, etc. (where $$k_n, h_n$$ are the A.S. notations). We have to live with this variability: each normalization is "the best one" in at least one situation. Moreover, we have to synchronize each set of orthogonal polynomials in order to obtain handy generating functions. The usual choices are:
 * $$ \exp \left( xz- \frac 1 2 \,{z}^{2}\right), \frac {1}{1+z}\,\exp \left( \frac {xz}{1+z} \right),   {\frac {1-xz}{1-2\,xz+{z}^{2}}},

\sqrt {\frac 1 { 1-2\,xz+{z}^{2} } } $$
 * so that all the normalization conventions are put aside.
 * There are situations where the $$n$$ roots of $$P_n$$ are to be considered as an ordered list of real numbers. And other situations where we better select a random root $$\xi$$, and use $$\left\{ x_{1},x_{2},\cdots,x_{n-1}\right\} $$ to denote the unordered set of the other roots.
 * And therefore, the best way of writing the theorem is:
 * $$w\left(\xi\right)=\dfrac{\left\Vert P_{n-1}\right\Vert ^{2}}{P'_{n}\left(\xi\right)P_{n-1}\left(\xi\right)}\times\frac{k_{n}}{k_{n-1}}$$ where $$k_n=k_{n-1}=1$$ when using monic polynomials.
 * Once again, this is only how I would write all these things !!!
 * Pldx1 (talk) 15:17, 22 December 2018 (UTC)
 * Thanks for the comments about typesetting, specifically, " $$...$$ everywhere". One question on that, which do you prefer:
 * (1) For the simplest integration problem stated above, i.e., $$f(x)$$ is well-approximated by polynomials on $$[-1,1]$$
 * or
 * (2) For the simplest integration problem stated above, i.e., $$f(x)$$ is well-approximated by polynomials on $$[-1,1]$$
 * I prefer the second, because the font size is closer to the main text, even though it is a bit cumbersome in code. What do you think? I have no opinion at this time about your ideas on normalization. --David Tornheim (talk) 06:21, 23 December 2018 (UTC)

LEDE -- confusing
I keep re-reading the lede and find it confusing, partly because of redundancies. Here is part of the WP:LEDE with my comments and questions as notes:


 * An n-point Gaussian quadrature rule, named after Carl Friedrich Gauss, is a quadrature rule constructed to yield an exact result for polynomials of degree $2n − 1$ or less by a suitable choice of the nodes $P_{n}$ and weights $x_{i}$ for $i = 1, ..., n$. The most common domain of integration for such a rule is taken as [−1,1], so the rule is stated as


 * $$\int_{-1}^1 f(x)\,dx \approx \sum_{i=1}^n w_i f(x_i),$$


 * which is exact for polynomials of degree $2n-1$ or less.   This exact rule is known as the Gauss-Legendre quadrature rule.    The quadrature rule   will only be an accurate approximation to the integral above if f(x) is well-approximated by a polynomial of degree $2n-1$ or less on $[-1,1]$.

Suggested re-writes
Here is a possible re-write (assuming Gauss-Legendre = Gauss quadrature):


 * An n-point Gaussian quadrature rule (also called the Gauss-Legendre quadrature rule), named after Carl Friedrich Gauss, is a quadrature rule that approximates the definite integral of a function, typically over the interval [-1,1], by a suitable choice of the nodes $w_{i}$ and weights $x_{i}$ for $i = 1, ..., n$:


 * $$\int_{-1}^1 f(x)\,dx \approx \sum_{i=1}^n w_i f(x_i)$$


 * If f(x) is a polynomial of degree $2n − 1$ or less, the result is exact. For other functions, the quadrature rule will only be an accurate approximation to the integral above if f(x) is well-approximated by a polynomial of degree $2n-1$ or less on $[-1,1]$.

Here is a possible re-write (assuming Gauss-Legendre quadrature is only for the exact case):


 * An n-point Gaussian quadrature rule, named after Carl Friedrich Gauss, is a quadrature rule that approximates the definite integral of a function, typically over the interval [-1,1], by a suitable choice of the nodes $w_{i}$ and weights $x_{i}$ for $i = 1, ..., n$:


 * $$\int_{-1}^1 f(x)\,dx \approx \sum_{i=1}^n w_i f(x_i)$$


 * If f(x) is a polynomial of degree $2n − 1$ or less, the result will be exact. For these polynomials, the process is called the Gauss-Legendre quadrature rule.  For other functions, the quadrature rule will only be an accurate approximation to the integral above if f(x) is well-approximated by a polynomial of degree $2n-1$ or less on $[-1,1]$.

--David Tornheim (talk) 04:00, 22 December 2018 (UTC)


 * In my opinion, version 1 is better... because it avoids the naming quarrel. In the lede, on can add that
 * This can be generalized in various contexts, to take into account infinite intervals or various kind of singularities by incorporating them into a so called weight function. This leads to Chebyshev–Gauss, Gauss-Jacobi, Gauss-Laguerre and Gauss–Hermite quadrature formulas to name the most known of them (see below).
 * and expel everything else in the body of the article.
 * This would make the room required to underline that $$n$$ points and $$n$$ weights are $$2n$$ degrees of freedom... exactly what is required to face the freedom provided by chosing at random a polynomial whose degree is at most $$2n-1$$.
 * Best regards. Pldx1 (talk) 15:53, 22 December 2018 (UTC)
 * Thanks for your comments here and above. I'll get to some of of those changes soon.  So I assume when you same "version 1" you mean that you are okay with the my first revision (rather than the original), right?  --David Tornheim (talk) 06:14, 23 December 2018 (UTC)

Obtaining the weights
Once the existence of the $$x_i,\,w_i$$ families is proven, the $$w(\xi)$$ are easily obtained from the special case $$Q\left(z\right)=P_{n-1}\left(z\right)\,\prod_{j=1}^{n-1}\left(z-x_{i}\right)$$. This dramatically reduces the length of the proof. Pldx1 (talk) 10:04, 23 December 2018 (UTC)

Split Gauss-Legendre quadrature page
Gauss-Legendre quadrature deserves a separate page from the general Gaussian quadrature page. The other cases of Gaussian quadrature rules listed on the general each have their own pages. The sections on Gauss-Legendre in the general Gaussian quadrature page do not detail the state-of-the-art algorithms, which are orders of magnitude more efficient than the Golub-Welsch algorithm and allow for computation of much larger quadrature rules. There has been much work in this area. We have an applied functional analysis class of students that plan to contribute the rest of the content to the Gauss-Legendre quadrature page. Cpt49 (talk) 17:35, 10 February 2020 (UTC)

Convergence rate
The article really needs some information on the convergence rate — which is *exponential* for functions that are analytic in a neighborhood of the integration domain. Trefethen's review article is a good starting place. — Steven G. Johnson (talk) 14:04, 20 June 2023 (UTC)