- #1
mathmari
Gold Member
MHB
- 5,049
- 7
Hey! :giggle:
Let $\displaystyle{I_n(f)=\sum_{i=0}^na_if(x_i)}$ be a quadrature formula for the approximate calculation of the integral $I(f)=\int_a^bf(x)\, dx$.
Show that a polynomial $p$ of degree $2n+2$ exists such that $I_n(p)\neq I(p)$.
Calculate the approximation of the integral $$\int_0^{\pi}\sqrt{\sin (x)}\, dx$$ using Gauss-Legendre quadrature formula with $2$ nodes.
For the second part I have done the following :
We get the orthogonal polynomials by the recurive formula:
\begin{align*}&P_n(x)=(a_n+x)P_{n-1}(x)+c_nP_{n-2}(x) \\ &P_0=1, \ P_{-1}=0\end{align*} with \begin{equation*}a_n=-\frac{\langle x\cdot P_{n-1}, P_{n-1}\rangle_w}{\langle P_{n-1}, P_{n-1}\rangle_w}, \ \ \ , c_n=-\frac{\langle P_{n-1}, P_{n-1}\rangle_w}{\langle P_{n-2}, P_{n-2}\rangle_w}\end{equation*}
We have :
\begin{equation*}P_1(x)=(a_1+x)P_{0}(x)+c_1P_{-1}(x)=(a_1+x)\cdot 1+c_1\cdot 0=a_1+x \end{equation*}
We need to calculate $a_1$:
\begin{equation*}a_1=-\frac{\langle x\cdot P_{0}, P_{0}\rangle_w}{\langle P_{0}, P_{0}\rangle_w}=-\frac{\langle x, 1\rangle_w}{\langle 1, 1\rangle_w}\end{equation*}
We have that \begin{align*}&\langle x, 1\rangle_w=\int_0^{\pi}x\cdot 1\cdot w(x)\, dx=\int_0^{\pi} x\cdot 1\, dx =\frac{\pi^2}{2} \\ &\langle 1, 1\rangle_w=\int_0^{\pi}1\cdot 1\cdot 1\, dx=\int_0^{\pi} 1\, dx =\pi\end{align*}
So we have that $a_1=-\frac{\pi}{2}$. Therefore we get $P_1=-\frac{\pi}{2}+x$.
We have that
\begin{equation*}P_2(x)=(a_2+x)P_{1}(x)+c_2P_{0}(x)=(a_2+x)\cdot \left (-\frac{\pi}{2}+x\right )+c_2\end{equation*}
We need to calculate $a_2$ and $c_2$:
\begin{equation*}a_2=-\frac{\langle x\cdot P_{1}, P_{1}\rangle_w}{\langle P_{1}, P_{1}\rangle_w}=-\frac{\langle x\cdot \left (-\frac{\pi}{2}+x\right ), -\frac{\pi}{2}+x\rangle_w}{\langle -\frac{\pi}{2}+x, -\frac{\pi}{2}+x\rangle_w}=-\frac{\langle -\frac{\pi}{2}x+x^2, -\frac{\pi}{2}+x\rangle_w}{\langle -\frac{\pi}{2}+x, -\frac{\pi}{2}+x\rangle_w}\end{equation*}
We have that \begin{align*}&\langle -\frac{\pi}{2}x+x^2, -\frac{\pi}{2}+x\rangle_w=\int_0^{\pi}\left (-\frac{\pi}{2}x+x^2\right )\cdot \left (-\frac{\pi}{2}+x\right )\cdot 1\, dx=\frac{\pi^4}{24} \\ &\langle -\frac{\pi}{2}+x, -\frac{\pi}{2}+x\rangle_w=\int_0^{\pi}\left (-\frac{\pi}{2}+x\right )\cdot \left (-\frac{\pi}{2}+x\right )\cdot 1\, dx=\frac{\pi^3}{12}\end{align*}
So we have that $a_2=-\frac{\frac{\pi^4}{24}}{\frac{\pi^3}{12}}=-\frac{\pi}{2}$ and $c_2=-\frac{\langle P_{1}, P_{1}\rangle_w}{\langle P_{0}, P_{0}\rangle_w}=-\frac{\frac{\pi^3}{12}}{\pi}=-\frac{\pi^2}{12}$.
Therefore we get $P_2=(-\frac{\pi}{2}+x)\cdot \left (-\frac{\pi}{2}+x\right )-\frac{\pi^2}{12}$.
But this is not correct, is it? Do we not have to get $P_2(x)=\frac{1}{2}\left (3x^2-1\right )$ ? :unsure:
Let $\displaystyle{I_n(f)=\sum_{i=0}^na_if(x_i)}$ be a quadrature formula for the approximate calculation of the integral $I(f)=\int_a^bf(x)\, dx$.
Show that a polynomial $p$ of degree $2n+2$ exists such that $I_n(p)\neq I(p)$.
Calculate the approximation of the integral $$\int_0^{\pi}\sqrt{\sin (x)}\, dx$$ using Gauss-Legendre quadrature formula with $2$ nodes.
For the second part I have done the following :
We get the orthogonal polynomials by the recurive formula:
\begin{align*}&P_n(x)=(a_n+x)P_{n-1}(x)+c_nP_{n-2}(x) \\ &P_0=1, \ P_{-1}=0\end{align*} with \begin{equation*}a_n=-\frac{\langle x\cdot P_{n-1}, P_{n-1}\rangle_w}{\langle P_{n-1}, P_{n-1}\rangle_w}, \ \ \ , c_n=-\frac{\langle P_{n-1}, P_{n-1}\rangle_w}{\langle P_{n-2}, P_{n-2}\rangle_w}\end{equation*}
We have :
\begin{equation*}P_1(x)=(a_1+x)P_{0}(x)+c_1P_{-1}(x)=(a_1+x)\cdot 1+c_1\cdot 0=a_1+x \end{equation*}
We need to calculate $a_1$:
\begin{equation*}a_1=-\frac{\langle x\cdot P_{0}, P_{0}\rangle_w}{\langle P_{0}, P_{0}\rangle_w}=-\frac{\langle x, 1\rangle_w}{\langle 1, 1\rangle_w}\end{equation*}
We have that \begin{align*}&\langle x, 1\rangle_w=\int_0^{\pi}x\cdot 1\cdot w(x)\, dx=\int_0^{\pi} x\cdot 1\, dx =\frac{\pi^2}{2} \\ &\langle 1, 1\rangle_w=\int_0^{\pi}1\cdot 1\cdot 1\, dx=\int_0^{\pi} 1\, dx =\pi\end{align*}
So we have that $a_1=-\frac{\pi}{2}$. Therefore we get $P_1=-\frac{\pi}{2}+x$.
We have that
\begin{equation*}P_2(x)=(a_2+x)P_{1}(x)+c_2P_{0}(x)=(a_2+x)\cdot \left (-\frac{\pi}{2}+x\right )+c_2\end{equation*}
We need to calculate $a_2$ and $c_2$:
\begin{equation*}a_2=-\frac{\langle x\cdot P_{1}, P_{1}\rangle_w}{\langle P_{1}, P_{1}\rangle_w}=-\frac{\langle x\cdot \left (-\frac{\pi}{2}+x\right ), -\frac{\pi}{2}+x\rangle_w}{\langle -\frac{\pi}{2}+x, -\frac{\pi}{2}+x\rangle_w}=-\frac{\langle -\frac{\pi}{2}x+x^2, -\frac{\pi}{2}+x\rangle_w}{\langle -\frac{\pi}{2}+x, -\frac{\pi}{2}+x\rangle_w}\end{equation*}
We have that \begin{align*}&\langle -\frac{\pi}{2}x+x^2, -\frac{\pi}{2}+x\rangle_w=\int_0^{\pi}\left (-\frac{\pi}{2}x+x^2\right )\cdot \left (-\frac{\pi}{2}+x\right )\cdot 1\, dx=\frac{\pi^4}{24} \\ &\langle -\frac{\pi}{2}+x, -\frac{\pi}{2}+x\rangle_w=\int_0^{\pi}\left (-\frac{\pi}{2}+x\right )\cdot \left (-\frac{\pi}{2}+x\right )\cdot 1\, dx=\frac{\pi^3}{12}\end{align*}
So we have that $a_2=-\frac{\frac{\pi^4}{24}}{\frac{\pi^3}{12}}=-\frac{\pi}{2}$ and $c_2=-\frac{\langle P_{1}, P_{1}\rangle_w}{\langle P_{0}, P_{0}\rangle_w}=-\frac{\frac{\pi^3}{12}}{\pi}=-\frac{\pi^2}{12}$.
Therefore we get $P_2=(-\frac{\pi}{2}+x)\cdot \left (-\frac{\pi}{2}+x\right )-\frac{\pi^2}{12}$.
But this is not correct, is it? Do we not have to get $P_2(x)=\frac{1}{2}\left (3x^2-1\right )$ ? :unsure:
Last edited by a moderator: