Three point formula
For
, the coefficients and roots are given by
> r[1]:=-0.7745966692;r[2]:=0.0;r[3]:=-r[1];c[1]:=0.5555555556;c[2]:=0.8888888889;c[3]:=c[1];
Then, this formula should be correct for polynomials up to degree 5:
> exact:=int(a*x^5+b*x^4+c*x^3+d*x^2+e*x+g,x=-1..1);f:=x->a*x^5+b*x^4+c*x^3+d*x^2+e*x+g;gauss3:=0:for i from 1 to 3 do gauss3:=gauss3+c[i]*f(r[i]): od: print(`gauss`=gauss3);
> f:=x->sin(4.*x)*exp(x);gauss3:=0:for i from 1 to 3 do gauss3:=gauss3+c[i]*f(r[i]): od: gauss3;
>