13 April 2020 02:51:53 PM SINE_TRANSFORM_TEST 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.15667 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.0817916 0.415307 5 0.0661187 -0.381461 0.0661187 6 0.257578 0.130254 0.257578 7 0.109957 -0.452064 0.109957 8 0.043829 -0.00109167 0.043829 9 0.633966 0.00102277 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 0.9504 0 0.9504 0 0.9504 1 1.2 1.4256 -1.1557 0.85536 0.57024 1.4256 2 1.4 1.7472 4.25108 0.76032 0.98688 1.7472 3 1.6 1.764 -1.58847 0.66528 1.09872 1.764 4 1.8 1.37088 0.687471 0.57024 0.80064 1.37088 5 2 0.5472 -0.359345 0.4752 0.072 0.5472 6 2.2 -0.6048 0.199698 0.38016 -0.98496 -0.6048 7 2.4 -1.8216 -0.117457 0.28512 -2.10672 -1.8216 8 2.6 -2.64 0.0654377 0.19008 -2.83008 -2.64 9 2.8 -2.35872 -0.0298847 0.09504 -2.45376 -2.35872 10 3 0 0 0 0 0 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.3 1.61568 -134.083 1 1.6 1.764 50.9253 2 1.9 1.0098 -17.4326 3 2.2 -0.6048 7.52496 4 2.5 -2.3184 -3.86908 5 2.8 -2.35872 2.15858 6 3.1 2.349 -1.2589 7 3.4 16.4736 0.704712 8 3.7 46.5696 -0.31985 I X F(X) FHAT(X) 0 1 0.9504 0.9504 1 1.15 1.31483 1.28162 2 1.3 1.61568 1.61568 3 1.45 1.78516 1.82066 4 1.6 1.764 1.764 5 1.75 1.51052 1.47117 6 1.9 1.0098 1.0098 7 2.05 0.282738 0.328656 8 2.2 -0.6048 -0.6048 9 2.35 -1.53288 -1.58983 10 2.5 -2.3184 -2.3184 11 2.65 -2.70595 -2.62979 12 2.8 -2.35872 -2.35872 13 2.95 -0.849389 -0.961698 14 3.1 2.349 2.349 15 3.25 7.87215 8.0621 16 3.4 16.4736 16.4736 17 3.55 29.0339 28.6364 18 3.7 46.5696 46.5696 19 3.85 70.2425 71.4652 20 4 101.369 101.369 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 16 16 1 0.0875 13.5345 12.1185 2 0.175 7.40993 8.14431 3 0.2625 0.718525 4.08778 4 0.35 -3.37481 0.127658 5 0.4375 -3.38709 -3.38709 6 0.525 -0.261986 -6.00473 7 0.6125 3.31412 -7.29108 8 0.7 4.60251 -6.96841 9 0.7875 2.49725 -5.03072 10 0.875 -1.79798 -1.79798 11 0.9625 -5.50363 2.11236 12 1.05 -5.97239 5.89563 13 1.1375 -2.35477 8.72778 14 1.225 3.77527 9.94989 15 1.3125 9.22252 9.22252 16 1.4 10.9479 6.60982 17 1.4875 7.79106 2.57105 18 1.575 1.13422 -2.13952 19 1.6625 -5.87902 -6.64004 20 1.75 -10.1153 -10.1153 21 1.8375 -10.1816 -11.9913 22 1.925 -7.11132 -12.0493 23 2.0125 -3.62422 -10.4554 24 2.1 -2.41286 -7.70271 25 2.1875 -4.48318 -4.48318 26 2.275 -8.53577 -1.52287 27 2.3625 -11.7561 0.57908 28 2.45 -11.5442 1.47206 29 2.5375 -7.15363 1.11104 30 2.625 -0.258664 -0.258664 31 2.7125 5.90462 -2.18004 32 2.8 8.33648 -4.10374 33 2.8875 5.96864 -5.5186 34 2.975 0.268963 -6.06345 35 3.0625 -5.59725 -5.59725 36 3.15 -8.55986 -4.21524 37 3.2375 -7.34674 -2.21145 38 3.325 -3.11101 0.000922866 39 3.4125 1.36686 1.99141 40 3.5 3.41326 3.41326 41 3.5875 2.09478 4.08137 42 3.675 -1.22106 4.01059 43 3.7625 -3.71076 3.40642 44 3.85 -2.843 2.61026 45 3.9375 2.01118 2.01118 46 4.025 9.07165 1.94371 47 4.1125 15.064 2.5953 48 4.2 17.0369 3.94595 49 4.2875 14.0285 5.75635 50 4.375 7.61085 7.61085 51 4.4625 0.994622 9.00863 52 4.55 -2.78267 9.4842 53 4.6375 -2.53121 8.72961 54 4.725 0.523216 6.68794 55 4.8125 3.59227 3.59227 56 4.9 4.07749 -0.0640166 57 4.9875 1.17416 -3.62349 58 5.075 -3.62787 -6.40811 59 5.1625 -7.44431 -7.87739 60 5.25 -7.76263 -7.76263 61 5.3375 -4.02272 -6.14256 62 5.425 1.93559 -3.43872 63 5.5125 6.84124 -0.32848 64 5.6 7.82541 2.40583 65 5.6875 4.0559 4.0559 66 5.775 -2.7801 4.15137 67 5.8625 -9.42686 2.56828 68 5.95 -12.8901 -0.444089 69 6.0375 -12.0812 -4.32348 70 6.125 -8.325 -8.325 71 6.2125 -4.45199 -11.6869 72 6.3 -3.02927 -13.7891 73 6.3875 -4.78675 -14.2657 74 6.475 -8.1757 -13.0461 75 6.5625 -10.3216 -10.3216 76 6.65 -8.80462 -6.45294 77 6.7375 -3.20757 -1.85263 78 6.825 4.49863 3.12251 79 6.9125 10.978 8.23613 80 7 13.3791 13.3791 SINE_TRANSFORM_TEST Normal end of execution. 13 April 2020 02:51:53 PM