home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / c / other / learn / bessel.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-25  |  767 b   |  25 lines

  1. /* BESSEL.C illustrates Bessel functions including:
  2.  *      j0          j1          jn          y0          y1          yn
  3.  */
  4.  
  5. #include <math.h>
  6. #include <stdio.h>
  7.  
  8. main()
  9. {
  10.     double x = 2.387;
  11.     int n = 3, c;
  12.  
  13.     printf( "Bessel functions for x = %f:\n", x );
  14.     printf( "  Kind\t\tOrder\t\Function\tResult\n\n" );
  15.     printf( "  First\t\t0\tj0( x )\t\t%f\n", j0( x ) );
  16.     printf( "  First\t\t1\tj1( x )\t\t%f\n", j1( x ) );
  17.     for( c = 2; c < 10; c++ )
  18.         printf( "  First\t\t%d\tjn( n, x )\t%f\n", c, jn( c, x ) );
  19.  
  20.     printf( "  Second\t0\ty0( x )\t\t%f\n", y0( x ) );
  21.     printf( "  Second\t1\ty1( x )\t\t%f\n", y1( x ) );
  22.     for( c = 2; c < 10; c++ )
  23.         printf( "  Second\t%d\tyn( n, x )\t%f\n", c, yn( c, x ) );
  24. }
  25.