LineGaussRuleInfo[ {rule_, numer_ }, point_ ] := Module [
{ g2 = {-1,1}/Sqrt[3],
w3={5/9,8/9,5/9},
g3={-Sqrt[3/5],0,Sqrt[3/5]},
w4={(1/2)-Sqrt[5/6]/6,
(1/2)+Sqrt[5/6]/6,
(1/2)+Sqrt[5/6]/6,
(1/2)-Sqrt[5/6]/6},
g4={-Sqrt[(3+2*Sqrt[6/5])/7],
-Sqrt[(3-2*Sqrt[6/5])/7],
Sqrt[(3-2*Sqrt[6/5])/7],
Sqrt[(3+2*Sqrt[6/5])/7]},
g5={-Sqrt[5+2*Sqrt[10/7]],
-Sqrt[5-2*Sqrt[10/7]],
0,
Sqrt[5-2*Sqrt[10/7]],
Sqrt[5+2*Sqrt[10/7]]}/3,
w5={322-13*Sqrt[70],
322+13*Sqrt[70],
512,
322+13*Sqrt[70],
322-13*Sqrt[70]}/900,
i=point,p=rule, info={Null,0}},
If [ p == 1,info = {0,2}];
If [ p == 2, info={g2[[i]],1}];
If [ p == 3, info={g3[[i]],w3[[i]]}];
If [ p == 4, info ={g4[[i]],w4[[i]]}];
If [ p == 5, info = {g5[[i]],w5[[i]]}];
If [ numer, Return [ N[info,20]], Return [ Simplify[info]]];
];

Print[" "];
Print["LineGaussRuleInfoTest.nb"];
Print["  Mathematica version"];
Print[" "];
Print["  Test the quadrature rules for a line, returned"];
Print["  by {x,w} = LineGaussRuleInfo[{rule,numer},i]"];
Print[" "];
Print["  INPUT:"];
Print[" "];
Print["  RULE is 1, 2, 3, 4, or 5, the order of the rule."];
Print[" "];
Print["  NUMER is True to return numerical values for the output, or"];
Print["  False to return symbolic values."];
Print[" "];
Print["  I is the index, between 1 and |RULE|, of the point desired."]
Print[" "];
Print["  OUTPUT:"];
Print[" "];
Print["  X is the coordinate of the quadrature point,"]
Print["  with -1 <= X <= +1."];
Print[" "];
Print["  W is the weight of the quadrature point."]
Print[" "]
Print["  The following cells print out each rule, and the sum"]
Print["  of the weights.  The weights should sum to 2."]

For [ rule =1, rule ≤ 5, rule++,
numer = True;
wsum = 0;
Print[" "];
Print["Line rule number ", rule];
Print[" "];
Print["W"];
Print[" "];
For [ i=1, i ≤ rule, i++,
{x,w} =LineGaussRuleInfo[{rule,numer},i];
Print [ w ];
wsum = wsum +w;
];
Print["sum(w) = ", wsum ];
Print[" "];
Print["X"];
Print[" "];
For [ i=1, i ≤ rule, i++,
{ x,w} = LineGaussRuleInfo[{rule,numer},i];
Print [ x ];
];
];