2
$\begingroup$

Obtain a Gauss quadrature formula for $$\int_{0}^{2}{f(x)}\sim A_1 f(x_1)+A_2 f(x_2)$$ that is exact up to cubics.

  1. I know how to find the solution of $$\int_{-1}^{1}{f(x)}\sim A_1 f(x_1)+A_2 f(x_2)$$, but how do I proceed when I change the integral from $-1,1$ to $0,2$? I am having troubles with this.

  2. What is the final result that I should get? Is there any program that gives us the result, so I can check it?

I tried what you suggested, but I am not sure if I got it right or not. So: $$\int_{a}^{b}{f(x)}=(b-a)/2 \int_{-1}^{1}f((b-a)/2 t+(a+b)/2)=\int_{-1}^{1}f(t+1)dt \sim A_1f(t_1+1)+A_2f(t_2+1)$$ where x=t+1 (Am I right?). Now we can form the system of four equations:$$f(t+1)=1 \:\:\:\:\:\:\:\:\:\:\:\:\int_{-1}^{1}dt=A_1+A_2=2$$

$$f(t+1)=t+1 \:\:\:\:\:\:\:\:\:\:\:\:\int_{-1}^{1}(t+1))dt=A_1(t_1+1)+A_2(t_2+1)=2$$ $$f(t+1)=(t+1)^2 \:\:\:\:\:\:\:\:\:\:\:\:\int_{-1}^{1}(t+1))dt=A_1(t_1+1)^2+A_2(t_2+1)^2=8/3$$ $$f(t+1)=(t+1)^3 \:\:\:\:\:\:\:\:\:\:\:\:\int_{-1}^{1}(t+1))dt=A_1(t_1+1)^3+A_2(t_2+1)^3=4$$ We need to find $A_1,A_2,t_1,t_2$. To solve the system we consider the quadratic polynomial $$\pi_2(t)=(t+t_1)(t-t_2)$$ whose roots are $t_1$ and $t_2$. We can expand it as: $$\pi_2(t)=t^2+pt+q$$ To find these we multiply our four equations $(1.,2.,3.,4.)$ by p, q and 1, namely: $$1.*q+(2.-1.)*p+(3.-2*2.+1.)*1\Rightarrow q=-1/3$$ $$(4.-3*3.+3*2.-1.)*1+(3.-2*2.+1.)*p+(2.-1.)*q \Rightarrow p=0$$ We have that $$\pi_2(t)=t^2+pt+q=t^2-1/3 \Rightarrow t_1=-1/\sqrt(3), t_2=1/\sqrt(3)$$ By $1.$ and $2.$ we can find that $A_1=1$ and $A_2=1$. Knowing that x=t+1, we can conclude: $$\int_{0}^{2}{f(x)}=\int_{-1}^{1}f(t+1)dt \sim A_1f(t_1+1)+A_2f(t_2+1)=f(1-1/\sqrt(3)+f(1+1/\sqrt(3)$$.

Is this correct?

$\endgroup$
  • 1
    $\begingroup$ If you know how to get the $A_k, x_k$ for the interval $[-1,1]$ you can use a linear transformation, see en.wikipedia.org/wiki/Gaussian_quadrature#Change_of_interval. Because the transformation is linear the quadrature rule remains exact for cubics. $\endgroup$ – gammatester Nov 24 '15 at 13:11
  • $\begingroup$ The method is also called Gauss-Legendre-Quadrature because the Legendre-polynomials play an important role to get the approximations. $\endgroup$ – Peter Nov 24 '15 at 13:14
  • $\begingroup$ I edited the question. Please have a look at it. @peter @ gammatester $\endgroup$ – Anna_85 Nov 24 '15 at 20:27
2
$\begingroup$

Hint : You have to substitute : We need a function $t(x)$ with $t(a)=-1$ and $t(b)=1$.

The function $t(x)=\frac{2x-a-b}{b-a}$ does the job.

This gives $x(t)=\frac{b-a}{2}t+\frac{a+b}{2}$ and $dx=\frac{b-a}{2}dt$, so we have

$$\int_{a}^b f(x)\ dx=\frac{b-a}{2} \int_{-1}^1 f(\frac{b-a}{2}t+\frac{a+b}{2})\ dt$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.