Find the weight coefficients in the Gaussian type quadrature formula

numerical methods

I am trying to determine the node values in the Gaussian type quadrature formula given by:

enter image description here

I need to find the weight coefficients for the Gaussian quadrature when the weight function is $ w(x) =\frac {1}{\sqrt{1-x^2}} $


In order to do so, I use the Gram-Schmidt process on the standard polynomial basis to get a second degree orthogoanl polynomial. The roots of this polynomial are the nodes.

I get -0.877 and -0.242 as the nodes which are within the integral range of -1 to 0.

How can I proceed from here to find the wieght coefficients?

Searching online I found this formula from Atkinson's 'An Introduction to Numerical Analysis'

enter image description here

During the calculation here, obne of the weight coefficients returns negative, which is impossible. I am therefore confused as to what I am doing wrong and if this is the right way to proceed. Any suggestoins are appreciated.

Best Answer

It's kind of amusing that this problem is copied from this question only the upper bound of the summation has been changed by hand, forgetting to change the subscript on $R_3(f)$. Did you complain to your instructor for not having properly composed his problem in MathJax? In my answer I worked out a table of moments $$M_k=\int_{-1}^0\frac{x^k}{\sqrt{1-x^2}}dx$$ $$\begin{array}{c|c}k&M_k\\ \hline 0&\frac{\pi}2\\ 1&-1\\ 2&\frac{\pi}4\\ 3&-\frac23\\ 4&\frac{3\pi}{16}\\ 5&-\frac8{15}\end{array}$$ We need a polynomial $\varphi_2(x)=x^2+ux+v$ orthogonal to $x^k$ for $k\in\{0,1\}$. These leads to the $2$ equations in $2$ unknowns $$\begin{array}{rrr}-u&\frac{\pi}2v&=-\frac{\pi}4\\ \frac{\pi}4u&-v&=\frac23\end{array}$$ With solutions $$\begin{align}u&=\frac{2\pi}{3\pi^2-24}\\ v&=\frac{32-3\pi^2}{6\pi^2-48}\end{align}$$ Numerically, $$\begin{align}u&=1.12023436678521858941728667302911065\\ v&=0.213163347581147484467276859105524958\end{align}$$ We can solve via the quadratic formula to get $$\begin{align}x_1&=-0.877241625135156835342909006193109829\\ x_2&=-0.242992741650061754074377666836000821\end{align}$$ Now, in my previous answer I applied the formula to $x^k$ for $k\in\{0,1\}$ to get $$\begin{array}{rrr}A_1&+A_2&=\frac{\pi}2\\ x_1A_1&+x_2A_2&=-1\end{array}$$ With solutions $$\begin{align}A_1&=0.974866349911031438041049989239156851\\ A_2&=0.595929976883865181190271702400594548\end{align}$$ And we could check that the integration formula was exact for $f(x)=x^k$ for $k\in\{0,1,2,3\}$.

So now we want to apply formula $5.3.11$ from Atkinson p. 272. We will need $a_2=\frac{A_3}{A_2}$ which is $1$ because we are using monic polynomials. Then we need $$\begin{align}\gamma_2&=\int_{-1}^0\frac{\left(\varphi_2(x)\right)^2}{\sqrt{1-x^2}}dx\\ &=\int_{-1}^0\frac{x^4+2ux^3+(u^2+2v)x^2+2uvx+v^2}{\sqrt{1-x^2}}dx\\ &=M_4+2uM_3+(u^2+2v)M_2+2uvM_1+v^2M_0\\ &=0.00964381305182564583436743261678388874\end{align}$$ Fortunately in my previous answer I worked out $$\varphi_3(x)=x^3+ax^2+bx+c$$ Where $$\begin{align}a&=\frac{2\left(256-27\pi^2\right)}{5\pi\left(88-9\pi^2\right)}\\ b&=-\frac{3\left(-448+45\pi^2\right)}{20\left(-88+9\pi^2\right)}\\ c&=-\frac{2048-207\pi^2}{30\pi\left(88-9\pi^2\right)}\end{align}$$ Numerically, $$\begin{align}a&=1.61447769167994311356947744905749821\\ b&=0.702011720837368702218533133421594847\\ c&=0.0640888776572757287520840004030105744\end{align}$$ So now we can apply the formula from Atkinson $$A_k=\frac{-a_2\gamma_2}{\varphi_2^{\prime}(x_k)\varphi_3(x+k)}$$ To get $$\begin{align}A_1&=0.974866349911031438041049989239165999\\ A_2&=0.595929976883865181190271702400598399\end{align}$$ Wikipedia seems to have a nicer formula $$A_k=\frac{a_{n-1}\gamma_{n-1}}{\varphi_n^{\prime}(x_k)\varphi_{n-1}(x_k)}=\frac{a_1\gamma_1}{\varphi_2^{\prime}(x_k)\varphi_1(x_k)}$$ Again because we are working in monic polynomials, $a_1=A_2/A_1=1$ and if we let $\varphi_1(x)=x+w$ then the condition of orthogonality to $f(x)=1$ is $-1+\frac{\pi}2w=0$ so $$w=\frac2{\pi}=0.636619772367581343075535053490057474$$ and then $$\begin{align}\gamma_1&=\int_{-1}^0\frac{\left(\varphi_1(x)\right)^2}{\sqrt{1-x^2}}dx\\ &=\int_{-1}^0\frac{x^2+2wx+w^2}{\sqrt{1-x^2}}dx\\ &=M_2+2wM_1+w^2M_0\\ &=0.148778391029866966540125792329818225\end{align}$$ And now Wikipedia producees $$\begin{align}A_1&=0.974866349911031438041049989239157236\\ A_2&=0.595929976883865181190271702400594740\end{align}$$ All of these results are consistent to IEEE-$754$ quadruple precision. Wikipedia's formula was a little nicer than Atkinson's in that it used the lower degree polynomial $\varphi_{n-1}(x)$ rather than $\varphi_{n+1}(x)$.