function [xi, w] = GQpoints(n)
%
% This MATLAB m-file can be used to generate the Gauss quadrature abscissas and
% weights, for n <= 32.
%
xi = zeros(n,1);
w = zeros(n,1);
if n == 1
xi(1) = 0.0; w(1) = 2.0;
end
if n == 2
xi(1) = -0.5773502691896257; w(1) = 1.0;
xi(2) = 0.5773502691896257; w(2) = 1.0;
end
if n == 4
w(2) = 0.6521451548625464;
w(3) = 0.6521451548625464;
xi(2) = -0.3399810435848563;
xi(3) = 0.3399810435848563;
w(1) = 0.3478548451374476;
w(4) = 0.3478548451374476;
xi(1) = -0.8611363115940526;
xi(4) = 0.8611363115940526;
end
if n== 8
xi(4) = -0.1834346424956498; w(4) = 0.3626837833783620;
xi(3) = -0.5255324099163290; w(3) = 0.3137066458778874;
xi(2) = -0.7966664774136268; w(2) = 0.2223810344533745;
xi(1) = -0.9602898564975362; w(1) = 0.1012285362903697;
xi(5) = 0.1834346424956498; w(5) = 0.3626837833783620;
xi(6) = 0.5255324099163290; w(6) = 0.3137066458778874;
xi(7) = 0.7966664774136268; w(7) = 0.2223810344533745;
xi(8) = 0.9602898564975362; w(8) = 0.1012285362903697;
end
if n == 16
xi(8) = -0.09501250983763744; w(8) = 0.1894506104550685;
xi(7) = -0.2816035507792589; w(7) = 0.1826034150449236;
xi(6) = -0.4580167776572274; w(6) = 0.1691565193950024;
xi(5) = -0.6178762444026438; w(5) = 0.1495959888165733;
xi(4) = -0.7554044083550030; w(4) = 0.1246289712555339;
xi(3) = -0.8656312023878318; w(3) = 0.09515851168249290;
xi(2) = -0.9445750230732326; w(2) = 0.06225352393864778;
xi(1) = -0.9894009349916499; w(1) = 0.02715245941175185;
xi(9) = 0.09501250983763744; w(9) = 0.1894506104550685;
xi(10) = 0.2816035507792589; w(10) = 0.1826034150449236;
xi(11) = 0.4580167776572274; w(11) = 0.1691565193950024;
xi(12) = 0.6178762444026438; w(12) = 0.1495959888165733;
xi(13) = 0.7554044083550030; w(13) = 0.1246289712555339;
xi(14) = 0.8656312023878318; w(14) = 0.09515851168249290;
xi(15) = 0.9445750230732326; w(15) = 0.06225352393864778;
xi(16) = 0.9894009349916499; w(16) = 0.02715245941175185;
end
if n == 32
xi(1) = -0.99726386184948; w(1) = 0.00701861000947;
xi(2) = -0.98561151154527; w(2) = 0.01627439473091;
xi(3) = -0.96476225558751; w(3) = 0.02539206530926;
xi(4) = -0.93490607593774; w(4) = 0.03427386291302;
xi(5) = -0.89632115576605; w(5) = 0.04283589802223;
xi(6) = -0.84936761373257; w(6) = 0.05099805926238;
xi(7) = -0.79448379596794; w(7) = 0.05868409347853;
xi(8) = -0.73218211874029; w(8) = 0.06582222277636;
xi(9) = -0.66304426693021; w(9) = 0.07234579410885;
xi(10) = -0.58771575724076; w(10) = 0.07819389578707;
xi(11) = -0.50689990893223; w(11) = 0.08331192422695;
xi(12) = -0.42135127613063; w(12) = 0.08765209300440;
xi(13) = -0.33186860228213; w(13) = 0.09117387869576;
xi(14) = -0.23928736225214; w(14) = 0.09384439908080;
xi(15) = -0.14447196158280; w(15) = 0.09563872007927;
xi(16) = -0.04830766568774; w(16) = 0.09654008851473;
xi(17) = 0.04830766568774; w(17) = 0.09654008851473;
xi(18) = 0.14447196158280; w(18) = 0.09563872007927;
xi(19) = 0.23928736225214; w(19) = 0.09384439908081;
xi(20) = 0.33186860228213; w(20) = 0.09117387869576;
xi(21) = 0.42135127613064; w(21) = 0.08765209300440;
xi(22) = 0.50689990893223; w(22) = 0.08331192422695;
xi(23) = 0.58771575724076; w(23) = 0.07819389578707;
xi(24) = 0.66304426693022; w(24) = 0.07234579410885;
xi(25) = 0.73218211874029; w(25) = 0.06582222277636;
xi(26) = 0.79448379596794; w(26) = 0.05868409347854;
xi(27) = 0.84936761373257; w(27) = 0.05099805926238;
xi(28) = 0.89632115576605; w(28) = 0.04283589802223;
xi(29) = 0.93490607593774; w(29) = 0.03427386291302;
xi(30) = 0.96476225558751; w(30) = 0.02539206530926;
xi(31) = 0.98561151154527; w(31) = 0.01627439473091;
xi(32) = 0.99726386184948; w(32) = 0.00701861000947;
end