# include # include # include # include using namespace std; # include "besselj.hpp" int main ( ); void rjbesl_test ( ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // besselj_test() tests besselj(). // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 15 January 2016 // // Author: // // John Burkardt // { timestamp ( ); cout << "\n"; cout << "besselj_test():\n"; cout << " C++ version,\n"; cout << " Test besselj().\n"; rjbesl_test ( ); // // Terminate. // cout << "\n"; cout << "besselj_test():\n"; cout << " Normal end of execution.\n"; cout << "\n"; timestamp ( ); return 0; } //****************************************************************************80 void rjbesl_test ( ) //****************************************************************************80 // // Purpose: // // RJBESL_TEST tests RJBESL. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 15 January 2016 // // Author: // // John Burkardt // { double alpha; double *b; double fx; int n; int n_data; int nb; int ncalc; double order; double x; cout << "\n"; cout << "RJBESL_TEST:\n"; cout << " RJBESL computes the Bessel Jn function for NONINTEGER order.\n"; cout << "\n"; cout << " ORDER X FX FX\n"; cout << " exact computed\n"; cout << "\n"; n_data = 0; for ( ; ; ) { bessel_jx_values ( n_data, order, x, fx ); if ( n_data == 0 ) { break; } n = ( int ) ( order ); alpha = order - ( double ) ( n ); nb = n + 1; b = new double[nb]; rjbesl ( x, alpha, nb, b, ncalc ); cout << " " << setw(12) << order << " " << setw(12) << x << " " << setw(24) << setprecision ( 16 ) << fx << " " << setw(24) << setprecision ( 16 ) << b[n] << "\n"; delete [] b; } return; } //****************************************************************************80 void timestamp ( ) //****************************************************************************80 // // Purpose: // // TIMESTAMP prints the current YMDHMS date as a time stamp. // // Example: // // May 31 2001 09:45:54 AM // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 24 September 2003 // // Author: // // John Burkardt // { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct tm *tm; time_t now; now = time ( NULL ); tm = localtime ( &now ); strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm ); cout << time_buffer << "\n"; return; # undef TIME_SIZE }