# gaussian integration

I'm new on Mathematica and I am an engeneer with only a little base of numerical computation. I have to integrate a trigonometrical function numerically with a Gauss integration. The function is:

   t[alpha_,x_]= ( 2 Sin[alpha]^4 - Cos[alpha]^2 Sin[alpha]^2 ) 1/(
2 Sin[alpha]^4 (Cot[alpha]^2 - 1) (Cot[alpha]^2 -
0.5)) (-(1/(Cos[alpha]^2 Abs[x]^2)))


I have to integrate it in the interval from 0 to Pi. Then I have to find couples of points and weights like this

f = GaussianQuadratureWeights[n, 0, Pi]


with n the number of point and after add weight for the function t evaluated in the point?

    g = 0
For[ i = 1, i < n + 1, i++,

g = g + f[[i, 2]] t[f[[i, 1]],x]
]

• Have you seen this? – J. M. will be back soon Jul 5 '15 at 15:09
• no I haven't, thank you! So I have to write my function like this? (below) – diana Jul 5 '15 at 16:22

 g[a_] := ( 2 Sin[a]^4 - Cos[a]^2 Sin[a]^2 ) 1/(
2 Sin[a]^4 (Cot[a]^2 - 1) (Cot[a]^2 - 0.5)) (-(1/(Cos[a]^2) ));