function cdf = chebyshev2_cdf ( x )

%*****************************************************************************80
%
%% chebyshev2_cdf() evaluates the Chebyshev2 CDF.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    06 December 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X, the argument of the CDF.
%
%  Output:
%
%    real CDF, the value of the CDF.
%
  cdf = zeros ( size ( x ) );

  i = find ( x < -1.0 );
  j = find ( -1.0 <= x & x <= 1.0 );
  k = find ( 1.0 < x );

  cdf(i) = 0.0;
  cdf(j) = 0.5 + ( x .* sqrt ( 1.0 - x(j) .* x(j) ) + asin ( x(j) ) ) / pi;
  cdf(k) = 1.0;

  return
end
