I was curious about how to calculate an approximate value of a definite integral with the 2 point quadrature formula. So I did a test. We all know that: $$\int_{0}^{\pi} \sin(x)dx = 2$$
Now I tested the quadrature approximation with. $$\left(\frac{b-a}{2}\right)f\left(\frac{b-a}{2}\left(\frac{-1}{\sqrt{3}}\right)+\frac{b+a}{2}\right)+\left(\frac{b-a}{2}\right)f\left(\frac{b-a}{2}\left(\frac{1}{\sqrt{3}}\right)+\frac{b+a}{2}\right)$$
When I calculated this for $a=0$ and $b=\pi$
The value that I got was $4.9$
This is a pretty bad approximation in my opinion. I am wondering if I did something wrong. Can someone check my work?
Also, I used to be able to type in equations here with codecogs, but now I can only link to images. How do you write equations here at stack exchange?