2-point formula

For [Maple Math] , the coefficients and roots are given by

> r[1]:=0.5773502692;r[2]:=-r[1];c[1]:=1.;c[2]:=1.;

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

Then, this formula should be correct for polynomials up to degree 3:

> exact:=int(a,x=-1..1);f:=x->a:gauss2:=0:for i from 1 to 2 do gauss2:=gauss2+c[i]*f(r[i]): od: print(`gauss`=gauss2);

[Maple Math]

[Maple Math]

> exact:=int(a*x+b,x=-1..1);f:=x->a*x+b:gauss2:=0:for i from 1 to 2 do gauss2:=gauss2+c[i]*f(r[i]): od: print(`gauss`=gauss2);

[Maple Math]

[Maple Math]

> exact:=int(a*x^2+b*x+c,x=-1..1);f:=x->a*x^2+b*x+c:gauss2:=0:for i from 1 to 2 do gauss2:=gauss2+c[i]*f(r[i]): od: print(`gauss`=gauss2);

[Maple Math]

[Maple Math]

> exact:=int(a*x^3+b*x^2+c*x+d,x=-1..1);f:=x->a*x^3+b*x^2+c*x+d:gauss2:=0:for i from 1 to 2 do gauss2:=gauss2+c[i]*f(r[i]): od: print(`gauss`=gauss2);

[Maple Math]

[Maple Math]

> f:=x->sin(4.*x)*exp(x);gauss2:=0:for i from 1 to 2 do gauss2:=gauss2+c[i]*f(r[i]): od: gauss2;

[Maple Math]

[Maple Math]

>