function normal_truncated_ab_cdf_test ( ) %*****************************************************************************80 % %% NORMAL_TRUNCATED_AB_CDF_TEST tests NORMAL_TRUNCATED_AB_CDF. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 11 April 2016 % % Author: % % John Burkardt % seed = 123456789; a = 50.0; b = 150.0; mu = 100.0; s = 25.0; fprintf ( 1, '\n' ); fprintf ( 1, 'NORMAL_TRUNCATED_AB_CDF_TEST\n' ); fprintf ( 1, ' NORMAL_TRUNCATED_AB_CDF evaluates the Normal Truncated AB CDF.\n' ); fprintf ( 1, ' NORMAL_TRUNCATED_AB_CDF_INV inverts the Normal Truncated AB CDF.\n' ); fprintf ( 1, ' NORMAL_TRUNCATED_AB_PDF evaluates the Normal Truncated AB PDF.\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' The "parent" normal distribution has\n' ); fprintf ( 1, ' mean = %g\n', mu ); fprintf ( 1, ' standard deviation = %g\n', s ); fprintf ( 1, ' The parent distribution is truncated to\n' ); fprintf ( 1, ' the interval [%g,%g]\n', a, b ); fprintf ( 1, '\n' ); fprintf ( 1, ' X PDF CDF CDF_INV\n' ); fprintf ( 1, '\n'); for i = 1 : 10 [ x, seed ] = normal_truncated_ab_sample ( mu, s, a, b, seed ); pdf = normal_truncated_ab_pdf ( x, mu, s, a, b ); cdf = normal_truncated_ab_cdf ( x, mu, s, a, b ); x2 = normal_truncated_ab_cdf_inv ( cdf, mu, s, a, b ); fprintf( 1, ' %14g %14g %14g %14g\n', x, pdf, cdf, x2 ); end return end