22-Sep-2024 20:10:54 subpak_test(): MATLAB/Octave version 6.4.0 Test subpak() ANGLES_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 5.447623 11.857434 18.013994 18.140620 4.881367 -3.059300 -1.401819 3.223885 -2.593640 8.843980 9.972730 15.127165 7.683785 -2.871791 1.400599 3.411394 -11.317248 4.138070 7.532308 10.421255 -3.072553 -10.238326 -9.355738 -3.955141 10.042668 -10.311713 -8.806888 -4.028528 -5.159611 -11.460371 -11.442797 -5.177185 -9.169980 -1.316868 3.396391 4.966318 3.446173 -10.827445 -9.120197 -4.544260 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 -270.192229 -648.862986 -630.192229 -288.862986 44.265167 -608.801716 -315.734833 -248.801716 -670.227338 -151.065028 49.772662 208.934972 418.366092 -526.581089 -301.633908 -166.581089 682.157184 354.294227 682.157184 714.294227 48.152741 703.885713 768.152741 1063.885713 65.821655 605.316856 785.821655 965.316856 -495.954670 -178.027151 -135.954670 181.972849 520.922638 -393.321174 -199.077362 -33.321174 643.873111 -351.644009 -76.126889 8.355991 SUBPAK_TEST03 ANGLE_TO_RGB converts an angle into an RGB color. ANGLE R G B 231.576749 0.000000 0.110709 1.000000 111.249028 0.115054 1.000000 0.000000 222.398517 0.000000 0.234568 1.000000 67.945684 0.810962 1.000000 0.000000 2.036205 1.000000 0.026660 0.000000 236.015073 0.000000 0.052210 1.000000 22.240042 1.000000 0.299635 0.000000 299.003497 0.974246 0.000000 1.000000 72.997296 0.706783 1.000000 0.000000 340.292618 1.000000 0.000000 0.263848 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 SUBPAK_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 -20.000000 30.000000 10.000000 5 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 0010011 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) 220.435386 6.000000 3.000000 27.552253 169.139959 5.000000 -3.000000 36.601160 148.999111 5.000000 -1.000000 30.093866 196.568102 4.000000 1.000000 57.559793 126.185088 5.000000 -0.000000 24.643584 162.352130 6.000000 -1.000000 22.643295 124.976494 7.000000 -5.000000 14.079022 198.575641 5.000000 -0.000000 38.781250 122.737531 5.000000 -4.000000 27.516910 151.056726 5.000000 1.000000 28.541627 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 1 2.000000 3.000000 10.000000 1.000000 2 5.000000 8.000000 5.000000 2.000000 3 7.000000 5.000000 -3.000000 4.000000 X Y Gauss_Sum(X,Y) 0.000000 0.000000 -0.029388 0.000000 1.000000 -0.048263 0.000000 2.000000 -0.012567 0.000000 3.000000 0.073900 0.000000 4.000000 -0.064255 0.000000 5.000000 -0.135940 0.000000 6.000000 -0.128237 0.000000 7.000000 -0.101758 0.000000 8.000000 -0.070295 0.000000 9.000000 -0.044101 0.000000 10.000000 -0.025860 1.000000 0.000000 -0.065825 1.000000 1.000000 -0.048943 1.000000 2.000000 1.173200 1.000000 3.000000 3.432716 1.000000 4.000000 1.057990 1.000000 5.000000 -0.239166 1.000000 6.000000 -0.262896 1.000000 7.000000 -0.174933 1.000000 8.000000 -0.088586 1.000000 9.000000 -0.045001 1.000000 10.000000 -0.032589 2.000000 0.000000 -0.130577 2.000000 1.000000 -0.048176 2.000000 2.000000 3.320561 2.000000 3.000000 9.511281 2.000000 4.000000 3.097712 2.000000 5.000000 -0.390133 2.000000 6.000000 -0.395630 2.000000 7.000000 -0.079310 2.000000 8.000000 0.168697 2.000000 9.000000 0.179090 2.000000 10.000000 0.062060 3.000000 0.000000 -0.230881 3.000000 1.000000 -0.338618 3.000000 2.000000 0.724746 3.000000 3.000000 2.822831 3.000000 4.000000 0.350270 3.000000 5.000000 -0.842388 3.000000 6.000000 -0.359642 3.000000 7.000000 0.573010 3.000000 8.000000 1.210563 3.000000 9.000000 1.026518 3.000000 10.000000 0.445341 4.000000 0.000000 -0.358276 4.000000 1.000000 -0.625461 4.000000 2.000000 -0.906097 4.000000 3.000000 -1.140568 4.000000 4.000000 -1.467084 4.000000 5.000000 -1.295569 4.000000 6.000000 -0.173238 4.000000 7.000000 1.701411 4.000000 8.000000 2.920047 4.000000 9.000000 2.403819 4.000000 10.000000 1.074225 5.000000 0.000000 -0.489736 5.000000 1.000000 -0.859468 5.000000 2.000000 -1.330171 5.000000 3.000000 -1.808706 5.000000 4.000000 -2.102815 5.000000 5.000000 -1.809384 5.000000 6.000000 -0.355450 5.000000 7.000000 2.074412 5.000000 8.000000 3.668758 5.000000 9.000000 3.034490 5.000000 10.000000 1.349661 6.000000 0.000000 -0.590735 6.000000 1.000000 -1.036754 6.000000 2.000000 -1.605303 6.000000 3.000000 -2.187329 6.000000 4.000000 -2.576169 6.000000 5.000000 -2.407814 6.000000 6.000000 -1.214967 6.000000 7.000000 0.837806 6.000000 8.000000 2.288220 6.000000 9.000000 1.995881 6.000000 10.000000 0.841789 7.000000 0.000000 -0.628834 7.000000 1.000000 -1.103630 7.000000 2.000000 -1.709121 7.000000 3.000000 -2.332851 7.000000 4.000000 -2.784549 7.000000 5.000000 -2.806129 7.000000 6.000000 -2.141563 7.000000 7.000000 -0.903878 7.000000 8.000000 0.130049 7.000000 9.000000 0.328886 7.000000 10.000000 0.047842 8.000000 0.000000 -0.590735 8.000000 1.000000 -1.036770 8.000000 2.000000 -1.605719 8.000000 3.000000 -2.193830 8.000000 4.000000 -2.637838 8.000000 5.000000 -2.762694 8.000000 6.000000 -2.453620 8.000000 7.000000 -1.784422 8.000000 8.000000 -1.078788 8.000000 9.000000 -0.626347 8.000000 10.000000 -0.396864 9.000000 0.000000 -0.489737 9.000000 1.000000 -0.859514 9.000000 2.000000 -1.331231 9.000000 3.000000 -1.819415 9.000000 4.000000 -2.193170 9.000000 5.000000 -2.326750 9.000000 6.000000 -2.161157 9.000000 7.000000 -1.748271 9.000000 8.000000 -1.239664 9.000000 9.000000 -0.788193 9.000000 10.000000 -0.456047 10.000000 0.000000 -0.358299 10.000000 1.000000 -0.628834 10.000000 2.000000 -0.973956 10.000000 3.000000 -1.331223 10.000000 4.000000 -1.605607 10.000000 5.000000 -1.708331 10.000000 6.000000 -1.602233 10.000000 7.000000 -1.323725 10.000000 8.000000 -0.964305 10.000000 9.000000 -0.621317 10.000000 10.000000 -0.354748 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 0 20 -5 1 2: 1 1 18 -4 1.1 3: 1 2 16 -3 1.2 4: 1 3 14 -2 1.3 5: 1 4 12 -1 1.4 6: 1 5 10 0 1.5 7: 1 6 8 1 1.6 8: 1 7 6 2 1.7 9: 1 8 4 3 1.8 10: 1 9 2 4 1.9 11: 1 10 0 5 2 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.000000 0.000000 20.000000 -5.000000 1.000000 to 1.000000 10.000000 0.000000 5.000000 2.000000 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 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.000000 0.000000 20.000000 -5.000000 1.000000 and on step 13 we will compute 1.000000 10.000000 0.000000 5.000000 2.000000 The grid matrix: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : -2 -1 0 1 2 3 : 24 22 20 18 16 4 : -7 -6 -5 -4 -3 5 : 0.8 0.9 1 1.1 1.2 Col: 6 7 8 9 10 Row 1 : 1 1 1 1 1 2 : 3 4 5 6 7 3 : 14 12 10 8 6 4 : -2 -1 0 1 2 5 : 1.3 1.4 1.5 1.6 1.7 Col: 11 12 13 14 15 Row 1 : 1 1 1 1 1 2 : 8 9 10 11 12 3 : 4 2 0 -2 -4 4 : 3 4 5 6 7 5 : 1.8 1.9 2 2.1 2.2 Col: 16 17 18 19 20 Row 1 : 1 1 1 1 1 2 : 13 14 15 16 17 3 : -6 -8 -10 -12 -14 4 : 8 9 10 11 12 5 : 2.3 2.4 2.5 2.6 2.7 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. Here, on step 3 we would compute 1.000000 0.000000 20.000000 -5.000000 1.000000 and on step 13 we would compute 1.000000 10.000000 0.000000 5.000000 2.000000 1 1.000000 -2.000000 24.000000 -7.000000 0.800000 2 1.000000 -1.000000 22.000000 -6.000000 0.900000 3 1.000000 0.000000 20.000000 -5.000000 1.000000 4 1.000000 1.000000 18.000000 -4.000000 1.100000 5 1.000000 2.000000 16.000000 -3.000000 1.200000 6 1.000000 3.000000 14.000000 -2.000000 1.300000 7 1.000000 4.000000 12.000000 -1.000000 1.400000 8 1.000000 5.000000 10.000000 0.000000 1.500000 9 1.000000 6.000000 8.000000 1.000000 1.600000 10 1.000000 7.000000 6.000000 2.000000 1.700000 11 1.000000 8.000000 4.000000 3.000000 1.800000 12 1.000000 9.000000 2.000000 4.000000 1.900000 13 1.000000 10.000000 0.000000 5.000000 2.000000 14 1.000000 11.000000 -2.000000 6.000000 2.100000 15 1.000000 12.000000 -4.000000 7.000000 2.200000 16 1.000000 13.000000 -6.000000 8.000000 2.300000 17 1.000000 14.000000 -8.000000 9.000000 2.400000 18 1.000000 15.000000 -10.000000 10.000000 2.500000 19 1.000000 16.000000 -12.000000 11.000000 2.600000 20 1.000000 17.000000 -14.000000 12.000000 2.700000 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 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 TEST16 GRID3N computes a point from a 2D grid in the plane containing the DIM_NUM-dimensional points X1, X2 and X3. Here, we will 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 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 will 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 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 wish to compute the points on the following steps: X1 on step (2, 3) X2 on step (5, 3) X3 on step (2, 9) We will 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 subpak_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 P 1 2 2 2 3 3 4 5 5 5 6 7 7 7 8 11 9 11 10 11 11 11 12 13 13 13 14 17 15 17 16 17 17 17 18 19 19 19 20 23 TEST27 RAND(M,N) is a MATLAB routine which returns an M by N array of pseudorandom values. Using initial random number seed = 123456789 Test #1: Call 5 times, 1 value each time. 1 0.641401 2 0.542189 3 0.993175 4 0.843252 5 0.811734 Test #2: Restore the random number seed. Call 5 times, 1 value each time. The results should be identical. 1 0.641401 2 0.542189 3 0.993175 4 0.843252 5 0.811734 Test #3: Restore the random number seed. Call 1 time for 5 values. The results should be identical. 1 0.641401 2 0.542189 3 0.993175 4 0.843252 5 0.811734 Test #4: Restore the random number seed. Call for 2, 1, and 2 values. The results should be identical. 1 0.641401 2 0.542189 1 0.993175 1 0.843252 2 0.811734 Test #5: Number of samples was 1000 Minimum value was 0.000022 Maximum value was 0.997014 Average value was 0.493196 Variance was 0.082109 Expected average 0.500000 Expected variance 0.083333 TEST28 RAND('STATE',J) sets the random seed to its Jth value. RAND(M,N) is a MATLAB routine which returns an M by N array of pseudorandom values between 0 and 1. Set RAND to its seed state number 123456789 Number of values computed was N = 1000 Average value was 0.493899 Variance was 0.082000 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: 1: 1 2: 2 3: 3 4: 4 The polynomial = +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: 1: 13 2: 16 3: 1 4: 20 5: 15 6: 2 7: 16 8: 18 9: 1 10: 18 11: 3 12: 18 13: 12 14: 8 15: 19 16: 10 17: 14 18: 5 19: 4 20: 1 Sorted array: 1: 1 2: 1 3: 1 4: 2 5: 3 6: 4 7: 5 8: 8 9: 10 10: 12 11: 13 12: 14 13: 15 14: 16 15: 16 16: 18 17: 18 18: 18 19: 19 20: 20 TEST32 For evenly spaced angles between 0 and 2*PI: TVEC_EVEN TVEC_EVEN2 TVEC_EVEN3 TVEC_EVEN NT = 4 0.000000 1.570796 3.141593 4.712389 TVEC_EVEN2 NT = 4 0.785398 2.356194 3.926991 5.497787 TVEC_EVEN3 NT = 4 0.000000 2.094395 4.188790 6.283185 TEST33 For evenly spaced angles between THETA1 and THETA2: TVEC_EVEN_BRACKET TVEC_EVEN_BRACKET2. TVEC_EVEN_BRACKET3. TVEC_EVEN_BRACKET NT = 4 THETA1 = 30.000000 THETA2 = 90.000000 30.000000 50.000000 70.000000 90.000000 TVEC_EVEN_BRACKET2 NT = 5 THETA1 = 30.000000 THETA2 = 90.000000 40.000000 50.000000 60.000000 70.000000 80.000000 TVEC_EVEN_BRACKET3 NT = 3 THETA1 = 30.000000 THETA2 = 90.000000 40.000000 60.000000 80.000000 subpak_test(): Normal end of execution. 22-Sep-2024 20:10:55