function [ o, x, w ] = cn_geg_02_xiu ( n, alpha ) %*****************************************************************************80 % %% CN_GEG_02_XIU implements the Xiu rule for region CN_GEG. % % Discussion: % % The rule has order % % O = N + 1. % % The rule has precision P = 2. % % CN_GEG is the cube [-1,+1]^N with the Gegenbauer weight function % % w(alpha;x) = product ( 1 <= i <= n ) (1-x(i)^2)^alpha. % % with -1.0 < alpha. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 07 March 2010 % % Author: % % John Burkardt % % Reference: % % Dongbin Xiu, % Numerical integration formulas of degree two, % Applied Numerical Mathematics, % Volume 58, 2008, pages 1515-1520. % % Parameters: % % Input, integer N, the spatial dimension. % % Input, real ALPHA, the parameter. % -1.0 < ALPHA. % % Input, integer O, the order. % % Output, real X(N,O), the abscissas. % % Output, real W(O), the weights. % if ( alpha <= -1.0 ) fprintf ( 1, '\n' ); fprintf ( 1, 'CN_GEG_02_XIU - Fatal error!\n' ); fprintf ( 1, ' ALPHA <= -1.0\n' ); error ( 'CN_GEG_02_XIU - Fatal error!' ); end o = n + 1; x = zeros ( n, o ); w = zeros ( o, 1 ); for j = 1 : o i = 0; for r = 1 : floor ( n / 2 ) arg = 2 * r * ( j - 1 ) * pi / ( n + 1 ); i = i + 1; x(i,j) = sqrt ( 2.0 ) * cos ( arg ); i = i + 1; x(i,j) = sqrt ( 2.0 ) * sin ( arg ); end if ( i < n ) i = i + 1; x(i,j) = r8_mop ( j - 1 ); end end gamma0 = 1.0; delta0 = 0.0; c1 = 1.0 / ( 2.0 * alpha + 3.0 ); x(1:n,1:o) = ( sqrt ( gamma0 * c1 ) * x(1:n,1:o) - delta0 ) / gamma0; expon = 0; volume_1d = c1_geg_monomial_integral ( alpha, expon ); volume = volume_1d ^ n; w(1:o) = volume / o; return end