function [ n_data, a, b, n, fx ] = cos_power_int_values ( n_data ) %*****************************************************************************80 % %% COS_POWER_INT_VALUES returns some values of the cosine power integral. % % Discussion: % % The function has the form % % COS_POWER_INT(A,B,N) = Integral ( A <= T <= B ) ( cos(T) )^N dt % % In Mathematica, the function can be evaluated by: % % Integrate [ ( Cos[x] )^n, { x, a, b } ] % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 30 March 2012 % % Author: % % John Burkardt % % Reference: % % Stephen Wolfram, % The Mathematica Book, % Fourth Edition, % Cambridge University Press, 1999, % ISBN: 0-521-64314-7, % LC: QA76.95.W65. % % Parameters: % % Input/output, integer N_DATA. The user sets N_DATA to 0 % before the first call. On each call, the routine increments N_DATA by 1, % and returns the corresponding data; when there is no more data, the % output value of N_DATA will be 0 again. % % Output, real A, B, the limits of integration. % % Output, integer N, the power. % % Output, real FX, the function value. % n_max = 11; a_vec = [ ... 0.00, ... 0.00, ... 0.00, ... 0.00, ... 0.00, ... 0.00, ... 0.00, ... 0.00, ... 0.00, ... 0.00, ... 0.00 ]; b_vec = [ ... 3.141592653589793, ... 3.141592653589793, ... 3.141592653589793, ... 3.141592653589793, ... 3.141592653589793, ... 3.141592653589793, ... 3.141592653589793, ... 3.141592653589793, ... 3.141592653589793, ... 3.141592653589793, ... 3.141592653589793 ]; fx_vec = [ ... 3.141592653589793, ... 0.0, ... 1.570796326794897, ... 0.0, ... 1.178097245096172, ... 0.0, ... 0.9817477042468104, ... 0.0, ... 0.8590292412159591, ... 0.0, ... 0.7731263170943632 ]; n_vec = [ ... 0, ... 1, ... 2, ... 3, ... 4, ... 5, ... 6, ... 7, ... 8, ... 9, ... 10 ]; if ( n_data < 0 ) n_data = 0; end n_data = n_data + 1; if ( n_max < n_data ) n_data = 0; a = 0.0; b = 0.0; n = 0; fx = 0.0; else a = a_vec(n_data); b = b_vec(n_data); n = n_vec(n_data); fx = fx_vec(n_data); end return end