"Fossies" - the Fresh Open Source Software Archive

Member "ccmath-2.2.1/sfunc/test/trcbes.c" (21 Nov 2000, 2425 Bytes) of package /linux/misc/old/ccmath-2.2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*  trcbes.c    CCMATH mathematics library source code.
    2  *
    3  *  Copyright (C)  2000   Daniel A. Atkinson    All rights reserved.
    4  *  This code may be redistributed under the terms of the GNU library
    5  *  public license (LGPL). ( See the lgpl.license file for details.)
    6  * ------------------------------------------------------------------------
    7  */
    8 /*
    9     Test:  rcbes  setrcb
   10 
   11     Uses:  (implicit) jbes  nbes  ibes  kbes
   12 
   13 */
   14 #include "ccmath.h"
   15 #include <math.h>
   16 void main(void)
   17 { double v,x,f[10]; int i,j;
   18   char ty[2],dr[2];
   19   for(j=0; j<4 ;++j){
   20     switch(j){
   21       case 0: printf(" J(v,x)\n");
   22               ty[0]='j'; dr[0]='d'; x=2.; v=10.4; break;
   23       case 1: printf(" I(v,x)\n");
   24               ty[0]='i'; dr[0]='d'; x=2.5; v=12.2; break;
   25       case 2: printf(" Y(v,x)\n");
   26               ty[0]='y'; dr[0]='u'; x=5.1; v=1.4; break;
   27       case 3: printf(" K(v,x)\n");
   28               ty[0]='k'; dr[0]='u'; x=3.5; v=2.3; break;
   29      }
   30     printf("  argument x= %.4f\n",x);
   31 
   32 /* initialize recursion */
   33     setrcb(v,x,ty[0],dr[0],f,f+1);
   34 
   35     for(i=0; i<9 ;++i){
   36 
   37 /* recursive computation of Bessel functions */
   38       if(i>=2) f[i]=rcbes();
   39       printf(" %6.2f  %20.12f\n",v,f[i]);
   40       if(dr[0]=='u') v+=1.; else v-=1.;
   41      }
   42     printf("\n");
   43    }
   44 }
   45 /*  Test output
   46 
   47  J(v,x)
   48   argument x= 2.0000
   49   10.40        0.000000097768
   50    9.40        0.000001008154
   51    8.40        0.000009378876
   52    7.40        0.000077774404
   53    6.40        0.000566151710
   54    5.40        0.003545596542
   55    4.40        0.018580069614
   56    3.40        0.078206709761
   57    2.40        0.247322743574
   58 
   59  I(v,x)
   60   argument x= 2.5000
   61   12.20        0.000000021531
   62   11.20        0.000000212165
   63   10.20        0.000001922531
   64    9.20        0.000015900019
   65    8.20        0.000118946674
   66    7.20        0.000796190200
   67    6.20        0.004705002227
   68    5.20        0.024133001245
   69    4.20        0.105098287408
   70 
   71  Y(v,x)
   72   argument x= 5.1000
   73    1.40        0.272244667311
   74    2.40        0.329761926063
   75    3.40        0.038119498395
   76    4.40       -0.278935928203
   77    5.40       -0.519420707843
   78    6.40       -0.821013806054
   79    7.40       -1.541162962252
   80    8.40       -3.651380672638
   81    9.40      -10.486914547616
   82 
   83  K(v,x)
   84   argument x= 3.5000
   85    2.30        0.037839743370
   86    3.30        0.073984294366
   87    4.30        0.177352984175
   88    5.30        0.509765912625
   89    6.30        1.721215462410
   90    7.30        6.706141577300
   91    8.30       29.695406042003
   92    9.30      147.547210233658
   93   10.30      813.803437569441
   94 
   95 */