function [ x, w ] = chebyshev3_set ( n )

%*****************************************************************************80
%
%% chebyshev3_set() sets a Chebyshev Type 3 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.000000000000000;
    w( 1) =    3.141592653589793;
  elseif ( n == 2 )    
    x( 1) =   -1.000000000000000;    
    x( 2) =    1.000000000000000;    
    w( 1) =    1.570796326794897;    
    w( 2) =    1.570796326794897;
  elseif ( n == 3 )  
    x( 1) =   -1.000000000000000;    
    x( 2) =   0.0;
    x( 3) =    1.000000000000000;    
    w( 1) =   0.7853981633974483;    
    w( 2) =    1.570796326794897;    
    w( 3) =   0.7853981633974483;
  elseif ( n == 4 )    
    x( 1) =   -1.000000000000000;    
    x( 2) =  -0.5000000000000000;    
    x( 3) =   0.5000000000000000;    
    x( 4) =    1.000000000000000;    
    w( 1) =   0.5235987755982988;    
    w( 2) =    1.047197551196598;    
    w( 3) =    1.047197551196598;    
    w( 4) =   0.5235987755982988;
  elseif ( n == 5 )    
    x( 1) =   -1.000000000000000;    
    x( 2) =  -0.7071067811865475;    
    x( 3) =   0.0;
    x( 4) =   0.7071067811865476;    
    x( 5) =    1.000000000000000;    
    w( 1) =   0.3926990816987241;    
    w( 2) =   0.7853981633974483;    
    w( 3) =   0.7853981633974483;    
    w( 4) =   0.7853981633974483;    
    w( 5) =   0.3926990816987241;
  elseif ( n == 6 )   
    x( 1) =   -1.000000000000000;    
    x( 2) =  -0.8090169943749473;    
    x( 3) =  -0.3090169943749473;    
    x( 4) =   0.3090169943749475;    
    x( 5) =   0.8090169943749475;    
    x( 6) =    1.000000000000000;    
    w( 1) =   0.3141592653589793;    
    w( 2) =   0.6283185307179586;    
    w( 3) =   0.6283185307179586;    
    w( 4) =   0.6283185307179586;    
    w( 5) =   0.6283185307179586;    
    w( 6) =   0.3141592653589793;
  elseif ( n == 7 )    
    x( 1) =   -1.000000000000000;    
    x( 2) =  -0.8660254037844387;    
    x( 3) =  -0.5000000000000000;    
    x( 4) =   0.0;
    x( 5) =   0.5000000000000001;    
    x( 6) =   0.8660254037844387;    
    x( 7) =    1.000000000000000;    
    w( 1) =   0.2617993877991494;    
    w( 2) =   0.5235987755982988;    
    w( 3) =   0.5235987755982988;    
    w( 4) =   0.5235987755982988;    
    w( 5) =   0.5235987755982988;    
    w( 6) =   0.5235987755982988;    
    w( 7) =   0.2617993877991494;
  elseif ( n == 8 )    
    x( 1) =   -1.000000000000000;    
    x( 2) =  -0.9009688679024190;    
    x( 3) =  -0.6234898018587335;    
    x( 4) =  -0.2225209339563143;    
    x( 5) =   0.2225209339563144;    
    x( 6) =   0.6234898018587336;    
    x( 7) =   0.9009688679024191;    
    x( 8) =    1.000000000000000;    
    w( 1) =   0.2243994752564138;    
    w( 2) =   0.4487989505128276;    
    w( 3) =   0.4487989505128276;    
    w( 4) =   0.4487989505128276;    
    w( 5) =   0.4487989505128276;    
    w( 6) =   0.4487989505128276;    
    w( 7) =   0.4487989505128276;    
    w( 8) =   0.2243994752564138;
  elseif ( n == 9 )    
    x( 1) =   -1.000000000000000;    
    x( 2) =  -0.9238795325112867;    
    x( 3) =  -0.7071067811865475;    
    x( 4) =  -0.3826834323650897;    
    x( 5) =   0.0;
    x( 6) =   0.3826834323650898;    
    x( 7) =   0.7071067811865476;    
    x( 8) =   0.9238795325112867;    
    x( 9) =    1.000000000000000;    
    w( 1) =   0.1963495408493621;    
    w( 2) =   0.3926990816987241;    
    w( 3) =   0.3926990816987241;    
    w( 4) =   0.3926990816987241;    
    w( 5) =   0.3926990816987241;    
    w( 6) =   0.3926990816987241;    
    w( 7) =   0.3926990816987241;    
    w( 8) =   0.3926990816987241;    
    w( 9) =   0.1963495408493621;
  elseif ( n == 10 )    
    x( 1) =   -1.000000000000000;    
    x( 2) =  -0.9396926207859083;    
    x( 3) =  -0.7660444431189779;    
    x( 4) =  -0.5000000000000000;    
    x( 5) =  -0.1736481776669303;    
    x( 6) =   0.1736481776669304;    
    x( 7) =   0.5000000000000001;    
    x( 8) =   0.7660444431189780;    
    x( 9) =   0.9396926207859084;    
    x(10) =    1.000000000000000;    
    w( 1) =   0.1745329251994329;    
    w( 2) =   0.3490658503988659;    
    w( 3) =   0.3490658503988659;    
    w( 4) =   0.3490658503988659;    
    w( 5) =   0.3490658503988659;    
    w( 6) =   0.3490658503988659;    
    w( 7) =   0.3490658503988659; 
    w( 8) =   0.3490658503988659;    
    w( 9) =   0.3490658503988659;    
    w(10) =   0.1745329251994329;    
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, 'CHEBYSHEV3_SET - Fatal error!\n' );
    fprintf ( 1, '  Illegal value of N = %d\n', n );
    fprintf ( 1, '  Legal values are 1 through 10.\n' );
    error ( 'CHEBYSHEV3_SET - Fatal error!' );
  end
%
%  Destroy all row vectors!
%
  x = x(:);
  w = w(:);

  return
end
