function [ x, w ] = chebyshev2_set ( n )

%*****************************************************************************80
%
%% chebyshev2_set() sets a Chebyshev Type 2 quadrature rule.
%
%  Discussion:
%
%    The integral:
%
%      integral ( -1 <= x <= 1 ) f(x) * sqrt ( 1 - x * x ) dx
%
%    The quadrature rule:
%
%      sum ( 1 <= i <= n ) w(i) * f ( x(i) )
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 May 2014
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order.
%    N must be between 1 and 10.
%
%  Output:
%
%    real X(N), the abscissas.
%
%    real W(N), the weights.
%
  if ( n == 1 )
    x( 1) =   0.0;
    w( 1) =    1.570796326794897;
  elseif ( n == 2 )
    x( 1) =  -0.5000000000000000;    
    x( 2) =   0.5000000000000000;    
    w( 1) =   0.7853981633974484;    
    w( 2) =   0.7853981633974481; 
  elseif ( n == 3 )   
    x( 1) =  -0.7071067811865475;    
    x( 2) =   0.0;
    x( 3) =   0.7071067811865476;    
    w( 1) =   0.3926990816987243;    
    w( 2) =   0.7853981633974483;    
    w( 3) =   0.3926990816987240;
  elseif ( n == 4 )   
    x( 1) =  -0.8090169943749473;    
    x( 2) =  -0.3090169943749473;    
    x( 3) =   0.3090169943749475;    
    x( 4) =   0.8090169943749475;    
    w( 1) =   0.2170787134227061;    
    w( 2) =   0.5683194499747424;    
    w( 3) =   0.5683194499747423;    
    w( 4) =   0.2170787134227060;
  elseif ( n == 5 )   
    x( 1) =  -0.8660254037844387;   
    x( 2) =  -0.5000000000000000;    
    x( 3) =   0.0;
    x( 4) =   0.5000000000000000;    
    x( 5) =   0.8660254037844387;    
    w( 1) =   0.1308996938995747;    
    w( 2) =   0.3926990816987242;    
    w( 3) =   0.5235987755982988;    
    w( 4) =   0.3926990816987240;    
    w( 5) =   0.1308996938995747;
  elseif ( n == 6 )  
    x( 1) =  -0.9009688679024190;    
    x( 2) =  -0.6234898018587335;    
    x( 3) =  -0.2225209339563143;    
    x( 4) =   0.2225209339563144;    
    x( 5) =   0.6234898018587336;    
    x( 6) =   0.9009688679024191;    
    w( 1) =   0.08448869089158863;
    w( 2) =   0.2743330560697779;    
    w( 3) =   0.4265764164360819;    
    w( 4) =   0.4265764164360819;    
    w( 5) =   0.2743330560697778;    
    w( 6) =   0.08448869089158857;
  elseif ( n == 7 )
    x( 1) =  -0.9238795325112867;    
    x( 2) =  -0.7071067811865475;    
    x( 3) =  -0.3826834323650897;    
    x( 4) =   0.0;
    x( 5) =   0.3826834323650898;    
    x( 6) =   0.7071067811865476;    
    x( 7) =   0.9238795325112867;    
    w( 1) =   0.05750944903191316;
    w( 2) =   0.1963495408493621;    
    w( 3) =   0.3351896326668110;    
    w( 4) =   0.3926990816987241;    
    w( 5) =   0.3351896326668110;    
    w( 6) =   0.1963495408493620;    
    w( 7) =   0.05750944903191313;
  elseif ( n == 8 )
    x( 1) =  -0.9396926207859083;    
    x( 2) =  -0.7660444431189779;    
    x( 3) =  -0.5000000000000000;    
    x( 4) =  -0.1736481776669303;    
    x( 5) =   0.1736481776669304;    
    x( 6) =   0.5000000000000000;    
    x( 7) =   0.7660444431189780;    
    x( 8) =   0.9396926207859084;    
    w( 1) =   0.04083294770910712;
    w( 2) =   0.1442256007956728;    
    w( 3) =   0.2617993877991495;    
    w( 4) =   0.3385402270935190;    
    w( 5) =   0.3385402270935190;    
    w( 6) =   0.2617993877991494;    
    w( 7) =   0.1442256007956727;    
    w( 8) =   0.04083294770910708;
  elseif ( n == 9 )
    x( 1) =  -0.9510565162951535;    
    x( 2) =  -0.8090169943749473;    
    x( 3) =  -0.5877852522924730;    
    x( 4) =  -0.3090169943749473;    
    x( 5) =   0.0;
    x( 6) =   0.3090169943749475;    
    x( 7) =   0.5877852522924731;    
    x( 8) =   0.8090169943749475;    
    x( 9) =   0.9510565162951535;    
    w( 1) =   0.02999954037160818;
    w( 2) =   0.1085393567113530;    
    w( 3) =   0.2056199086476263;    
    w( 4) =   0.2841597249873712;    
    w( 5) =   0.3141592653589793;    
    w( 6) =   0.2841597249873711;    
    w( 7) =   0.2056199086476263;    
    w( 8) =   0.1085393567113530;    
    w( 9) =   0.02999954037160816;
  elseif ( n == 10 )
    x( 1) =  -0.9594929736144974;    
    x( 2) =  -0.8412535328311811;    
    x( 3) =  -0.6548607339452850;    
    x( 4) =  -0.4154150130018863;    
    x( 5) =  -0.1423148382732850;    
    x( 6) =   0.1423148382732851;    
    x( 7) =   0.4154150130018864;    
    x( 8) =   0.6548607339452851;    
    x( 9) =   0.8412535328311812;    
    x(10) =   0.9594929736144974;    
    w( 1) =   0.02266894250185884;
    w( 2) =   0.08347854093418908;
    w( 3) =   0.1631221774548166;    
    w( 4) =   0.2363135602034873;    
    w( 5) =   0.2798149423030966;    
    w( 6) =   0.2798149423030965;    
    w( 7) =   0.2363135602034873;    
    w( 8) =   0.1631221774548166;    
    w( 9) =   0.08347854093418902;
    w(10) =   0.02266894250185884;
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, 'CHEBYSHEV2_SET - Fatal error!\n' );
    fprintf ( 1, '  Illegal value of N = %d\n', n );
    fprintf ( 1, '  Legal values are 1 through 10.\n' );
    error ( 'CHEBYSHEV2_SET - Fatal error!' );
  end
%
%  Destroy all row vectors!
%
  x = x(:);
  w = w(:);

  return
end
