I would like to get the points and weights of Gaussian quadrature formulas for $$ \int_{-1}^{+1} x^2 f(x)\;\text{d}x. $$ Is this tabulated anywhere yet?
Gaussian quadrature with weight function x^2
1.9k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
It's possible to use the symmetry of the problem to relate analysis to known problems. Because the weight function and interval are symmetric about $x=0$, we know that the even-ordered orthogonal polynomials are even: $P_{2n}(x)=Q_n(x^2)$ and the odd-ordered polynomials are odd: $P_{2n+1}(x)=xR_n(x^2)$. Any even-ordered polynomial of the family is orthogonal to any even polynomial of lesser order, $g_{n-1}(x^2)$ where $g_{n-1}(y)$ is a polynomial of degree at most $n-1$. Then $$0=\int_{-1}^1x^2Q_n(x^2)g_{n-1}(x^2)dx=2\int_0^1x^2Q_n(x^2)g_{n-1}(x^2)dx =\int_0^1y^{1/2}Q_n(y)g_{n-1}(y)dy=2^{-3/2}\int_{-1}^1(u+1)^{1/2}Q_n\left(\frac{u+1}2\right)g_{n-1}\left(\frac{u+1}2\right)du$$ So $Q_n\left(\frac{u+1}2\right)$ is orthogonal to any polynomial of degree at most $n-1$ over the interval $(-1,1)$ with weight function $w(u)=(u+1)^{1/2}$ so it must be a multiple of the Jacobi polynomial $J_n^{0,1/2}(u)$. Backtracking, we get $P_{2n}(x)=P_n^{0,1/2}(2x^2-1)$.
Similarly, we see that $P_{2n+1}(x)=xP_n^{0,3/2}(2x^2-1).$ Looking back at the Wikipedia page on Gaussian quadrature, the only thing we need to get the weights are the normalization integrals. We can work out that $$\int_{-1}^1x^2\left[P_{2n}(x)\right]^2dx=2^{-3/2}\int_{-1}^1(u+1)^{1/2}\left[P_n^{0,1/2}(u)\right]^2du$$ and $$\int_{-1}^1x^2\left[P_{2n+1}(x)\right]^2dx=2^{-5/2}\int_{-1}^1(u+1)^{3/2}\left[P_n^{0,3/2}(u)\right]^2du$$ So we can leverage what we know about the Jacobi polynomials to derive the Gaussian quadrature formulas without having to start from scratch.
On
For anyone interested, I've written orthopy for the derivation of Gaussian rules with new weight functions. The main example in the readme gives the points and weights
[-0.978228658146056992803938001123,
-0.887062599768095299075157769304,
-0.730152005574049324093416252031,
-0.519096129206811815925725669458,
-0.269543155952344972331531985401,
0.269543155952344972331531985401,
0.519096129206811815925725669458,
0.730152005574049324093416252031,
0.887062599768095299075157769304,
0.978228658146056992803938001123]
[0.0532709947237135572432759986252,
0.0988166881454075626728761840589,
0.0993154007474139787312043384226,
0.0628365763465911675266984722740,
0.0190936733702070671592783399524,
0.0190936733702070671592783399524,
0.0628365763465911675266984722744,
0.0993154007474139787312043384225,
0.0988166881454075626728761840592,
0.0532709947237135572432759986251]
for the 10-point Gaussian rule with the integral weight $x^2$.
It is not too difficult to derive the coefficients from scratch. The general idea is outlined here.
Up to order 5, the result is:
n=3: $$\begin{array}{cc} x_i & w_i\\\hline 0 & \frac{8}{75}\\ \pm \sqrt{\frac{5}7} & \frac{7}{25} \end{array}$$
n=4: $$\begin{array}{cc} x_i & w_i\\\hline \pm\frac{1}{3} \sqrt{5-2 \sqrt{\frac{10}{7}}} & \frac{1}{300} \left(50-\sqrt{70}\right)\\ \pm\frac{1}{3} \sqrt{5+2 \sqrt{\frac{10}{7}}} & \frac{1}{300} \left(50+\sqrt{70}\right) \end{array}$$
n=5: $$\begin{array}{cc} x_i & w_i\\\hline 0 & \frac{128}{3675}\\ \pm\sqrt{\frac{1}{33} \left(21-2 \sqrt{14}\right)} & \frac{3 \left(258+\sqrt{14}\right)}{4900}\\ \pm\sqrt{\frac{1}{33} \left(21+2 \sqrt{14}\right)} & \frac{3 \left(258-\sqrt{14}\right)}{4900} \end{array}$$