function chebyshev1_rule ( order, output ) %% LEGENDRE_RULE generates a Gauss-Chebyshev type 1 quadrature rule. % % Discussion: % % This program computes a standard Gauss-Chebyshev type 1 quadrature rule % and writes it to a file. % % The user specifies: % * the ORDER (number of points) in the rule % * the root name of the output files. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 01 March 2008 % % Author: % % John Burkardt % timestamp; fprintf ( 1, '\n' ); fprintf ( 1, 'CHEBYSHEV1_RULE\n' ); fprintf ( 1, ' MATLAB version\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' Compute a Gauss-Chebyshev type 1 rule for approximating\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' Integral ( -1 <= x <= +1 ) f(x) / sqrt(1-x^2) dx\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' of order ORDER.\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' The user specifies ORDER and OUTPUT.\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' OUTPUT is:\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' "C++" for printed C++ output;\n' ); fprintf ( 1, ' "F77" for printed Fortran77 output;\n' ); fprintf ( 1, ' "F90" for printed Fortran90 output;\n' ); fprintf ( 1, ' "MAT" for printed MATLAB output;\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' or:\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' "filename" to generate 3 files:\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' filename_w.txt - the weight file\n' ); fprintf ( 1, ' filename_x.txt - the abscissa file.\n' ); fprintf ( 1, ' filename_r.txt - the region file.\n' ); % % Get the order. % if ( 1 <= nargin ) else order = input ( ' Enter the rule order ORDER.' ); end fprintf ( 1, '\n' ); fprintf ( 1, ' The requested order of the rule is %d\n', order ); % % Get the output option or quadrature file root name: % if ( 2 <= nargin ) else fprintf ( 1, '\n' ); fprintf ( 1, ' OUTPUT specifies printed output in the form of\n' ); fprintf ( 1, ' ''C++'', ''F77'', ''F90'', ''MAT'',\n' ); fprintf ( 1, ' or else the ''root name'' of a set of quadrature files).\n' ); output = input ( ' Enter the value of OUTPUT as a quoted string:' ); end fprintf ( 1, '\n' ); fprintf ( 1, ' OUTPUT option = "%s".\n', output ); % % Construct the rule and output it. % chebyshev1_handle ( order, output ); fprintf ( 1, '\n' ); fprintf ( 1, 'CHEBYSHEV1_RULE:\n' ); fprintf ( 1, ' Normal end of execution.\n' ); fprintf ( 1, '\n' ); timestamp;