# include # include # include # include "besselzero.h" int main ( ); void besselzero_j_print ( ); void besselzero_y_print ( ); void timestamp ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* Purpose: besselzero_test() tests besselzero(). Licensing: This code is distributed under the MIT license. Modified: 08 June 2025 Author: John Burkardt */ { timestamp ( ); printf ( "\n" ); printf ( "besselzero_test():\n" ); printf ( " C version\n" ); printf ( " Test besselzero()\n" ); besselzero_j_print ( ); besselzero_y_print ( ); /* Terminate. */ printf ( "\n" ); printf ( "besselzero_test():\n" ); printf ( " Normal end of execution.\n" ); timestamp ( ); return 0; } /******************************************************************************/ void besselzero_j_print ( ) /******************************************************************************/ /* 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; printf ( "\n" ); printf ( "besselzero_j_print():\n" ); printf ( " Print zeros of Bessel j function.\n" ); nt = 10; z0 = ( double * ) malloc ( nt * sizeof ( double ) ); z1 = ( double * ) malloc ( nt * sizeof ( double ) ); n = 0; jn_zeros ( n, nt, z0 ); n = 1; jn_zeros ( n, nt, z1 ); printf ( "\n" ); printf ( " i J0(root i) J1(root i)\n" ); printf ( "\n" ); for ( i = 0; i < nt; i++ ) { printf ( " %2d %14.6g %14.6g\n", i, z0[i], z1[i] ); } free ( z0 ); free ( 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; printf ( "\n" ); printf ( "besselzero_y_print():\n" ); printf ( " Print zeros of Bessel y function.\n" ); nt = 10; z0 = ( double * ) malloc ( nt * sizeof ( double ) ); z1 = ( double * ) malloc ( nt * sizeof ( double ) ); n = 0; yn_zeros ( n, nt, z0 ); n = 1; yn_zeros ( n, nt, z1 ); printf ( "\n" ); printf ( " i Y0(root i) Y1(root i)\n" ); printf ( "\n" ); for ( i = 0; i < nt; i++ ) { printf ( " %2d %14.6g %14.6g\n", i, z0[i], z1[i] ); } free ( z0 ); free ( z1 ); return; } /******************************************************************************/ void timestamp ( ) /******************************************************************************/ /* Purpose: timestamp() prints the current YMDHMS date as a time stamp. Example: 17 June 2014 09:45:54 AM Licensing: This code is distributed under the MIT license. Modified: 01 May 2021 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 ); printf ( "%s\n", time_buffer ); return; # undef TIME_SIZE }