21 January 2017 05:23:04 PM SINE_TRANSFORM_PRB C version. Test the SINE_TRANSFORM library. SINE_TRANSFORM_TEST01: SINE_TRANSFORM_DATA does a sine transform of data defined by a vector. Demonstrate that the transform is its own inverse. Let R be a random N vector. Let S be the transform of D. Let T be the transform of E. Then R and T will be equal. I R(I) S(I) T(I) 0 0.218418 1.156669 0.218418 1 0.956318 0.701776 0.956318 2 0.829509 0.628231 0.829509 3 0.561695 -0.162421 0.561695 4 0.415307 0.081792 0.415307 5 0.066119 -0.381461 0.066119 6 0.257578 0.130254 0.257578 7 0.109957 -0.452064 0.109957 8 0.043829 -0.001092 0.043829 9 0.633966 0.001023 0.633966 SINE_TRANSFORM_TEST02: SINE_TRANSFORM_FUNCTION does a sine transform of data defined by a function F(X) evaluated at equally spaced points in an interval [A,B]. Demonstrate that the transform is its own inverse. Let X(0:N+1) be N+2 equally spaced points in [A,B]. Let S be the transform of F(X(1:N)). Let F1 be the linear interpolant of (A,F(A)), (B,F(B)). Let F2 be the transform of S. Then F(X(1:N)) = F1(X(1:N)) + F2(1:N). I X(I) F(X(I)) S F1 F2 F1+F2 0 1.000000 0.950400 0.000000 0.950400 0.000000 0.950400 1 1.200000 1.425600 -1.155704 0.855360 0.570240 1.425600 2 1.400000 1.747200 4.251083 0.760320 0.986880 1.747200 3 1.600000 1.764000 -1.588474 0.665280 1.098720 1.764000 4 1.800000 1.370880 0.687471 0.570240 0.800640 1.370880 5 2.000000 0.547200 -0.359345 0.475200 0.072000 0.547200 6 2.200000 -0.604800 0.199698 0.380160 -0.984960 -0.604800 7 2.400000 -1.821600 -0.117457 0.285120 -2.106720 -1.821600 8 2.600000 -2.640000 0.065438 0.190080 -2.830080 -2.640000 9 2.800000 -2.358720 -0.029885 0.095040 -2.453760 -2.358720 10 3.000000 0.000000 0.000000 0.000000 0.000000 0.000000 SINE_TRANSFORM_TEST03: SINE_TRANSFORM_FUNCTION does a sine transform of data defined by a function F(X) evaluated at N equally spaced points in an interval [A,B]. SINE_TRANSFORM_INTERPOLANT evaluates the interpolant. The interpolant will be 0 at the 0th and (N+1)-th points. It equals the function at points 1 through N. In between, it can approximate smooth functions, and the approximation improves with N. I X(I) F(X(I)) S(I) 0 1.300000 1.615680 -134.082993 1 1.600000 1.764000 50.925281 2 1.900000 1.009800 -17.432578 3 2.200000 -0.604800 7.524957 4 2.500000 -2.318400 -3.869077 5 2.800000 -2.358720 2.158577 6 3.100000 2.349000 -1.258899 7 3.400000 16.473600 0.704712 8 3.700000 46.569600 -0.319850 I X F(X) FHAT(X) 0 1.000000 0.950400 0.950400 1 1.150000 1.314830 1.281618 2 1.300000 1.615680 1.615680 3 1.450000 1.785164 1.820661 4 1.600000 1.764000 1.764000 5 1.750000 1.510523 1.471165 6 1.900000 1.009800 1.009800 7 2.050000 0.282738 0.328656 8 2.200000 -0.604800 -0.604800 9 2.350000 -1.532883 -1.589835 10 2.500000 -2.318400 -2.318400 11 2.650000 -2.705948 -2.629789 12 2.800000 -2.358720 -2.358720 13 2.950000 -0.849389 -0.961698 14 3.100000 2.349000 2.349000 15 3.250000 7.872145 8.062100 16 3.400000 16.473600 16.473600 17 3.550000 29.033885 28.636424 18 3.700000 46.569600 46.569600 19 3.850000 70.242539 71.465247 20 4.000000 101.368800 101.368800 SINE_TRANSFORM_TEST04: SINE_TRANSFORM_FUNCTION does a sine transform of data defined by a function F(X) evaluated at N equally spaced points in an interval [A,B]. SINE_TRANSFORM_INTERPOLANT evaluates the interpolant. The interpolant will be 0 at the 0th and (N+1)-th points. It equals the function at points 1 through N. In between, it can approximate smooth functions, and the approximation improves with N. Expect exact agreement every 5th sample. 0 0.000000 16.000000 16.000000 1 0.087500 13.534518 12.118499 2 0.175000 7.409928 8.144312 3 0.262500 0.718525 4.087784 4 0.350000 -3.374807 0.127658 5 0.437500 -3.387090 -3.387090 6 0.525000 -0.261986 -6.004729 7 0.612500 3.314120 -7.291085 8 0.700000 4.602507 -6.968413 9 0.787500 2.497253 -5.030716 10 0.875000 -1.797977 -1.797977 11 0.962500 -5.503629 2.112362 12 1.050000 -5.972391 5.895629 13 1.137500 -2.354766 8.727776 14 1.225000 3.775267 9.949889 15 1.312500 9.222518 9.222518 16 1.400000 10.947939 6.609820 17 1.487500 7.791065 2.571048 18 1.575000 1.134223 -2.139515 19 1.662500 -5.879023 -6.640039 20 1.750000 -10.115345 -10.115345 21 1.837500 -10.181551 -11.991336 22 1.925000 -7.111321 -12.049265 23 2.012500 -3.624216 -10.455365 24 2.100000 -2.412857 -7.702710 25 2.187500 -4.483176 -4.483176 26 2.275000 -8.535765 -1.522875 27 2.362500 -11.756117 0.579080 28 2.450000 -11.544194 1.472061 29 2.537500 -7.153632 1.111044 30 2.625000 -0.258664 -0.258664 31 2.712500 5.904623 -2.180036 32 2.800000 8.336477 -4.103741 33 2.887500 5.968641 -5.518602 34 2.975000 0.268963 -6.063451 35 3.062500 -5.597248 -5.597248 36 3.150000 -8.559863 -4.215241 37 3.237500 -7.346739 -2.211449 38 3.325000 -3.111013 0.000923 39 3.412500 1.366860 1.991410 40 3.500000 3.413261 3.413261 41 3.587500 2.094782 4.081370 42 3.675000 -1.221057 4.010587 43 3.762500 -3.710755 3.406415 44 3.850000 -2.843003 2.610264 45 3.937500 2.011182 2.011182 46 4.025000 9.071648 1.943705 47 4.112500 15.063966 2.595299 48 4.200000 17.036881 3.945948 49 4.287500 14.028533 5.756346 50 4.375000 7.610850 7.610850 51 4.462500 0.994622 9.008634 52 4.550000 -2.782669 9.484200 53 4.637500 -2.531207 8.729605 54 4.725000 0.523216 6.687937 55 4.812500 3.592273 3.592273 56 4.900000 4.077494 -0.064017 57 4.987500 1.174165 -3.623487 58 5.075000 -3.627872 -6.408107 59 5.162500 -7.444312 -7.877388 60 5.250000 -7.762628 -7.762628 61 5.337500 -4.022721 -6.142555 62 5.425000 1.935592 -3.438724 63 5.512500 6.841243 -0.328480 64 5.600000 7.825409 2.405827 65 5.687500 4.055899 4.055899 66 5.775000 -2.780101 4.151366 67 5.862500 -9.426862 2.568277 68 5.950000 -12.890118 -0.444089 69 6.037500 -12.081233 -4.323479 70 6.125000 -8.324996 -8.324996 71 6.212500 -4.451994 -11.686887 72 6.300000 -3.029269 -13.789116 73 6.387500 -4.786747 -14.265709 74 6.475000 -8.175704 -13.046134 75 6.562500 -10.321577 -10.321577 76 6.650000 -8.804624 -6.452937 77 6.737500 -3.207566 -1.852632 78 6.825000 4.498634 3.122514 79 6.912500 10.978034 8.236128 80 7.000000 13.379068 13.379068 SINE_TRANSFORM_PRB Normal end of execution. 21 January 2017 05:23:04 PM