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.
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.
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?