22 January 2017 12:06:38 PM SUBPAK_PRB C version Test the SUBPAK library. ANGLE_SHIFT_TEST ANGLE_SHIFT shifts an angle by multiples of 2 Pi until it lies between BETA and BETA+2Pi. ALPHA BETA GAMMA BETA+2Pi -7.08 11.47 11.77 17.75 8.28 1.55 2.00 7.83 -2.13 -10.90 -8.41 -4.62 -6.09 -9.80 -6.09 -3.52 -11.46 3.37 7.38 9.65 -11.01 -1.27 1.55 5.01 -2.48 6.40 10.09 12.68 7.47 -12.52 -11.38 -6.24 9.99 -3.75 -2.58 2.53 -10.19 -12.22 -10.19 -5.94 ANGLE_SHIFT_DEG_TEST ANGLE_SHIFT_DEG shifts an angle by multiples of 360 until it lies between BETA and BETA+360. ALPHA BETA GAMMA BETA+360 -405.48 657.10 674.52 1017.10 474.49 88.84 114.49 448.84 -121.96 -624.79 -481.96 -264.79 -349.09 -561.66 -349.09 -201.66 -656.89 192.91 423.11 552.91 -631.11 -72.66 88.89 287.34 -142.12 366.73 577.88 726.73 428.09 -717.35 -651.91 -357.35 572.41 -214.92 -147.59 145.08 -583.86 -700.39 -583.86 -340.39 TEST03 ANGLE_TO_RGB converts an angle into an RGB color. ANGLE R G B 78.63 0.60 1.00 0.00 344.27 1.00 0.00 0.21 298.62 0.96 0.00 1.00 202.21 0.00 0.54 1.00 149.51 0.00 1.00 0.41 23.80 1.00 0.32 0.00 92.73 0.37 1.00 0.00 39.58 1.00 0.57 0.00 15.78 1.00 0.21 0.00 228.23 0.00 0.16 1.00 TEST04 AXIS_LIMITS adjusts plot limits to "nicer" values. Input XMIN = 67.300000 Input XMAX = 114.700000 Input NDIVS = 6 Output PXMIN = 60.000000 Output PXMAX = 120.000000 Output PXDIV = 10.000000 Output NTICKS = 5 Input XMIN = -26.000000 Input XMAX = 26.000000 Input NDIVS = 10 Output PXMIN = -50.000000 Output PXMAX = 50.000000 Output PXDIV = 10.000000 Output NTICKS = 5 TEST05 AXIS_LIMITS computes "nice" limits for a graph that must include a given range. All tests use NDIVS = 5 XMIN XMAX PXMIN PXMAX PXDIV NTICKS 1.000000 9.000000 0.000000 10.000000 2.000000 4 1.003000 4.125000 1.000000 6.000000 1.000000 5 101.250000 193.750000 100.000000 200.000000 20.000000 4 2000.125000 2000.250000 2000.120000 2000.320000 0.040000 4 -7.000000 12.000000 -8.000000 12.000000 4.000000 4 TEST06 BAR_CHECK checks digits for a barcode; BAR_CODE computes the barcode for a string of 11 digits; BAR_DIGIT_CODE_LEFT returns the left digit code. BAR_DIGIT_CODE_RIGHT returns the right digit code. The check digit is 5 The left and right digit codes: 0 0001101 1110010 1 0011001 1100110 2 0010011 1101100 3 0111101 1000010 4 0100011 1011100 5 0110001 1001110 6 0101111 1010000 7 0111011 1000100 8 0110111 1001000 9 0001011 1110100 Bar code: 000000000 101 0001101 0011001 10100110010010011 0111101 0100011 0110001 01010 1010000 1000100 1001000 1110100 1110010 1001110 101 000000000 TEST07 BMI_ENGLISH computes the Body Mass Index given body measurements in English Units. Weight Height BMI (LB) (FT IN) 132.762745 6.000000 7.000000 14.956169 224.426385 5.000000 6.000000 36.222997 162.296062 4.000000 2.000000 45.642173 138.636669 4.000000 3.000000 37.474522 106.574350 5.000000 8.000000 16.204409 109.259084 5.000000 2.000000 19.983544 160.195942 6.000000 0.000000 21.726254 219.593043 4.000000 0.000000 67.009201 234.625609 4.000000 11.000000 47.388147 114.181713 4.000000 0.000000 34.842749 TEST08 For products of prime factors: FAC_DIV computes a quotient; FAC_MUL multiplies; FAC_LCM computes the LCM; FAC_GCD computes the GCD; I4_TO_FAC converts an integer; FAC_TO_I4 converts to an integer. FAC_TO_RAT converts to a ratio. Representation of I1 = 720 Prime Power 2 4 3 2 5 1 Representation of I2 = 42 Prime Power 2 1 3 1 7 1 LCM of I1, I2: Prime Power 2 4 3 2 5 1 7 1 GCD of I1, I2: Prime Power 2 1 3 1 Product of I1, I2: Prime Power 2 5 3 3 5 1 7 1 Quotient of I2 / I1: Prime Power 2 -3 3 -1 5 -1 7 1 Quotient as a rational: 7 / 120 TEST09 GAUSS_SUM evaluates a function which is the sum of Gaussian functions. Number of component Gaussians = 3 Center Amplitude Width X Y 0 2.00 3.00 10.00 1.00 1 5.00 8.00 5.00 2.00 2 7.00 5.00 -3.00 4.00 X Y Gauss_Sum(X,Y) 0.00 0.00 -0.029388 0.00 1.00 -0.048263 0.00 2.00 -0.012567 0.00 3.00 0.073900 0.00 4.00 -0.064255 0.00 5.00 -0.135940 0.00 6.00 -0.128237 0.00 7.00 -0.101758 0.00 8.00 -0.070295 0.00 9.00 -0.044101 0.00 10.00 -0.025860 1.00 0.00 -0.065825 1.00 1.00 -0.048943 1.00 2.00 1.173200 1.00 3.00 3.432716 1.00 4.00 1.057990 1.00 5.00 -0.239166 1.00 6.00 -0.262896 1.00 7.00 -0.174933 1.00 8.00 -0.088586 1.00 9.00 -0.045001 1.00 10.00 -0.032589 2.00 0.00 -0.130577 2.00 1.00 -0.048176 2.00 2.00 3.320561 2.00 3.00 9.511281 2.00 4.00 3.097712 2.00 5.00 -0.390133 2.00 6.00 -0.395630 2.00 7.00 -0.079310 2.00 8.00 0.168697 2.00 9.00 0.179090 2.00 10.00 0.062060 3.00 0.00 -0.230881 3.00 1.00 -0.338618 3.00 2.00 0.724746 3.00 3.00 2.822831 3.00 4.00 0.350270 3.00 5.00 -0.842388 3.00 6.00 -0.359642 3.00 7.00 0.573010 3.00 8.00 1.210563 3.00 9.00 1.026518 3.00 10.00 0.445341 4.00 0.00 -0.358276 4.00 1.00 -0.625461 4.00 2.00 -0.906097 4.00 3.00 -1.140568 4.00 4.00 -1.467084 4.00 5.00 -1.295569 4.00 6.00 -0.173238 4.00 7.00 1.701411 4.00 8.00 2.920047 4.00 9.00 2.403819 4.00 10.00 1.074225 5.00 0.00 -0.489736 5.00 1.00 -0.859468 5.00 2.00 -1.330171 5.00 3.00 -1.808706 5.00 4.00 -2.102815 5.00 5.00 -1.809384 5.00 6.00 -0.355450 5.00 7.00 2.074412 5.00 8.00 3.668758 5.00 9.00 3.034490 5.00 10.00 1.349661 6.00 0.00 -0.590735 6.00 1.00 -1.036754 6.00 2.00 -1.605303 6.00 3.00 -2.187329 6.00 4.00 -2.576169 6.00 5.00 -2.407814 6.00 6.00 -1.214967 6.00 7.00 0.837806 6.00 8.00 2.288220 6.00 9.00 1.995881 6.00 10.00 0.841789 7.00 0.00 -0.628834 7.00 1.00 -1.103630 7.00 2.00 -1.709121 7.00 3.00 -2.332851 7.00 4.00 -2.784549 7.00 5.00 -2.806129 7.00 6.00 -2.141563 7.00 7.00 -0.903878 7.00 8.00 0.130049 7.00 9.00 0.328886 7.00 10.00 0.047842 8.00 0.00 -0.590735 8.00 1.00 -1.036770 8.00 2.00 -1.605719 8.00 3.00 -2.193830 8.00 4.00 -2.637838 8.00 5.00 -2.762694 8.00 6.00 -2.453620 8.00 7.00 -1.784422 8.00 8.00 -1.078788 8.00 9.00 -0.626347 8.00 10.00 -0.396864 9.00 0.00 -0.489737 9.00 1.00 -0.859514 9.00 2.00 -1.331231 9.00 3.00 -1.819415 9.00 4.00 -2.193170 9.00 5.00 -2.326750 9.00 6.00 -2.161157 9.00 7.00 -1.748271 9.00 8.00 -1.239664 9.00 9.00 -0.788193 9.00 10.00 -0.456047 10.00 0.00 -0.358299 10.00 1.00 -0.628834 10.00 2.00 -0.973956 10.00 3.00 -1.331223 10.00 4.00 -1.605607 10.00 5.00 -1.708331 10.00 6.00 -1.602233 10.00 7.00 -1.323725 10.00 8.00 -0.964305 10.00 9.00 -0.621317 10.00 10.00 -0.354748 TEST10 GET_SEED gets a seed for the random number generator. These values are computed from the time and date. Values computed nearby in time will be near to each other, and should be passed through a random number generator a few times before use. I R(I) R2(I) R3(I) 1988361073 1391522944 1229203978 438574106 1988361073 1391522944 1229203978 438574106 1988361073 1391522944 1229203978 438574106 1988361073 1391522944 1229203978 438574106 1988361073 1391522944 1229203978 438574106 1988361073 1391522944 1229203978 438574106 1988361073 1391522944 1229203978 438574106 1988361073 1391522944 1229203978 438574106 1988361073 1391522944 1229203978 438574106 1988361073 1391522944 1229203978 438574106 TEST11 GRID1 computes a 1D grid between two DIM_NUM dimensional points X1 and X2. Here, we will use 11 steps going from: 1.000000 0.000000 20.000000 -5.000000 1.000000 to: 1.000000 10.000000 0.000000 5.000000 2.000000 The grid matrix: Row: 1 2 3 4 5 Col 1: 1.000000 0.000000 20.000000 -5.000000 1.000000 2: 1.000000 1.000000 18.000000 -4.000000 1.100000 3: 1.000000 2.000000 16.000000 -3.000000 1.200000 4: 1.000000 3.000000 14.000000 -2.000000 1.300000 5: 1.000000 4.000000 12.000000 -1.000000 1.400000 6: 1.000000 5.000000 10.000000 0.000000 1.500000 7: 1.000000 6.000000 8.000000 1.000000 1.600000 8: 1.000000 7.000000 6.000000 2.000000 1.700000 9: 1.000000 8.000000 4.000000 3.000000 1.800000 10: 1.000000 9.000000 2.000000 4.000000 1.900000 11: 1.000000 10.000000 0.000000 5.000000 2.000000 TEST12 GRID1N computes a 1D grid between two DIM_NUM dimensional points X1 and X2, one point at a time. Here, we will use 11 steps going from 1.0000 0.0000 20.0000 -5.0000 1.0000 to 1.0000 10.0000 0.0000 5.0000 2.0000 1 1.0000 0.0000 20.0000 -5.0000 1.0000 2 1.0000 1.0000 18.0000 -4.0000 1.1000 3 1.0000 2.0000 16.0000 -3.0000 1.2000 4 1.0000 3.0000 14.0000 -2.0000 1.3000 5 1.0000 4.0000 12.0000 -1.0000 1.4000 6 1.0000 5.0000 10.0000 0.0000 1.5000 7 1.0000 6.0000 8.0000 1.0000 1.6000 8 1.0000 7.0000 6.0000 2.0000 1.7000 9 1.0000 8.0000 4.0000 3.0000 1.8000 10 1.0000 9.0000 2.0000 4.0000 1.9000 11 1.0000 10.0000 0.0000 5.0000 2.0000 TEST13 GRID2 computes a 1 D grid between two DIM_NUM dimensional points X1 and X2, computing X1 and X2 at user specified times. Here, we will use 20 steps. and on step 3 we will compute 1.0000 0.0000 20.0000 -5.0000 1.0000 and on step 13 we will compute 1.0000 10.0000 0.0000 5.0000 2.0000 The grid matrix: Col: 1 2 3 4 5 Row 1: 1.000000 1.000000 1.000000 1.000000 1.000000 2: -2.000000 -1.000000 0.000000 1.000000 2.000000 3: 24.000000 22.000000 20.000000 18.000000 16.000000 4: -7.000000 -6.000000 -5.000000 -4.000000 -3.000000 5: 0.800000 0.900000 1.000000 1.100000 1.200000 Col: 6 7 8 9 10 Row 1: 1.000000 1.000000 1.000000 1.000000 1.000000 2: 3.000000 4.000000 5.000000 6.000000 7.000000 3: 14.000000 12.000000 10.000000 8.000000 6.000000 4: -2.000000 -1.000000 0.000000 1.000000 2.000000 5: 1.300000 1.400000 1.500000 1.600000 1.700000 Col: 11 12 13 14 15 Row 1: 1.000000 1.000000 1.000000 1.000000 1.000000 2: 8.000000 9.000000 10.000000 11.000000 12.000000 3: 4.000000 2.000000 0.000000 -2.000000 -4.000000 4: 3.000000 4.000000 5.000000 6.000000 7.000000 5: 1.800000 1.900000 2.000000 2.100000 2.200000 Col: 16 17 18 19 20 Row 1: 1.000000 1.000000 1.000000 1.000000 1.000000 2: 13.000000 14.000000 15.000000 16.000000 17.000000 3: -6.000000 -8.000000 -10.000000 -12.000000 -14.000000 4: 8.000000 9.000000 10.000000 11.000000 12.000000 5: 2.300000 2.400000 2.500000 2.600000 2.700000 TEST14 GRID2N computes points from a 1D grid between two DIM_NUM dimensional points X1 and X2, one at a time, with X1 and X2 having user specified J coordinates. On step 3 we will compute 1.000000 0.000000 20.000000 -5.000000 1.000000 and on step 13 we will compute 1.0000 10.0000 0.0000 5.0000 2.0000 1 1.0000 -2.0000 24.0000 -7.0000 0.8000 2 1.0000 -1.0000 22.0000 -6.0000 0.9000 3 1.0000 0.0000 20.0000 -5.0000 1.0000 4 1.0000 1.0000 18.0000 -4.0000 1.1000 5 1.0000 2.0000 16.0000 -3.0000 1.2000 6 1.0000 3.0000 14.0000 -2.0000 1.3000 7 1.0000 4.0000 12.0000 -1.0000 1.4000 8 1.0000 5.0000 10.0000 0.0000 1.5000 9 1.0000 6.0000 8.0000 1.0000 1.6000 10 1.0000 7.0000 6.0000 2.0000 1.7000 11 1.0000 8.0000 4.0000 3.0000 1.8000 12 1.0000 9.0000 2.0000 4.0000 1.9000 13 1.0000 10.0000 0.0000 5.0000 2.0000 14 1.0000 11.0000 -2.0000 6.0000 2.1000 15 1.0000 12.0000 -4.0000 7.0000 2.2000 16 1.0000 13.0000 -6.0000 8.0000 2.3000 17 1.0000 14.0000 -8.0000 9.0000 2.4000 18 1.0000 15.0000 -10.0000 10.0000 2.5000 19 1.0000 16.0000 -12.0000 11.0000 2.6000 20 1.0000 17.0000 -14.0000 12.0000 2.7000 TEST15 GRID3 computes a 2D grid in the plane containing the DIM_NUM-dimensional points X1, X2 and X3. Here, we will use 3 steps going from 1.000000 0.000000 20.000000 -5.000000 1.000000 to 1.000000 10.000000 0.000000 5.000000 2.000000 and 6 steps going to 1.000000 5.000000 0.000000 0.000000 3.000000 1 1 1.000000 0.000000 20.000000 -5.000000 1.000000 1 2 1.000000 0.000000 20.000000 -5.000000 1.000000 1 3 1.000000 0.000000 20.000000 -5.000000 1.000000 1 4 1.000000 0.000000 20.000000 -5.000000 1.000000 1 5 1.000000 0.000000 20.000000 -5.000000 1.000000 1 6 1.000000 0.000000 20.000000 -5.000000 1.000000 2 1 1.000000 5.000000 10.000000 0.000000 1.500000 2 2 1.000000 6.000000 6.000000 1.000000 1.900000 2 3 1.000000 7.000000 2.000000 2.000000 2.300000 2 4 1.000000 8.000000 -2.000000 3.000000 2.700000 2 5 1.000000 9.000000 -6.000000 4.000000 3.100000 2 6 1.000000 10.000000 -10.000000 5.000000 3.500000 3 1 1.000000 10.000000 0.000000 5.000000 2.000000 3 2 1.000000 12.000000 -8.000000 7.000000 2.800000 3 3 1.000000 14.000000 -16.000000 9.000000 3.600000 3 4 0.000000 0.000000 0.000000 0.000000 0.000000 3 5 0.000000 0.000000 0.000000 0.000000 0.000000 3 6 0.000000 0.000000 0.000000 0.000000 0.000000 TEST16 GRID3N computes a point from a 2D grid in the plane containing the DIM_NUM-dimensional points X1, X2 and X3. We use 3 steps from 1.000000 0.000000 20.000000 -5.000000 1.000000 to 1.000000 10.000000 0.000000 5.000000 2.000000 and 6 steps going to 1.000000 5.000000 0.000000 0.000000 3.000000 1 1 1.000000 0.000000 20.000000 -5.000000 1.000000 1 2 1.000000 1.000000 16.000000 -4.000000 1.400000 1 3 1.000000 2.000000 12.000000 -3.000000 1.800000 1 4 1.000000 3.000000 8.000000 -2.000000 2.200000 1 5 1.000000 4.000000 4.000000 -1.000000 2.600000 1 6 1.000000 5.000000 0.000000 0.000000 3.000000 2 1 1.000000 5.000000 10.000000 0.000000 1.500000 2 2 1.000000 6.000000 6.000000 1.000000 1.900000 2 3 1.000000 7.000000 2.000000 2.000000 2.300000 2 4 1.000000 8.000000 -2.000000 3.000000 2.700000 2 5 1.000000 9.000000 -6.000000 4.000000 3.100000 2 6 1.000000 10.000000 -10.000000 5.000000 3.500000 3 1 1.000000 10.000000 0.000000 5.000000 2.000000 3 2 1.000000 11.000000 -4.000000 6.000000 2.400000 3 3 1.000000 12.000000 -8.000000 7.000000 2.800000 3 4 1.000000 13.000000 -12.000000 8.000000 3.200000 3 5 1.000000 14.000000 -16.000000 9.000000 3.600000 3 6 1.000000 15.000000 -20.000000 10.000000 4.000000 TEST17 GRID4 computes a 2D planar grid containing the DIM_NUM-dimensional points X1, X2 and X3. We compute the points on the following steps: X1 on step 2 3 X2 on step 5 3 X3 on step 2 9 We use 6 steps in the J direction and 10 steps in the K direction. The points X1, X2 and X3 are: 1.000000 0.000000 20.000000 -5.000000 1.000000 1.000000 10.000000 0.000000 5.000000 2.000000 1.000000 5.000000 0.000000 0.000000 3.000000 1 1 1.000000 -0.833333 23.333333 -5.833333 0.666667 1 2 1.000000 0.000000 20.000000 -5.000000 1.000000 1 3 1.000000 0.833333 16.666667 -4.166667 1.333333 1 4 1.000000 1.666667 13.333333 -3.333333 1.666667 1 5 1.000000 2.500000 10.000000 -2.500000 2.000000 1 6 1.000000 3.333333 6.666667 -1.666667 2.333333 1 7 1.000000 4.166667 3.333333 -0.833333 2.666667 1 8 1.000000 5.000000 0.000000 0.000000 3.000000 1 9 1.000000 5.833333 -3.333333 0.833333 3.333333 1 10 0.000000 0.000000 0.000000 0.000000 0.000000 2 1 1.000000 2.500000 16.666667 -2.500000 1.000000 2 2 1.000000 3.333333 13.333333 -1.666667 1.333333 2 3 1.000000 4.166667 10.000000 -0.833333 1.666667 2 4 1.000000 5.000000 6.666667 -0.000000 2.000000 2 5 1.000000 5.833333 3.333333 0.833333 2.333333 2 6 1.000000 6.666667 0.000000 1.666667 2.666667 2 7 1.000000 7.500000 -3.333333 2.500000 3.000000 2 8 1.000000 8.333333 -6.666667 3.333333 3.333333 2 9 1.000000 9.166667 -10.000000 4.166667 3.666667 2 10 0.000000 0.000000 0.000000 0.000000 0.000000 3 1 1.000000 5.833333 10.000000 0.833333 1.333333 3 2 1.000000 6.666667 6.666667 1.666667 1.666667 3 3 1.000000 7.500000 3.333333 2.500000 2.000000 3 4 1.000000 8.333333 0.000000 3.333333 2.333333 3 5 1.000000 9.166667 -3.333333 4.166667 2.666667 3 6 1.000000 10.000000 -6.666667 5.000000 3.000000 3 7 1.000000 10.833333 -10.000000 5.833333 3.333333 3 8 1.000000 11.666667 -13.333333 6.666667 3.666667 3 9 1.000000 12.500000 -16.666667 7.500000 4.000000 3 10 0.000000 0.000000 0.000000 0.000000 0.000000 4 1 1.000000 9.166667 3.333333 4.166667 1.666667 4 2 1.000000 10.000000 0.000000 5.000000 2.000000 4 3 1.000000 10.833333 -3.333333 5.833333 2.333333 4 4 1.000000 11.666667 -6.666667 6.666667 2.666667 4 5 1.000000 12.500000 -10.000000 7.500000 3.000000 4 6 1.000000 13.333333 -13.333333 8.333333 3.333333 4 7 1.000000 14.166667 -16.666667 9.166667 3.666667 4 8 1.000000 15.000000 -20.000000 10.000000 4.000000 4 9 1.000000 15.833333 -23.333333 10.833333 4.333333 4 10 0.000000 0.000000 0.000000 0.000000 0.000000 5 1 1.000000 12.500000 -3.333333 7.500000 2.000000 5 2 1.000000 13.333333 -6.666667 8.333333 2.333333 5 3 1.000000 14.166667 -10.000000 9.166667 2.666667 5 4 1.000000 15.000000 -13.333333 10.000000 3.000000 5 5 1.000000 15.833333 -16.666667 10.833333 3.333333 5 6 1.000000 16.666667 -20.000000 11.666667 3.666667 5 7 1.000000 17.500000 -23.333333 12.500000 4.000000 5 8 1.000000 18.333333 -26.666667 13.333333 4.333333 5 9 1.000000 19.166667 -30.000000 14.166667 4.666667 5 10 0.000000 0.000000 0.000000 0.000000 0.000000 6 1 1.000000 -3.333333 26.666667 -8.333333 0.666667 6 2 1.000000 -2.500000 23.333333 -7.500000 1.000000 6 3 1.000000 -1.666667 20.000000 -6.666667 1.333333 6 4 1.000000 -0.833333 16.666667 -5.833333 1.666667 6 5 1.000000 0.000000 13.333333 -5.000000 2.000000 6 6 1.000000 0.833333 10.000000 -4.166667 2.333333 6 7 1.000000 1.666667 6.666667 -3.333333 2.666667 6 8 1.000000 2.500000 3.333333 -2.500000 3.000000 6 9 0.000000 0.000000 0.000000 0.000000 0.000000 6 10 0.000000 0.000000 0.000000 0.000000 0.000000 TEST18 GRID4N computes, one at a time, points on a 2D grid in the plane containing the DIM_NUM-dimensional points X1, X2 and X3. We compute the points on the following steps: X1 on step 2 3 X2 on step 5 3 X3 on step 2 9 We use 6 steps in the J direction and 10 steps in the K direction. The points X1, X2 and X3 are: 1.000000 0.000000 20.000000 -5.000000 1.000000 1.000000 10.000000 0.000000 5.000000 2.000000 1.000000 5.000000 0.000000 0.000000 3.000000 1 1 1.000000 -5.000000 33.333333 -10.000000 -0.000000 1 2 1.000000 -4.166667 30.000000 -9.166667 0.333333 1 3 1.000000 -3.333333 26.666667 -8.333333 0.666667 1 4 1.000000 -2.500000 23.333333 -7.500000 1.000000 1 5 1.000000 -1.666667 20.000000 -6.666667 1.333333 1 6 1.000000 -0.833333 16.666667 -5.833333 1.666667 1 7 1.000000 0.000000 13.333333 -5.000000 2.000000 1 8 1.000000 0.833333 10.000000 -4.166667 2.333333 1 9 1.000000 1.666667 6.666667 -3.333333 2.666667 1 10 1.000000 2.500000 3.333333 -2.500000 3.000000 2 1 1.000000 -1.666667 26.666667 -6.666667 0.333333 2 2 1.000000 -0.833333 23.333333 -5.833333 0.666667 2 3 1.000000 0.000000 20.000000 -5.000000 1.000000 2 4 1.000000 0.833333 16.666667 -4.166667 1.333333 2 5 1.000000 1.666667 13.333333 -3.333333 1.666667 2 6 1.000000 2.500000 10.000000 -2.500000 2.000000 2 7 1.000000 3.333333 6.666667 -1.666667 2.333333 2 8 1.000000 4.166667 3.333333 -0.833333 2.666667 2 9 1.000000 5.000000 0.000000 0.000000 3.000000 2 10 1.000000 5.833333 -3.333333 0.833333 3.333333 3 1 1.000000 1.666667 20.000000 -3.333333 0.666667 3 2 1.000000 2.500000 16.666667 -2.500000 1.000000 3 3 1.000000 3.333333 13.333333 -1.666667 1.333333 3 4 1.000000 4.166667 10.000000 -0.833333 1.666667 3 5 1.000000 5.000000 6.666667 -0.000000 2.000000 3 6 1.000000 5.833333 3.333333 0.833333 2.333333 3 7 1.000000 6.666667 0.000000 1.666667 2.666667 3 8 1.000000 7.500000 -3.333333 2.500000 3.000000 3 9 1.000000 8.333333 -6.666667 3.333333 3.333333 3 10 1.000000 9.166667 -10.000000 4.166667 3.666667 4 1 1.000000 5.000000 13.333333 -0.000000 1.000000 4 2 1.000000 5.833333 10.000000 0.833333 1.333333 4 3 1.000000 6.666667 6.666667 1.666667 1.666667 4 4 1.000000 7.500000 3.333333 2.500000 2.000000 4 5 1.000000 8.333333 0.000000 3.333333 2.333333 4 6 1.000000 9.166667 -3.333333 4.166667 2.666667 4 7 1.000000 10.000000 -6.666667 5.000000 3.000000 4 8 1.000000 10.833333 -10.000000 5.833333 3.333333 4 9 1.000000 11.666667 -13.333333 6.666667 3.666667 4 10 1.000000 12.500000 -16.666667 7.500000 4.000000 5 1 1.000000 8.333333 6.666667 3.333333 1.333333 5 2 1.000000 9.166667 3.333333 4.166667 1.666667 5 3 1.000000 10.000000 0.000000 5.000000 2.000000 5 4 1.000000 10.833333 -3.333333 5.833333 2.333333 5 5 1.000000 11.666667 -6.666667 6.666667 2.666667 5 6 1.000000 12.500000 -10.000000 7.500000 3.000000 5 7 1.000000 13.333333 -13.333333 8.333333 3.333333 5 8 1.000000 14.166667 -16.666667 9.166667 3.666667 5 9 1.000000 15.000000 -20.000000 10.000000 4.000000 5 10 1.000000 15.833333 -23.333333 10.833333 4.333333 6 1 1.000000 11.666667 0.000000 6.666667 1.666667 6 2 1.000000 12.500000 -3.333333 7.500000 2.000000 6 3 1.000000 13.333333 -6.666667 8.333333 2.333333 6 4 1.000000 14.166667 -10.000000 9.166667 2.666667 6 5 1.000000 15.000000 -13.333333 10.000000 3.000000 6 6 1.000000 15.833333 -16.666667 10.833333 3.333333 6 7 1.000000 16.666667 -20.000000 11.666667 3.666667 6 8 1.000000 17.500000 -23.333333 12.500000 4.000000 6 9 1.000000 18.333333 -26.666667 13.333333 4.333333 6 10 1.000000 19.166667 -30.000000 14.166667 4.666667 TEST19 INDEX1_COL column indexes a 1D array, INDEX1_ROW row indexes a 1D array, and there are several more versions of these functions. By COLS: Imin I Imax Xmin Index 1 3 5 INDEX1_COL 0 2 INDEXN_COL 0 2 1 3 5 1 2 4 INDEX2_COL 0 7 INDEXN_COL 0 7 1 3 5 1 2 4 1 1 3 INDEX3_COL 0 7 INDEXN_COL 0 7 1 3 5 1 2 4 1 1 3 1 2 2 INDEX4_COL 0 67 INDEXN_COL 0 67 By ROWS: Imin I Imax Xmin Index 1 3 5 INDEX1_ROW 0 2 INDEXN_ROW 0 2 1 3 5 1 2 4 INDEX2_ROW 0 9 INDEXN_ROW 0 9 1 3 5 1 2 4 1 1 3 INDEX3_ROW 0 27 INDEXN_ROW 0 27 1 3 5 1 2 4 1 1 3 1 2 2 INDEX4_ROW 0 55 INDEXN_ROW 0 55 TEST22 LCM_12N computes the least common multiple of the integers 1 through N. N LCM_12N ( N ) 1 1 2 2 3 6 4 12 5 60 6 60 7 420 8 420 9 1260 10 1260 11 13860 12 13860 TEST24 PERM_INVERSE inverts a permutation in place; The original permutation: 1 2 3 4 5 6 7 4 3 5 1 7 6 2 The inverted permutation: 1 2 3 4 5 6 7 4 7 2 1 3 6 5 TEST25 PRIME_GE returns the smallest prime number greater than or equal to N. N PRIME_GE 1 2 2 2 3 3 4 5 5 5 6 7 7 7 8 11 9 11 10 11 TEST26 RANDOM_INITIALIZE can make up a seed for the C random number generator RANDOM, or use a single SEED value from the user. Calling RANDOM_INITIALIZE with a zero input value of SEED tells the routine to make up a seed. And, at least for calls a few milliseconds apart, the output SEED should be different. In any case, if RANDOM is restarted by calling RANDOM_INITIALIZE with a nonzero input SEED, then the random number sequence should repeat. Call RANDOM_INITIALIZE 10 times, with a zero input SEED. Also, get the first three real random values. SEED_IN SEED_OUT Random 1, 2, 3 0 1988361073 0.801906 0.792951 0.203306 0 1988361073 0.801906 0.792951 0.203306 0 1988361073 0.801906 0.792951 0.203306 0 1988361073 0.801906 0.792951 0.203306 0 1988361073 0.801906 0.792951 0.203306 0 1988361073 0.801906 0.792951 0.203306 0 1988361073 0.801906 0.792951 0.203306 0 1988361073 0.801906 0.792951 0.203306 0 1988361073 0.801906 0.792951 0.203306 0 1988361073 0.801906 0.792951 0.203306 Now call RANDOM_INITIALIZE with SEED = 5, 95, 5, 95. We promise the random numbers will repeat the second time. SEED_IN SEED_OUT Random 1, 2, 3 5 5 0.274746 0.046468 0.992755 95 95 0.525153 0.220240 0.227755 5 5 0.274746 0.046468 0.992755 95 95 0.525153 0.220240 0.227755 TEST27 RANDOM is an intrinsic C routine to computer uniform random numbers. Using initial random number seed = 123456789 Test #1: Call 5 times, 1 value each time. 1 0.915072 2 0.763557 3 0.329076 4 0.897144 5 0.033173 Test #2: Restore the random number seed. Call 5 times, 1 value each time. The results should be identical. 1 0.915072 2 0.763557 3 0.329076 4 0.897144 5 0.033173 Test #5: Number of samples was 1000 Minimum value was 0.000077 Maximum value was 0.998093 Average value was 0.502692 Variance was 0.078269 Expected average 0.500000 Expected variance 0.083333 TEST29 RAT_FACTOR factors a rational value. Rational value is 1638 / 12 Prime representation: I, FACTOR(I), POWER(I) 1 2 -1 2 3 1 3 7 1 4 13 1 TEST30 ROOTS_TO_R8POLY computes the coefficients of a polynomial from its roots. R8POLY_PRINT prints a polynomial. Roots: 0: 1.000000 1: 2.000000 2: 3.000000 3: 4.000000 The polynomial p(x) = 1.000000 * x^4 -10.000000 * x^3 +35.000000 * x^2 -50.000000 * x +24.000000 TEST31 SORT_HEAP_EXTERNAL sorts objects externally. Unsorted array: 0: 5 1: 20 2: 17 3: 12 4: 9 5: 2 6: 6 7: 3 8: 1 9: 13 10: 2 11: 9 12: 9 13: 16 14: 16 15: 1 16: 18 17: 8 18: 2 19: 1 Sorted array: 0: 5 1: 1 2: 1 3: 1 4: 2 5: 2 6: 2 7: 3 8: 6 9: 8 10: 9 11: 9 12: 9 13: 12 14: 13 15: 16 16: 16 17: 17 18: 18 19: 20 TEST32 For evenly spaced angles between 0 and 2*PI: TVEC_EVEN TVEC_EVEN2 TVEC_EVEN3 TVEC_EVEN 0: 0.000000 1: 1.570796 2: 3.141593 3: 4.712389 TVEC_EVEN2 0: 0.785398 1: 2.356194 2: 3.926991 3: 5.497787 TVEC_EVEN3 0: 0.000000 1: 2.094395 2: 4.188790 3: 6.283185 TEST33 For evenly spaced angles between THETA1 and THETA2: TVEC_EVEN_BRACKET TVEC_EVEN_BRACKET2. TVEC_EVEN_BRACKET3. NT = 4 THETA1 = 30.000000 THETA2 = 90.000000 TVEC_BRACKET 0: 30.000000 1: 50.000000 2: 70.000000 3: 90.000000 NT = 5 THETA1 = 30.000000 THETA2 = 90.000000 TVEC_EVEN_BRACKET2 0: 40.000000 1: 50.000000 2: 60.000000 3: 70.000000 4: 80.000000 NT = 3 THETA1 = 30.000000 THETA2 = 90.000000 TVEC_EVEN_BRACKET3 0: 40.000000 1: 60.000000 2: 80.000000 TEST35 VERSINE_PULSE adds a versine pulse to a constant signal. 0 0.000000 1.000000 1 0.100000 1.000000 2 0.200000 1.000000 3 0.300000 1.000000 4 0.400000 1.000000 5 0.500000 1.000000 6 0.600000 1.000000 7 0.700000 1.000000 8 0.800000 1.000000 9 0.900000 1.000000 10 1.000000 1.000000 11 1.100000 1.000000 12 1.200000 1.000000 13 1.300000 1.000000 14 1.400000 1.000000 15 1.500000 1.000000 16 1.600000 1.000000 17 1.700000 1.000000 18 1.800000 1.000000 19 1.900000 1.000000 20 2.000000 1.000000 21 2.100000 1.073415 22 2.200000 1.286475 23 2.300000 1.618322 24 2.400000 2.036475 25 2.500000 2.500000 26 2.600000 2.963525 27 2.700000 3.381678 28 2.800000 3.713525 29 2.900000 3.926585 30 3.000000 4.000000 31 3.100000 3.926585 32 3.200000 3.713525 33 3.300000 3.381678 34 3.400000 2.963525 35 3.500000 2.500000 36 3.600000 2.036475 37 3.700000 1.618322 38 3.800000 1.286475 39 3.900000 1.073415 40 4.000000 1.000000 41 4.100000 1.000000 42 4.200000 1.000000 43 4.300000 1.000000 44 4.400000 1.000000 45 4.500000 1.000000 46 4.600000 1.000000 47 4.700000 1.000000 48 4.800000 1.000000 49 4.900000 1.000000 50 5.000000 1.000000 51 5.100000 1.000000 52 5.200000 1.000000 53 5.300000 1.000000 54 5.400000 1.000000 55 5.500000 1.000000 56 5.600000 1.000000 57 5.700000 1.000000 58 5.800000 1.000000 59 5.900000 1.000000 60 6.000000 1.000000 61 6.100000 1.000000 62 6.200000 1.000000 63 6.300000 1.000000 64 6.400000 1.000000 65 6.500000 1.000000 66 6.600000 1.000000 67 6.700000 1.000000 68 6.800000 1.000000 69 6.900000 1.000000 70 7.000000 1.000000 71 7.100000 1.000000 72 7.200000 1.000000 73 7.300000 1.000000 74 7.400000 1.000000 75 7.500000 1.000000 76 7.600000 1.000000 77 7.700000 1.000000 78 7.800000 1.000000 79 7.900000 1.000000 80 8.000000 1.000000 81 8.100000 1.000000 82 8.200000 1.000000 83 8.300000 1.000000 84 8.400000 1.000000 85 8.500000 1.000000 86 8.600000 1.000000 87 8.700000 1.000000 88 8.800000 1.000000 89 8.900000 1.000000 90 9.000000 1.000000 91 9.100000 1.000000 92 9.200000 1.000000 93 9.300000 1.000000 94 9.400000 1.000000 95 9.500000 1.000000 96 9.600000 1.000000 97 9.700000 1.000000 98 9.800000 1.000000 99 9.900000 1.000000 100 10.000000 1.000000 SUBPAK_PRB Normal end of execution. 22 January 2017 12:06:38 PM