I need to integrate the following between x = $-1$ and $1$: $$f(x) =x (\cos(x)/\sin(x))$$ As far as I know it is not possible to obtain exact integration to this integral. I was trying to solve using a Gaussian quadrature method. So I used Gauss-Legendre Quadrature with two integration points as follows: $$\int_{-1}^{1}{f(x)}=\underset{i=1}{\overset{2}{\sum}}w_i \, f(z_i)$$ where $w_1=w_2=1$ and $z_1 = -1/\sqrt(3)$ and $z_2 = 1/\sqrt(3)$
and I got some results but they seem to be somewhat greater that what I should be getting. I was wondering if someone could verify that what I am doing is correct. Thank you in advance!

-
Can you be more precise about what you are doing? For example, what are your results, and what were you expecting? – Ron Gordon Feb 20 '13 at 11:07
Also, I edited your expression of the G-L sum for clarity. – Ron Gordon Feb 20 '13 at 11:27
Thanks, Basically, I need to evaluate the integral of a function g(z) at a set of points that are not equally spaced. Let's assume f(x) is the weighted function I got when I transformed g(z) into global coordinates. So I then have a function the second equation ... (I hope that is clear enough) – Hooman Feb 20 '13 at 14:02
I know what you are talking about. It is not accurate, though, to speak of the weights being a function of the coordinate; rather, they and the coordinates are a function of the weighting function, interval, and number of sample points. That said, pretty amazing how few points you need to get within 1% of the exact result! (Because of the symmetry, that was one function evaluation.) – Ron Gordon Feb 20 '13 at 19:30

Using the two-point Gauss-Legendre as you illustrated, I get a value of about $1.77268$ for the integral. The exact value, evaluated out to this many digits, is $1.76823$. This is not bad for a two-point evaluation.
$$\int_{-1}^1 dx \: x \cot{x} = 2 \Re{[\log{(1-\cos{2} + i \sin{2})}]} + \Im{\mathrm{Li}_2(\cos{2} + i \sin{2})}$$