# include # include # include # include using namespace std; # include "besselzero.hpp" int main ( ); void besselzero_j_print ( ); void besselzero_y_print ( ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // besselzero_test() tests besselzero(). // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 08 June 2025 // // Author: // // John Burkardt // { timestamp ( ); cout << "\n"; cout << "besselzero_test():\n"; cout << " C version\n"; cout << " Test besselzero()\n"; besselzero_j_print ( ); besselzero_y_print ( ); // // Terminate. // cout << "\n"; cout << "besselzero_test():\n"; cout << " Normal end of execution.\n"; timestamp ( ); return 0; } //****************************************************************************80 void besselzero_j_print ( ) //****************************************************************************80 // // Purpose: // // besselzero_j_print() tests jn_zeros() for the Bessel J function. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 08 June 2025 // // Author: // // John Burkardt // { int i; int n; int nt; double *z0; double *z1; cout << "\n"; cout << "besselzero_j_print():\n"; cout << " Print zeros of Bessel j function.\n"; nt = 10; z0 = new double[nt]; z1 = new double[nt]; n = 0; jn_zeros ( n, nt, z0 ); n = 1; jn_zeros ( n, nt, z1 ); cout << "\n"; cout << " i J0(root i) J1(root i)\n"; cout << "\n"; for ( i = 0; i < nt; i++ ) { cout << " " << setw(2) << i << " " << setw(14) << z0[i] << " " << setw(14) << z1[i] << "\n"; } delete [] z0; delete [] z1; return; } /******************************************************************************/ void besselzero_y_print ( ) /******************************************************************************/ /* Purpose: besselzero_y_print() tests besselzero() for the Bessel Y function. Licensing: This code is distributed under the MIT license. Modified: 08 June 2025 Author: John Burkardt */ { int i; int n; int nt; double *z0; double *z1; cout << "\n"; cout << "besselzero_y_print():\n"; cout << " Print zeros of Bessel y function.\n"; nt = 10; z0 = new double[nt]; z1 = new double[nt]; n = 0; yn_zeros ( n, nt, z0 ); n = 1; yn_zeros ( n, nt, z1 ); cout << "\n"; cout << " i Y0(root i) Y1(root i)\n"; cout << "\n"; for ( i = 0; i < nt; i++ ) { cout << " " << setw(2) << i << " " << setw(14) << z0[i] << " " << setw(14) << z1[i] << "\n"; } delete [] z0; delete [] z1; return; } //****************************************************************************80 void timestamp ( ) //****************************************************************************80 // // Purpose: // // timestamp() prints the current YMDHMS date as a time stamp. // // Example: // // 31 May 2001 09:45:54 AM // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 19 March 2018 // // Author: // // John Burkardt // { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct std::tm *tm_ptr; std::time_t now; now = std::time ( NULL ); tm_ptr = std::localtime ( &now ); std::strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm_ptr ); std::cout << time_buffer << "\n"; return; # undef TIME_SIZE }