void test03 ( ) /******************************************************************************/ /* Purpose: TEST03 demonstrates the use of LGAMMA. Licensing: This code is distributed under the GNU LGPL license. Modified: 25 September 2014 Author: John Burkardt */ { double fx; double fx2; int ier; int n_data; double x; printf ( "\n" ); printf ( "TEST03:\n" ); printf ( " LGAMMA computes the logarithm of the \n" ); printf ( " Gamma function.\n" ); printf ( " LGAMMA is available with the GCC compiler.\n" ); printf ( " We compare the result to tabulated values.\n" ); printf ( "\n" ); printf ( " X " ); printf ( "FX FX2\n" ); printf ( " " ); printf ( "(Tabulated) (LGAMMA) DIFF\n" ); printf ( "\n" ); n_data = 0; for ( ; ; ) { gamma_log_values ( &n_data, &x, &fx ); if ( n_data == 0 ) { break; } fx2 = lgamma ( x ); printf ( " %24.16f %24.16f %24.16f %10.4e\n", x, fx, fx2, fabs ( fx - fx2 ) ); } return; }
void test01 ( ) /******************************************************************************/ /* Purpose: TEST01 demonstrates the use of ALNGAM. Licensing: This code is distributed under the GNU LGPL license. Modified: 20 November 2010 Author: John Burkardt */ { double fx; double fx2; int ifault; int n_data; double x; printf ( "\n" ); printf ( "TEST01:\n" ); printf ( " ALNGAM computes the logarithm of the \n" ); printf ( " Gamma function. We compare the result\n" ); printf ( " to tabulated values.\n" ); printf ( "\n" ); printf ( " X " ); printf ( "FX FX2\n" ); printf ( " " ); printf ( "(Tabulated) (ALNGAM) DIFF\n" ); printf ( "\n" ); n_data = 0; for ( ; ; ) { gamma_log_values ( &n_data, &x, &fx ); if ( n_data == 0 ) { break; } fx2 = alngam ( x, &ifault ); printf ( " %24.16f %24.16f %24.16f %10.4e\n", x, fx, fx2, fabs ( fx - fx2 ) ); } return; }
void test01 ( void ) /******************************************************************************/ /* Purpose: TEST01 demonstrates the use of ALOGAM. Modified: 30 January 2008 Author: John Burkardt */ { double fx; double fx2; int ifault; int n_data; double x; printf ( "\n" ); printf ( "TEST01:\n" ); printf ( " ALOGAM computes the logarithm of the \n" ); printf ( " Gamma function. We compare the result\n" ); printf ( " to tabulated values.\n" ); printf ( "\n" ); printf ( " X FX FX2\n" ); printf ( " (Tabulated) (ALOGAM) DIFF\n" ); printf ( "\n" ); n_data = 0; for ( ; ; ) { gamma_log_values ( &n_data, &x, &fx ); if ( n_data == 0 ) { break; } fx2 = alogam ( x, &ifault ); printf ( " %24.16e %24.16e %24.16e %10.4e\n", x, fx, fx2, r8_abs ( fx - fx2 ) ); } return; }