22 January 2017 10:47:30 AM SPLINE_PRB C version: Test the SPLINE library. TEST001 PARABOLA_VAL2 evaluates parabolas through 3 points in a table Our data tables will actually be parabolas: A: 2*x**2 + 3 * x + 1. B: 4*x**2 - 2 * x + 5. 0 2 15 17 1 4 45 61 2 6 91 137 3 8 153 245 4 10 231 385 Interpolated data: LEFT, X, Y1, Y2 1 1 6 7 2 3 28 35 3 5 66 95 3 7 120 187 3 9 190 311 TEST002 R8VEC_BRACKET finds a pair of entries in a sorted real array which bracket a value. Sorted array: 0: 1.000000 1: 2.000000 2: 3.000000 3: 4.000000 4: 5.000000 5: 5.000000 6: 7.000000 7: 8.000000 8: 9.000000 9: 10.000000 Search for XVAL = -10 X[0] = 1 X[1] = 2 Search for XVAL = 1 X[0] = 1 X[1] = 2 Search for XVAL = 4.5 X[3] = 4 X[4] = 5 Search for XVAL = 5 X[5] = 5 X[6] = 7 Search for XVAL = 10 X[8] = 9 X[9] = 10 Search for XVAL = 12 X[8] = 9 X[9] = 10 TEST003 R8VEC_BRACKET3 finds a pair of entries in a sorted real array which bracket a value. Sorted array: 0: 1.000000 1: 2.000000 2: 3.000000 3: 4.000000 4: 5.000000 5: 5.000000 6: 7.000000 7: 8.000000 8: 9.000000 9: 10.000000 Search for XVAL = -10 Starting guess for interval is = 5 Nearest interval: X[-1]= 12 X[0]= 1 Search for XVAL = 1 Starting guess for interval is = 0 Nearest interval: X[-1]= 12 X[0]= 1 Search for XVAL = 4.5 Starting guess for interval is = 0 Nearest interval: X[2]= 3 X[3]= 4 Search for XVAL = 5 Starting guess for interval is = 3 Nearest interval: X[2]= 3 X[3]= 4 Search for XVAL = 10 Starting guess for interval is = 3 Nearest interval: X[7]= 8 X[8]= 9 Search for XVAL = 12 Starting guess for interval is = 8 Nearest interval: X[7]= 8 X[8]= 9 TEST004 R8VEC_ORDER_TYPE classifies a real vector as -1: no order 0: all equal; 1: ascending; 2: strictly ascending; 3: descending; 4: strictly descending. Vector of order type -1: 0 1 1 3 2 2 3 4 Vector of order type 0: 0 2 1 2 2 2 3 2 Vector of order type 1: 0 1 1 2 2 2 3 4 Vector of order type 2: 0 1 1 2 2 3 3 4 Vector of order type 3: 0 4 1 4 2 3 3 1 Vector of order type 4: 0 9 1 7 2 3 3 0 TEST005 D3_NP_FS factors and solves a tridiagonal linear system. Computed solution: 0: 1.000000 1: 2.000000 2: 3.000000 3: 4.000000 4: 5.000000 5: 6.000000 6: 7.000000 7: 8.000000 8: 9.000000 9: 10.000000 TEST006 Approximate Y = EXP(X) using orders 1 to 8. Original data: X Y 0 1 1 2.71828 2 7.38906 3 20.0855 4 54.5982 5 148.413 6 403.429 7 1096.63 Evaluate at X = 2.5 where EXP(X) = 12.1825 Order Approximate Y Error 1 1 -11.1825 2 5.2957 -6.88679 3 10.8316 -1.35087 4 12.417 0.234513 5 12.0765 -0.106003 6 12.252 0.069528 7 12.1264 -0.0561433 8 12.2343 0.0518261 TEST01 BASIS_FUNCTION_B_VAL evaluates the B spline basis function. T B(T) -0.5 0 -0.375 0 -0.25 0 -0.125 0 * 0 0 0.25 0.00260417 0.5 0.0208333 0.75 0.0703125 * 1 0.166667 1.75 0.315104 2.5 0.479167 3.25 0.611979 * 4 0.666667 4.5 0.611979 5 0.479167 5.5 0.315104 * 6 0.166667 7 0.0703125 8 0.0208333 9 0.00260417 * 10 0 10.5 0 11 0 11.5 0 12 0 TEST02 BASIS_FUNCTION_BETA_VAL evaluates the Beta spline basis function. BETA1 = 1 BETA2 = 0 T B(T) -0.5 0 -0.375 0 -0.25 0 -0.125 0 * 0 0 0.25 0.00260417 0.5 0.0208333 0.75 0.0703125 * 1 0.166667 1.75 0.315104 2.5 0.479167 3.25 0.611979 * 4 0.666667 4.5 0.611979 5 0.479167 5.5 0.315104 * 6 0.166667 7 0.0703125 8 0.0208333 9 0.00260417 * 10 0 10.5 0 11 0 11.5 0 12 0 BETA1 = 1 BETA2 = 100 T B(T) -0.5 0 -0.375 0 -0.25 0 -0.125 0 * 0 0 0.25 0.000279018 0.5 0.00223214 0.75 0.00753348 * 1 0.0178571 1.75 0.17327 2.5 0.497768 3.25 0.818917 * 4 0.964286 4.5 0.818917 5 0.497768 5.5 0.17327 * 6 0.0178571 7 0.00753348 8 0.00223214 9 0.000279018 * 10 0 10.5 0 11 0 11.5 0 12 0 BETA1 = 100 BETA2 = 0 T B(T) -0.5 0 -0.375 0 -0.25 0 -0.125 0 * 0 0 0.25 1.53156e-08 0.5 1.22525e-07 0.75 4.13521e-07 * 1 9.80199e-07 1.75 0.00175767 2.5 0.00626188 3.25 0.0125854 * 4 0.0198 4.5 0.584721 5 0.871213 5.5 0.972099 * 6 0.980199 7 0.413521 8 0.122525 9 0.0153156 * 10 0 10.5 0 11 0 11.5 0 12 0 TEST03 BASIS_MATRIX_B_UNI sets up the basis matrix for the uniform B spline. TDATA, YDATA -1 4 0 7 1 12 2 19 T Spline(T) -1.5 3.58333 -1.375 3.72396 -1.25 3.89583 -1.125 4.09896 * -1 4.33333 -0.75 4.89583 -0.5 5.58333 -0.25 6.39583 * 0 7.33333 0.25 8.39583 0.5 9.58333 0.75 10.8958 * 1 12.3333 1.25 13.8958 1.5 15.5833 1.75 17.3958 * 2 19.3333 2.125 20.349 2.25 21.3958 2.375 22.474 2.5 23.5833 TEST04 BASIS_MATRIX_BETA_UNI sets up the basis matrix for the uniform beta spline. BETA1 = 1 BETA2 = 0 TDATA, YDATA -1 4 0 7 1 12 2 19 T Spline(T) -1.5 3.58333 -1.375 3.72396 -1.25 3.89583 -1.125 4.09896 * -1 4.33333 -0.75 4.89583 -0.5 5.58333 -0.25 6.39583 * 0 7.33333 0.25 8.39583 0.5 9.58333 0.75 10.8958 * 1 12.3333 1.25 13.8958 1.5 15.5833 1.75 17.3958 * 2 19.3333 2.125 20.349 2.25 21.3958 2.375 22.474 2.5 23.5833 BETA1 = 1 BETA2 = 100 TDATA, YDATA -1 4 0 7 1 12 2 19 T Spline(T) -1.5 66.9018 -1.375 55.1807 -1.25 45.0324 -1.125 36.3523 * -1 29.0357 -0.75 18.0748 -0.5 11.3125 -0.25 7.91183 * 0 7.03571 0.25 7.8471 0.5 9.50893 0.75 11.1842 * 1 12.0357 1.25 11.2266 1.5 7.91964 1.75 1.2779 * 2 -9.53571 2.125 -16.7686 2.25 -25.3583 2.375 -35.4095 2.5 -47.0268 BETA1 = 100 BETA2 = 0 TDATA, YDATA -1 4 0 7 1 12 2 19 T Spline(T) -1.5 -38.4512 -1.375 -31.989 -1.25 -26.1707 -1.125 -20.9622 * -1 -16.3297 -0.75 -8.65728 -0.5 -2.8823 -0.25 1.26625 * 0 4.05941 0.25 5.76822 0.5 6.66374 0.75 7.01699 * 1 7.09901 1.25 7.18086 1.5 7.53356 1.75 8.42817 * 2 10.1357 2.125 11.379 2.25 12.9272 2.375 14.8142 2.5 17.0738 TEST05 BASIS_MATRIX_BEZIER sets up the basis matrix for the uniform Bezier spline. TDATA, YDATA 0 7 0 8.33333 1 10 1 12 T Spline(T) 0 7 0 7 0 7 0 7 * 0 7 0 7 0 7 0 7 * 0 7 0.25 8.0625 0.5 9.25 0.75 10.5625 * 1 12 1 12 1 12 1 12 * 1 12 1 12 1 12 1 12 1 12 TEST06 BASIS_MATRIX_HERMITE sets up the basis matrix for the Hermite spline. TDATA, YDATA 0 7 0 12 1 4 1 6 T Spline(T) 0 7 0 7 0 7 0 7 * 0 7 0 7 0 7 0 7 * 0 7 0.25 8.0625 0.5 9.25 0.75 10.5625 * 1 12 1 12 1 12 1 12 * 1 12 1 12 1 12 1 12 1 12 TEST07 BASIS_MATRIX_OVERHAUSER_UNI sets up the basis matrix for the uniform Overhauser spline. TDATA, YDATA -1 4 0 7 1 12 2 19 T Spline(T) -1.5 3.25 -1.375 3.39062 -1.25 3.5625 -1.125 3.76562 * -1 4 -0.75 4.5625 -0.5 5.25 -0.25 6.0625 * 0 7 0.25 8.0625 0.5 9.25 0.75 10.5625 * 1 12 1.25 13.5625 1.5 15.25 1.75 17.0625 * 2 19 2.125 20.0156 2.25 21.0625 2.375 22.1406 2.5 23.25 TEST08 BASIS_MATRIX_OVERHAUSER_NONUNI sets up the basis matrix for the nonuniform Overhauser spline. ALPHA = 0.5 BETA = 0.5 TDATA, YDATA 0 7 1 4 2 3 3 4 T Spline(T) -0.5 9.25 -0.375 8.64062 -0.25 8.0625 -0.125 7.51562 * 0 7 0.25 6.0625 0.5 5.25 0.75 4.5625 * 1 4 1.25 3.5625 1.5 3.25 1.75 3.0625 * 2 3 2.25 3.0625 2.5 3.25 2.75 3.5625 * 3 4 3.125 4.26562 3.25 4.5625 3.375 4.89062 3.5 5.25 ALPHA = 0.5 BETA = 0.25 TDATA, YDATA 0 7 1 4 2 3 5 12 T Spline(T) -0.5 9.25 -0.375 8.64062 -0.25 8.0625 -0.125 7.51562 * 0 7 0.25 6.0625 0.5 5.25 0.75 4.5625 * 1 4 1.25 3.5625 1.5 3.25 1.75 3.0625 * 2 3 2.75 3.5625 3.5 5.25 4.25 8.0625 * 5 12 5.375 14.3906 5.75 17.0625 6.125 20.0156 6.5 23.25 ALPHA = 0.25 BETA = 0.5 TDATA, YDATA 0 7 3 4 4 7 5 12 T Spline(T) -1.5 1104.25 -1.125 879.531 -0.75 687.438 -0.375 525.438 * 0 391 0.75 194.688 1.5 78.25 2.25 21.4375 * 3 4 3.25 3.4375 3.5 4.25 3.75 5.6875 * 4 7 4.25 7.4375 4.5 6.25 4.75 2.6875 * 5 -4 5.125 -8.75 5.25 -14.5625 5.375 -21.5312 5.5 -29.75 TEST09 BASIS_MATRIX_OVERHAUSER_NONUNI sets up the basis matrix for the nonuniform Overhauser spline. First test that the nonuniform code can match the uniform code. Compare these results with the uniform output. ALPHA = 0.5 BETA = 0.5 TDATA, YDATA -1 4 0 7 1 12 2 19 T Spline(T) -1.5 3.25 -1.375 3.39062 -1.25 3.5625 -1.125 3.76562 * -1 4 -0.75 4.5625 -0.5 5.25 -0.25 6.0625 * 0 7 0.25 8.0625 0.5 9.25 0.75 10.5625 * 1 12 1.25 13.5625 1.5 15.25 1.75 17.0625 * 2 19 2.125 20.0156 2.25 21.0625 2.375 22.1406 2.5 23.25 Now test that the nonuniform code on a nonuniform grid. ALPHA = 0.666667 BETA = 0.4 TDATA, YDATA -4 7 -3 4 -1 4 2 19 T Spline(T) -4.5 -13.8125 -4.375 -10.083 -4.25 -6.89844 -4.125 -4.21777 * -4 -2 -3.75 1.21094 -3.5 3.0625 -3.25 3.88281 * -3 4 -2.5 3.4375 -2 4 -1.5 8.3125 * -1 19 -0.25 52.7266 0.5 115.563 1.25 216.367 * 2 364 2.375 458.146 2.75 567.32 3.125 692.632 3.5 835.188 TEST10 BC_VAL evaluates a general Bezier function. T X(T) Y(T) 0 0 1 0.01 0.01495 0.9802 0.02 0.0298 0.9608 0.03 0.04455 0.9418 0.04 0.0592 0.9232 0.05 0.07375 0.905 0.06 0.0882 0.8872 0.07 0.10255 0.8698 0.08 0.1168 0.8528 0.09 0.13095 0.8362 0.1 0.145 0.82 0.11 0.15895 0.8042 0.12 0.1728 0.7888 0.13 0.18655 0.7738 0.14 0.2002 0.7592 0.15 0.21375 0.745 0.16 0.2272 0.7312 0.17 0.24055 0.7178 0.18 0.2538 0.7048 0.19 0.26695 0.6922 0.2 0.28 0.68 0.21 0.29295 0.6682 0.22 0.3058 0.6568 0.23 0.31855 0.6458 0.24 0.3312 0.6352 0.25 0.34375 0.625 0.26 0.3562 0.6152 0.27 0.36855 0.6058 0.28 0.3808 0.5968 0.29 0.39295 0.5882 0.3 0.405 0.58 0.31 0.41695 0.5722 0.32 0.4288 0.5648 0.33 0.44055 0.5578 0.34 0.4522 0.5512 0.35 0.46375 0.545 0.36 0.4752 0.5392 0.37 0.48655 0.5338 0.38 0.4978 0.5288 0.39 0.50895 0.5242 0.4 0.52 0.52 0.41 0.53095 0.5162 0.42 0.5418 0.5128 0.43 0.55255 0.5098 0.44 0.5632 0.5072 0.45 0.57375 0.505 0.46 0.5842 0.5032 0.47 0.59455 0.5018 0.48 0.6048 0.5008 0.49 0.61495 0.5002 0.5 0.625 0.5 0.51 0.63495 0.5002 0.52 0.6448 0.5008 0.53 0.65455 0.5018 0.54 0.6642 0.5032 0.55 0.67375 0.505 0.56 0.6832 0.5072 0.57 0.69255 0.5098 0.58 0.7018 0.5128 0.59 0.71095 0.5162 0.6 0.72 0.52 0.61 0.72895 0.5242 0.62 0.7378 0.5288 0.63 0.74655 0.5338 0.64 0.7552 0.5392 0.65 0.76375 0.545 0.66 0.7722 0.5512 0.67 0.78055 0.5578 0.68 0.7888 0.5648 0.69 0.79695 0.5722 0.7 0.805 0.58 0.71 0.81295 0.5882 0.72 0.8208 0.5968 0.73 0.82855 0.6058 0.74 0.8362 0.6152 0.75 0.84375 0.625 0.76 0.8512 0.6352 0.77 0.85855 0.6458 0.78 0.8658 0.6568 0.79 0.87295 0.6682 0.8 0.88 0.68 0.81 0.88695 0.6922 0.82 0.8938 0.7048 0.83 0.90055 0.7178 0.84 0.9072 0.7312 0.85 0.91375 0.745 0.86 0.9202 0.7592 0.87 0.92655 0.7738 0.88 0.9328 0.7888 0.89 0.93895 0.8042 0.9 0.945 0.82 0.91 0.95095 0.8362 0.92 0.9568 0.8528 0.93 0.96255 0.8698 0.94 0.9682 0.8872 0.95 0.97375 0.905 0.96 0.9792 0.9232 0.97 0.98455 0.9418 0.98 0.9898 0.9608 0.99 0.99495 0.9802 1 1 1 The point ( 0.75, 0.536 ) should be on the curve. TEST11 BEZ_VAL evaluates a Bezier function. I X B 1 0 1 2 0.05 0.905 3 0.1 0.82 4 0.15 0.745 5 0.2 0.68 6 0.25 0.625 7 0.3 0.58 8 0.35 0.545 9 0.4 0.52 10 0.45 0.505 11 0.5 0.5 12 0.55 0.505 13 0.6 0.52 14 0.65 0.545 15 0.7 0.58 16 0.75 0.625 17 0.8 0.68 18 0.85 0.745 19 0.9 0.82 20 0.95 0.905 21 1 1 When X = 0.75 BEZ_VAL(X) should be 0.625 TEST115 BP01 evaluates the Bernstein basis polynomials for the interval [0,1]. Degree N = 0 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 0 1 0.1 1 0.2 1 0.3 1 0.4 1 0.5 1 0.6 1 0.7 1 0.8 1 0.9 1 1 1 Degree N = 1 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 0 1 0 0.1 0.9 0.1 0.2 0.8 0.2 0.3 0.7 0.3 0.4 0.6 0.4 0.5 0.5 0.5 0.6 0.4 0.6 0.7 0.3 0.7 0.8 0.2 0.8 0.9 0.1 0.9 1 0 1 Degree N = 2 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 0 1 0 0 0.1 0.81 0.18 0.01 0.2 0.64 0.32 0.04 0.3 0.49 0.42 0.09 0.4 0.36 0.48 0.16 0.5 0.25 0.5 0.25 0.6 0.16 0.48 0.36 0.7 0.09 0.42 0.49 0.8 0.04 0.32 0.64 0.9 0.01 0.18 0.81 1 0 0 1 Degree N = 3 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 0 1 0 0 0 0.1 0.729 0.243 0.027 0.001 0.2 0.512 0.384 0.096 0.008 0.3 0.343 0.441 0.189 0.027 0.4 0.216 0.432 0.288 0.064 0.5 0.125 0.375 0.375 0.125 0.6 0.064 0.288 0.432 0.216 0.7 0.027 0.189 0.441 0.343 0.8 0.008 0.096 0.384 0.512 0.9 0.001 0.027 0.243 0.729 1 0 0 0 1 TEST116 BPAB evaluates the Bernstein basis polynomials for the interval [A,B]. Degree N = 0 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 1 1 1.2 1 1.4 1 1.6 1 1.8 1 2 1 2.2 1 2.4 1 2.6 1 2.8 1 3 1 Degree N = 1 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 1 1 0 1.2 0.9 0.1 1.4 0.8 0.2 1.6 0.7 0.3 1.8 0.6 0.4 2 0.5 0.5 2.2 0.4 0.6 2.4 0.3 0.7 2.6 0.2 0.8 2.8 0.1 0.9 3 0 1 Degree N = 2 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 1 1 0 0 1.2 0.81 0.18 0.01 1.4 0.64 0.32 0.04 1.6 0.49 0.42 0.09 1.8 0.36 0.48 0.16 2 0.25 0.5 0.25 2.2 0.16 0.48 0.36 2.4 0.09 0.42 0.49 2.6 0.04 0.32 0.64 2.8 0.01 0.18 0.81 3 0 0 1 Degree N = 3 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 1 1 0 0 0 1.2 0.729 0.243 0.027 0.001 1.4 0.512 0.384 0.096 0.008 1.6 0.343 0.441 0.189 0.027 1.8 0.216 0.432 0.288 0.064 2 0.125 0.375 0.375 0.125 2.2 0.064 0.288 0.432 0.216 2.4 0.027 0.189 0.441 0.343 2.6 0.008 0.096 0.384 0.512 2.8 0.001 0.027 0.243 0.729 3 0 0 0 1 TEST12 BPAB_APPROX evaluates the Bernstein polynomial approximant to a function F(X). XDATA YDATA 2 0.909297 Bernstein approximant of degree N = 0 X F(X) BERN(X) ERROR 2 0.909297 0.909297 0 XDATA YDATA 1 0.841471 1.66667 0.995408 2.33333 0.723086 3 0.14112 Bernstein approximant of degree N = 3 X F(X) BERN(X) ERROR 1 0.841471 0.841471 0 1.33333 0.971938 0.883458 -0.0884801 1.66667 0.995408 0.857641 -0.137767 2 0.909297 0.767259 -0.142038 2.33333 0.723086 0.615552 -0.107534 2.66667 0.457273 0.405759 -0.0515132 3 0.14112 0.14112 0 XDATA YDATA 1 0.841471 1.33333 0.971938 1.66667 0.995408 2 0.909297 2.33333 0.723086 2.66667 0.457273 3 0.14112 Bernstein approximant of degree N = 6 X F(X) BERN(X) ERROR 1 0.841471 0.841471 0 1.16667 0.919445 0.895538 -0.0239072 1.33333 0.971938 0.927255 -0.0446825 1.5 0.997495 0.936755 -0.0607402 1.66667 0.995408 0.924369 -0.0710386 1.83333 0.965735 0.890632 -0.0751031 2 0.909297 0.836269 -0.0730285 2.16667 0.82766 0.762199 -0.0654609 2.33333 0.723086 0.669527 -0.0535585 2.5 0.598472 0.559538 -0.0389345 2.66667 0.457273 0.433692 -0.0235811 2.83333 0.3034 0.29362 -0.00978013 3 0.14112 0.14112 0 XDATA YDATA 1 0.841471 1.22222 0.939861 1.44444 0.992028 1.66667 0.995408 1.88889 0.949834 2.11111 0.857547 2.33333 0.723086 2.55556 0.553064 2.77778 0.355842 3 0.14112 Bernstein approximant of degree N = 9 X F(X) BERN(X) ERROR 1 0.841471 0.841471 0 1.11111 0.896192 0.885496 -0.0106962 1.22222 0.939861 0.919068 -0.0207927 1.33333 0.971938 0.942069 -0.0298691 1.44444 0.992028 0.954449 -0.037579 1.55556 0.999884 0.956228 -0.0436556 1.66667 0.995408 0.947493 -0.0479154 1.77778 0.978656 0.928396 -0.05026 1.88889 0.949834 0.899157 -0.0506769 2 0.909297 0.86006 -0.0492376 2.11111 0.857547 0.811452 -0.0460953 2.22222 0.79522 0.75374 -0.04148 2.33333 0.723086 0.687393 -0.0356927 2.44444 0.642034 0.612936 -0.0290977 2.55556 0.553064 0.53095 -0.022114 2.66667 0.457273 0.442067 -0.0152053 2.77778 0.355842 0.346973 -0.00886895 2.88889 0.250023 0.246398 -0.0036243 3 0.14112 0.14112 0 TEST125 LEAST_SET_OLD sets a least squares polynomial, LEAST_VAL_OLD evaluates it. The data to be interpolated: Number of data values = 21 X Y XTAB YTAB -1 0.37 -0.9 0.41 -0.8 0.45 -0.7 0.5 -0.6 0.55 -0.5 0.61 -0.4 0.67 -0.3 0.74 -0.2 0.82 -0.1 0.9 0 1 0.1 1.11 0.2 1.22 0.3 1.35 0.4 1.49 0.5 1.65 0.6 1.82 0.7 2.01 0.8 2.23 0.9 2.46 1 2.72 Use a polynomial of degree: 1 Total approximation error = 0.180081 X F(X) P(X) Error -1 0.0812987 0.37 -0.288701 -0.966667 0.118398 0.38 -0.261602 -0.933333 0.155498 0.39 -0.234502 -0.9 0.192597 0.41 -0.217403 -0.866667 0.229697 0.42 -0.190303 -0.833333 0.266797 0.43 -0.163203 -0.8 0.303896 0.45 -0.146104 -0.766667 0.340996 0.46 -0.119004 -0.733333 0.378095 0.48 -0.101905 -0.7 0.415195 0.5 -0.0848052 -0.666667 0.452294 0.51 -0.0577056 -0.633333 0.489394 0.53 -0.0406061 -0.6 0.526494 0.55 -0.0235065 -0.566667 0.563593 0.57 -0.00640693 -0.533333 0.600693 0.59 0.0106926 -0.5 0.637792 0.61 0.0277922 -0.466667 0.674892 0.63 0.0448918 -0.433333 0.711991 0.65 0.0619913 -0.4 0.749091 0.67 0.0790909 -0.366667 0.78619 0.69 0.0961905 -0.333333 0.82329 0.72 0.10329 -0.3 0.86039 0.74 0.12039 -0.266667 0.897489 0.77 0.127489 -0.233333 0.934589 0.79 0.144589 -0.2 0.971688 0.82 0.151688 -0.166667 1.00879 0.85 0.158788 -0.133333 1.04589 0.88 0.165887 -0.1 1.08299 0.9 0.182987 -0.0666667 1.12009 0.94 0.180087 -0.0333333 1.15719 0.97 0.187186 0 1.19429 1 0.194286 0.0333333 1.23139 1.03 0.201385 0.0666667 1.26848 1.07 0.198485 0.1 1.30558 1.11 0.195584 0.133333 1.34268 1.14 0.202684 0.166667 1.37978 1.18 0.199784 0.2 1.41688 1.22 0.196883 0.233333 1.45398 1.26 0.193983 0.266667 1.49108 1.31 0.181082 0.3 1.52818 1.35 0.178182 0.333333 1.56528 1.4 0.165281 0.366667 1.60238 1.44 0.162381 0.4 1.63948 1.49 0.149481 0.433333 1.67658 1.54 0.13658 0.466667 1.71368 1.59 0.12368 0.5 1.75078 1.65 0.100779 0.533333 1.78788 1.7 0.0878788 0.566667 1.82498 1.76 0.0649784 0.6 1.86208 1.82 0.0420779 0.633333 1.89918 1.88 0.0191775 0.666667 1.93628 1.95 -0.0137229 0.7 1.97338 2.01 -0.0366234 0.733333 2.01048 2.08 -0.0695238 0.766667 2.04758 2.15 -0.102424 0.8 2.08468 2.23 -0.145325 0.833333 2.12177 2.3 -0.178225 0.866667 2.15887 2.38 -0.221126 0.9 2.19597 2.46 -0.264026 0.933333 2.23307 2.54 -0.306926 0.966667 2.27017 2.63 -0.359827 1 2.30727 2.72 -0.412727 Use a polynomial of degree: 2 Total approximation error = 0.0311249 X F(X) P(X) Error -1 0.425003 0.37 0.0550028 -0.966667 0.426526 0.38 0.046526 -0.933333 0.429255 0.39 0.0392552 -0.9 0.43319 0.41 0.0231903 -0.866667 0.438331 0.42 0.0183314 -0.833333 0.444678 0.43 0.0146785 -0.8 0.452232 0.45 0.00223157 -0.766667 0.460991 0.46 0.000990619 -0.733333 0.470956 0.48 -0.00904435 -0.7 0.482127 0.5 -0.0178733 -0.666667 0.494504 0.51 -0.0154963 -0.633333 0.508087 0.53 -0.0219134 -0.6 0.522876 0.55 -0.0271244 -0.566667 0.53887 0.57 -0.0311295 -0.533333 0.556071 0.59 -0.0339286 -0.5 0.574478 0.61 -0.0355217 -0.466667 0.594091 0.63 -0.0359088 -0.433333 0.61491 0.65 -0.03509 -0.4 0.636935 0.67 -0.0330652 -0.366667 0.660166 0.69 -0.0298344 -0.333333 0.684602 0.72 -0.0353976 -0.3 0.710245 0.74 -0.0297548 -0.266667 0.737094 0.77 -0.0329061 -0.233333 0.765149 0.79 -0.0248514 -0.2 0.794409 0.82 -0.0255907 -0.166667 0.824876 0.85 -0.025124 -0.133333 0.856549 0.88 -0.0234513 -0.1 0.889427 0.9 -0.0105727 -0.0666667 0.923512 0.94 -0.0164881 -0.0333333 0.958803 0.97 -0.0111975 0 0.995299 1 -0.00470088 0.0333333 1.033 1.03 0.00300167 0.0666667 1.07191 1.07 0.00191021 0.1 1.11202 1.11 0.00202473 0.133333 1.15335 1.14 0.0133452 0.166667 1.19587 1.18 0.0158717 0.2 1.2396 1.22 0.0196041 0.233333 1.28454 1.26 0.0245426 0.266667 1.33069 1.31 0.020687 0.3 1.37804 1.35 0.0280374 0.333333 1.42659 1.4 0.0265938 0.366667 1.47636 1.44 0.0363561 0.4 1.52732 1.49 0.0373244 0.433333 1.5795 1.54 0.0394987 0.466667 1.63288 1.59 0.042879 0.5 1.68747 1.65 0.0374653 0.533333 1.74326 1.7 0.0432576 0.566667 1.80026 1.76 0.0402558 0.6 1.85846 1.82 0.03846 0.633333 1.91787 1.88 0.0378702 0.666667 1.97849 1.95 0.0284863 0.7 2.04031 2.01 0.0303085 0.733333 2.10334 2.08 0.0233366 0.766667 2.16757 2.15 0.0175707 0.8 2.23301 2.23 0.00301079 0.833333 2.29966 2.3 -0.00034315 0.866667 2.36751 2.38 -0.0124911 0.9 2.43657 2.46 -0.0234331 0.933333 2.50683 2.54 -0.0331691 0.966667 2.5783 2.63 -0.0516991 1 2.65098 2.72 -0.0690232 Use a polynomial of degree: 3 Total approximation error = 0.00456758 X F(X) P(X) Error -1 0.36387 0.37 -0.00613025 -0.966667 0.378758 0.38 -0.00124174 -0.933333 0.393701 0.39 0.00370079 -0.9 0.408737 0.41 -0.00126294 -0.866667 0.423907 0.42 0.0039068 -0.833333 0.43925 0.43 0.00924974 -0.8 0.454806 0.45 0.00480559 -0.766667 0.470614 0.46 0.0106141 -0.733333 0.486715 0.48 0.00671493 -0.7 0.503148 0.5 0.00314786 -0.666667 0.519953 0.51 0.00995259 -0.633333 0.537169 0.53 0.00716885 -0.6 0.554836 0.55 0.00483637 -0.566667 0.572995 0.57 0.00299485 -0.533333 0.591684 0.59 0.00168403 -0.5 0.610944 0.61 0.00094363 -0.466667 0.630813 0.63 0.000813369 -0.433333 0.651333 0.65 0.00133297 -0.4 0.672542 0.67 0.00254216 -0.366667 0.694481 0.69 0.00448066 -0.333333 0.717188 0.72 -0.00281182 -0.3 0.740704 0.74 0.000704462 -0.266667 0.765069 0.77 -0.00493078 -0.233333 0.790322 0.79 0.000322173 -0.2 0.816503 0.82 -0.00349695 -0.166667 0.843652 0.85 -0.00634843 -0.133333 0.871807 0.88 -0.00819254 -0.1 0.90101 0.9 0.00101043 -0.0666667 0.9313 0.94 -0.00869978 -0.0333333 0.962717 0.97 -0.00728346 0 0.995299 1 -0.00470088 0.0333333 1.02909 1.03 -0.000912325 0.0666667 1.06412 1.07 -0.00587807 0.1 1.10044 1.11 -0.00955838 0.133333 1.13809 1.14 -0.00191355 0.166667 1.1771 1.18 -0.00290385 0.2 1.21751 1.22 -0.00248956 0.233333 1.25937 1.26 -0.000630949 0.266667 1.30271 1.31 -0.0072883 0.3 1.34758 1.35 -0.0024219 0.333333 1.39401 1.4 -0.00599201 0.366667 1.44204 1.44 0.00204108 0.4 1.49172 1.49 0.00171711 0.433333 1.54308 1.54 0.00307578 0.466667 1.59616 1.59 0.00615682 0.5 1.651 1.65 0.000999964 0.533333 1.70764 1.7 0.00764492 0.566667 1.76613 1.76 0.00613142 0.6 1.8265 1.82 0.00649919 0.633333 1.88879 1.88 0.00878794 0.666667 1.95304 1.95 0.00303739 0.7 2.01929 2.01 0.00928728 0.733333 2.08758 2.08 0.00757733 0.766667 2.15795 2.15 0.00794725 0.8 2.23044 2.23 0.000436764 0.833333 2.30509 2.3 0.0050856 0.866667 2.38193 2.38 0.00193349 0.9 2.46102 2.46 0.00102014 0.933333 2.54239 2.54 0.00238528 0.966667 2.62607 2.63 -0.00393137 1 2.71211 2.72 -0.00789008 Use a polynomial of degree: 4 Total approximation error = 0.00233895 X F(X) P(X) Error -1 0.371154 0.37 0.00115377 -0.966667 0.383171 0.38 0.00317135 -0.933333 0.395698 0.39 0.00569822 -0.9 0.408737 0.41 -0.00126294 -0.866667 0.422292 0.42 0.00229188 -0.833333 0.436368 0.43 0.00636796 -0.8 0.450972 0.45 0.000971896 -0.766667 0.466112 0.46 0.00611158 -0.733333 0.481796 0.48 0.00179621 -0.7 0.498036 0.5 -0.00196374 -0.666667 0.514844 0.51 0.00484353 -0.633333 0.532231 0.53 0.00223111 -0.6 0.550213 0.55 0.000213381 -0.566667 0.568806 0.57 -0.00119397 -0.533333 0.588026 0.59 -0.00197396 -0.5 0.607892 0.61 -0.00210829 -0.466667 0.628423 0.63 -0.00157739 -0.433333 0.64964 0.65 -0.000360375 -0.4 0.671565 0.67 0.00156494 -0.366667 0.694222 0.69 0.00422204 -0.333333 0.717636 0.72 -0.00236429 -0.3 0.741832 0.74 0.00183202 -0.266667 0.766838 0.77 -0.00316165 -0.233333 0.792683 0.79 0.00268339 -0.2 0.819397 0.82 -0.000602887 -0.166667 0.847011 0.85 -0.00298921 -0.133333 0.875557 0.88 -0.00444299 -0.1 0.90507 0.9 0.00506964 -0.0666667 0.935584 0.94 -0.00441615 -0.0333333 0.967136 0.97 -0.00286387 0 0.999764 1 -0.000235756 0.0333333 1.03351 1.03 0.00350727 0.0666667 1.06841 1.07 -0.00159443 0.1 1.1045 1.11 -0.00549918 0.133333 1.14184 1.14 0.001836 0.166667 1.18046 1.18 0.000455373 0.2 1.2204 1.22 0.000404507 0.233333 1.26173 1.26 0.00173027 0.266667 1.30448 1.31 -0.00551917 0.3 1.34871 1.35 -0.00129434 0.333333 1.39446 1.4 -0.00554448 0.366667 1.44178 1.44 0.00178247 0.4 1.49074 1.49 0.000739889 0.433333 1.54138 1.54 0.00138243 0.466667 1.59377 1.59 0.00376606 0.5 1.64795 1.65 -0.00205196 0.533333 1.70399 1.7 0.00398693 0.566667 1.76194 1.76 0.0019426 0.6 1.82188 1.82 0.0018762 0.633333 1.88385 1.88 0.00385019 0.666667 1.94793 1.95 -0.00207166 0.7 2.01418 2.01 0.00417569 0.733333 2.08266 2.08 0.00265861 0.766667 2.15344 2.15 0.00344475 0.8 2.2266 2.23 -0.00339693 0.833333 2.3022 2.3 0.00220382 0.866667 2.38032 2.38 0.00031856 0.9 2.46102 2.46 0.00102014 0.933333 2.54438 2.54 0.00438271 0.966667 2.63048 2.63 0.000481728 1 2.71939 2.72 -0.000606061 Use a polynomial of degree: 5 Total approximation error = 0.00222439 X F(X) P(X) Error -1 0.36999 0.37 -1.04244e-05 -0.966667 0.382774 0.38 0.00277433 -0.933333 0.395874 0.39 0.00587415 -0.9 0.409319 0.41 -0.000680841 -0.866667 0.423139 0.42 0.00313857 -0.833333 0.437361 0.43 0.0073608 -0.8 0.452014 0.45 0.00201355 -0.766667 0.467124 0.46 0.00712386 -0.733333 0.482718 0.48 0.00271822 -0.7 0.498823 0.5 -0.00117739 -0.666667 0.515463 0.51 0.0054626 -0.633333 0.532663 0.53 0.00266342 -0.6 0.55045 0.55 0.000450065 -0.566667 0.568847 0.57 -0.00115268 -0.533333 0.58788 0.59 -0.00212012 -0.5 0.607572 0.61 -0.00242757 -0.466667 0.62795 0.63 -0.00205033 -0.433333 0.649036 0.65 -0.000963529 -0.4 0.670858 0.67 0.000857894 -0.366667 0.693439 0.69 0.00343929 -0.333333 0.716806 0.72 -0.00319363 -0.3 0.740985 0.74 0.000985303 -0.266667 0.766003 0.77 -0.00399724 -0.233333 0.791886 0.79 0.00188602 -0.2 0.818663 0.82 -0.00133697 -0.166667 0.846363 0.85 -0.00363749 -0.133333 0.875014 0.88 -0.00498601 -0.1 0.904648 0.9 0.00464793 -0.0666667 0.935296 0.94 -0.00470424 -0.0333333 0.96699 0.97 -0.00301002 0 0.999764 1 -0.000235756 0.0333333 1.03365 1.03 0.00365342 0.0666667 1.06869 1.07 -0.00130634 0.1 1.10492 1.11 -0.00507747 0.133333 1.14238 1.14 0.00237902 0.166667 1.1811 1.18 0.00110366 0.2 1.22114 1.22 0.00113859 0.233333 1.26253 1.26 0.00252765 0.266667 1.30532 1.31 -0.00468357 0.3 1.34955 1.35 -0.000447624 0.333333 1.39528 1.4 -0.00471515 0.366667 1.44257 1.44 0.00256523 0.4 1.49145 1.49 0.00144694 0.433333 1.54199 1.54 0.00198558 0.466667 1.59424 1.59 0.004239 0.5 1.64827 1.65 -0.00173267 0.533333 1.70413 1.7 0.0041331 0.566667 1.7619 1.76 0.00190131 0.6 1.82164 1.82 0.00163952 0.633333 1.88342 1.88 0.00341788 0.666667 1.94731 1.95 -0.00269073 0.7 2.01339 2.01 0.00338935 0.733333 2.08174 2.08 0.0017366 0.766667 2.15243 2.15 0.00243247 0.8 2.22556 2.23 -0.00443858 0.833333 2.30121 2.3 0.00121098 0.866667 2.37947 2.38 -0.000528131 0.9 2.46044 2.46 0.00043804 0.933333 2.54421 2.54 0.00420677 0.966667 2.63088 2.63 0.000878752 1 2.72056 2.72 0.000558138 Use a polynomial of degree: 6 Total approximation error = 0.00221743 X F(X) P(X) Error -1 0.36976 0.37 -0.000239924 -0.966667 0.38279 0.38 0.00279023 -0.933333 0.396044 0.39 0.00604419 -0.9 0.409572 0.41 -0.000428391 -0.866667 0.423419 0.42 0.00341867 -0.833333 0.437628 0.43 0.00762834 -0.8 0.452241 0.45 0.00224063 -0.766667 0.467293 0.46 0.00729293 -0.733333 0.48282 0.48 0.00282018 -0.7 0.498855 0.5 -0.00114478 -0.666667 0.515429 0.51 0.00542895 -0.633333 0.532571 0.53 0.00257064 -0.6 0.550308 0.55 0.000308102 -0.566667 0.568668 0.57 -0.00133204 -0.533333 0.587676 0.59 -0.00232416 -0.5 0.607357 0.61 -0.0026434 -0.466667 0.627735 0.63 -0.00226549 -0.433333 0.648833 0.65 -0.00116654 -0.4 0.670677 0.67 0.000677136 -0.366667 0.693289 0.69 0.00328922 -0.333333 0.716694 0.72 -0.00330647 -0.3 0.740914 0.74 0.000914214 -0.266667 0.765976 0.77 -0.0040241 -0.233333 0.791904 0.79 0.00190382 -0.2 0.818724 0.82 -0.00127601 -0.166667 0.846463 0.85 -0.00353667 -0.133333 0.87515 0.88 -0.00485025 -0.1 0.904812 0.9 0.00481235 -0.0666667 0.935481 0.94 -0.00451855 -0.0333333 0.967189 0.97 -0.00281123 0 0.999967 1 -3.25451e-05 0.0333333 1.03385 1.03 0.00385221 0.0666667 1.06888 1.07 -0.00112064 0.1 1.10509 1.11 -0.00491305 0.133333 1.14251 1.14 0.00251477 0.166667 1.1812 1.18 0.00120447 0.2 1.2212 1.22 0.00119955 0.233333 1.26255 1.26 0.00254545 0.266667 1.30529 1.31 -0.00471043 0.3 1.34948 1.35 -0.000518712 0.333333 1.39517 1.4 -0.00482799 0.366667 1.44242 1.44 0.00241515 0.4 1.49127 1.49 0.00126618 0.433333 1.54178 1.54 0.00178257 0.466667 1.59402 1.59 0.00402384 0.5 1.64805 1.65 -0.0019485 0.533333 1.70393 1.7 0.00392906 0.566667 1.76172 1.76 0.00172195 0.6 1.8215 1.82 0.00149755 0.633333 1.88333 1.88 0.0033251 0.666667 1.94728 1.95 -0.00272437 0.7 2.01342 2.01 0.00342196 0.733333 2.08184 2.08 0.00183856 0.766667 2.1526 2.15 0.00260153 0.8 2.22579 2.23 -0.0042115 0.833333 2.30148 2.3 0.00147852 0.866667 2.37975 2.38 -0.000248027 0.9 2.46069 2.46 0.00069049 0.933333 2.54438 2.54 0.00437681 0.966667 2.63089 2.63 0.000894655 1 2.72033 2.72 0.000328638 TEST126 LEAST_SET sets a least squares polynomial, LEAST_VAL evaluates it. X, F(X), P(X), Error Using polynomial order = 1 -1 -4 -5.63333 -1.63333 -0.9 -4.29 -5.63333 -1.34333 -0.8 -4.56 -5.63333 -1.07333 -0.7 -4.81 -5.63333 -0.823333 -0.6 -5.04 -5.63333 -0.593333 -0.5 -5.25 -5.63333 -0.383333 -0.4 -5.44 -5.63333 -0.193333 -0.3 -5.61 -5.63333 -0.0233333 -0.2 -5.76 -5.63333 0.126667 -0.1 -5.89 -5.63333 0.256667 0 -6 -5.63333 0.366667 0.1 -6.09 -5.63333 0.456667 0.2 -6.16 -5.63333 0.526667 0.3 -6.21 -5.63333 0.576667 0.4 -6.24 -5.63333 0.606667 0.5 -6.25 -5.63333 0.616667 0.6 -6.24 -5.63333 0.606667 0.7 -6.21 -5.63333 0.576667 0.8 -6.16 -5.63333 0.526667 0.9 -6.09 -5.63333 0.456667 1 -6 -5.63333 0.366667 Using polynomial order = 2 -1 -4 -4.63333 -0.633333 -0.9 -4.29 -4.73333 -0.443333 -0.8 -4.56 -4.83333 -0.273333 -0.7 -4.81 -4.93333 -0.123333 -0.6 -5.04 -5.03333 0.00666667 -0.5 -5.25 -5.13333 0.116667 -0.4 -5.44 -5.23333 0.206667 -0.3 -5.61 -5.33333 0.276667 -0.2 -5.76 -5.43333 0.326667 -0.1 -5.89 -5.53333 0.356667 0 -6 -5.63333 0.366667 0.1 -6.09 -5.73333 0.356667 0.2 -6.16 -5.83333 0.326667 0.3 -6.21 -5.93333 0.276667 0.4 -6.24 -6.03333 0.206667 0.5 -6.25 -6.13333 0.116667 0.6 -6.24 -6.23333 0.00666667 0.7 -6.21 -6.33333 -0.123333 0.8 -6.16 -6.43333 -0.273333 0.9 -6.09 -6.53333 -0.443333 1 -6 -6.63333 -0.633333 Using polynomial order = 3 -1 -4 -4 1.77636e-15 -0.9 -4.29 -4.29 1.77636e-15 -0.8 -4.56 -4.56 8.88178e-16 -0.7 -4.81 -4.81 1.77636e-15 -0.6 -5.04 -5.04 8.88178e-16 -0.5 -5.25 -5.25 8.88178e-16 -0.4 -5.44 -5.44 8.88178e-16 -0.3 -5.61 -5.61 8.88178e-16 -0.2 -5.76 -5.76 8.88178e-16 -0.1 -5.89 -5.89 8.88178e-16 0 -6 -6 8.88178e-16 0.1 -6.09 -6.09 8.88178e-16 0.2 -6.16 -6.16 8.88178e-16 0.3 -6.21 -6.21 8.88178e-16 0.4 -6.24 -6.24 1.77636e-15 0.5 -6.25 -6.25 1.77636e-15 0.6 -6.24 -6.24 1.77636e-15 0.7 -6.21 -6.21 1.77636e-15 0.8 -6.16 -6.16 1.77636e-15 0.9 -6.09 -6.09 1.77636e-15 1 -6 -6 2.66454e-15 Using polynomial order = 4 -1 -4 -4 3.10862e-15 -0.9 -4.29 -4.29 2.66454e-15 -0.8 -4.56 -4.56 8.88178e-16 -0.7 -4.81 -4.81 8.88178e-16 -0.6 -5.04 -5.04 0 -0.5 -5.25 -5.25 0 -0.4 -5.44 -5.44 -8.88178e-16 -0.3 -5.61 -5.61 8.88178e-16 -0.2 -5.76 -5.76 0 -0.1 -5.89 -5.89 0 0 -6 -6 8.88178e-16 0.1 -6.09 -6.09 8.88178e-16 0.2 -6.16 -6.16 1.77636e-15 0.3 -6.21 -6.21 8.88178e-16 0.4 -6.24 -6.24 2.66454e-15 0.5 -6.25 -6.25 2.66454e-15 0.6 -6.24 -6.24 2.66454e-15 0.7 -6.21 -6.21 1.77636e-15 0.8 -6.16 -6.16 1.77636e-15 0.9 -6.09 -6.09 8.88178e-16 1 -6 -6 8.88178e-16 TEST127 LEAST_SET sets a least squares polynomial, LEAST_VAL2 evaluates it. X, F(X), P(X), FP(X), PP(X) Using polynomial order = 1 -1 -4 -5.63333 -3 0 -0.9 -4.29 -5.63333 -2.8 0 -0.8 -4.56 -5.63333 -2.6 0 -0.7 -4.81 -5.63333 -2.4 0 -0.6 -5.04 -5.63333 -2.2 0 -0.5 -5.25 -5.63333 -2 0 -0.4 -5.44 -5.63333 -1.8 0 -0.3 -5.61 -5.63333 -1.6 0 -0.2 -5.76 -5.63333 -1.4 0 -0.1 -5.89 -5.63333 -1.2 0 0 -6 -5.63333 -1 0 0.1 -6.09 -5.63333 -0.8 0 0.2 -6.16 -5.63333 -0.6 0 0.3 -6.21 -5.63333 -0.4 0 0.4 -6.24 -5.63333 -0.2 0 0.5 -6.25 -5.63333 0 0 0.6 -6.24 -5.63333 0.2 0 0.7 -6.21 -5.63333 0.4 0 0.8 -6.16 -5.63333 0.6 0 0.9 -6.09 -5.63333 0.8 0 1 -6 -5.63333 1 0 Using polynomial order = 2 -1 -4 -4.63333 -3 -1 -0.9 -4.29 -4.73333 -2.8 -1 -0.8 -4.56 -4.83333 -2.6 -1 -0.7 -4.81 -4.93333 -2.4 -1 -0.6 -5.04 -5.03333 -2.2 -1 -0.5 -5.25 -5.13333 -2 -1 -0.4 -5.44 -5.23333 -1.8 -1 -0.3 -5.61 -5.33333 -1.6 -1 -0.2 -5.76 -5.43333 -1.4 -1 -0.1 -5.89 -5.53333 -1.2 -1 0 -6 -5.63333 -1 -1 0.1 -6.09 -5.73333 -0.8 -1 0.2 -6.16 -5.83333 -0.6 -1 0.3 -6.21 -5.93333 -0.4 -1 0.4 -6.24 -6.03333 -0.2 -1 0.5 -6.25 -6.13333 0 -1 0.6 -6.24 -6.23333 0.2 -1 0.7 -6.21 -6.33333 0.4 -1 0.8 -6.16 -6.43333 0.6 -1 0.9 -6.09 -6.53333 0.8 -1 1 -6 -6.63333 1 -1 Using polynomial order = 3 -1 -4 -4 -3 -3 -0.9 -4.29 -4.29 -2.8 -2.8 -0.8 -4.56 -4.56 -2.6 -2.6 -0.7 -4.81 -4.81 -2.4 -2.4 -0.6 -5.04 -5.04 -2.2 -2.2 -0.5 -5.25 -5.25 -2 -2 -0.4 -5.44 -5.44 -1.8 -1.8 -0.3 -5.61 -5.61 -1.6 -1.6 -0.2 -5.76 -5.76 -1.4 -1.4 -0.1 -5.89 -5.89 -1.2 -1.2 0 -6 -6 -1 -1 0.1 -6.09 -6.09 -0.8 -0.8 0.2 -6.16 -6.16 -0.6 -0.6 0.3 -6.21 -6.21 -0.4 -0.4 0.4 -6.24 -6.24 -0.2 -0.2 0.5 -6.25 -6.25 0 1.66533e-15 0.6 -6.24 -6.24 0.2 0.2 0.7 -6.21 -6.21 0.4 0.4 0.8 -6.16 -6.16 0.6 0.6 0.9 -6.09 -6.09 0.8 0.8 1 -6 -6 1 1 Using polynomial order = 4 -1 -4 -4 -3 -3 -0.9 -4.29 -4.29 -2.8 -2.8 -0.8 -4.56 -4.56 -2.6 -2.6 -0.7 -4.81 -4.81 -2.4 -2.4 -0.6 -5.04 -5.04 -2.2 -2.2 -0.5 -5.25 -5.25 -2 -2 -0.4 -5.44 -5.44 -1.8 -1.8 -0.3 -5.61 -5.61 -1.6 -1.6 -0.2 -5.76 -5.76 -1.4 -1.4 -0.1 -5.89 -5.89 -1.2 -1.2 0 -6 -6 -1 -1 0.1 -6.09 -6.09 -0.8 -0.8 0.2 -6.16 -6.16 -0.6 -0.6 0.3 -6.21 -6.21 -0.4 -0.4 0.4 -6.24 -6.24 -0.2 -0.2 0.5 -6.25 -6.25 0 1.36238e-15 0.6 -6.24 -6.24 0.2 0.2 0.7 -6.21 -6.21 0.4 0.4 0.8 -6.16 -6.16 0.6 0.6 0.9 -6.09 -6.09 0.8 0.8 1 -6 -6 1 1 TEST13 SPLINE_B_VAL evaluates the B spline. TDATA YDATA 0 0 1 0.587785 2 0.951057 3 0.951057 4 0.587785 5 1.22465e-16 6 -0.587785 7 -0.951057 8 -0.951057 9 -0.587785 10 -2.44929e-16 T, Spline(T) 0.5 0.289215 0.375 0.218446 0.25 0.146362 0.125 0.0734001 * 0 0 0.25 0.146362 0.5 0.289215 0.75 0.425053 * 1 0.550366 1.25 0.661871 1.5 0.757175 1.75 0.834112 * 2 0.890511 2.25 0.924568 2.5 0.93592 2.75 0.924568 * 3 0.890511 3.25 0.834112 3.5 0.757175 3.75 0.661871 * 4 0.550366 4.25 0.425053 4.5 0.289215 4.75 0.146362 * 5 1.11022e-16 5.25 -0.146362 5.5 -0.289215 5.75 -0.425053 * 6 -0.550366 6.25 -0.661871 6.5 -0.757175 6.75 -0.834112 * 7 -0.890511 7.25 -0.924568 7.5 -0.93592 7.75 -0.924568 * 8 -0.890511 8.25 -0.834112 8.5 -0.757175 8.75 -0.661871 * 9 -0.550366 9.25 -0.425053 9.5 -0.289215 9.75 -0.146362 * 10 -2.498e-16 10.125 0.0734001 10.25 0.146362 10.375 0.218446 10.5 0.289215 TEST14 SPLINE_BETA_VAL evaluates the BETA spline. TDATA YDATA 0 0 1 0.587785 2 0.951057 3 0.951057 4 0.587785 5 1.22465e-16 6 -0.587785 7 -0.951057 8 -0.951057 9 -0.587785 10 -2.44929e-16 BETA1 = 1 BETA2 = 0 T, Spline(T) -0.5 -0.289215 -0.375 -0.218446 -0.25 -0.146362 -0.125 -0.0734001 * 0 0 0.25 0.146362 0.5 0.289215 0.75 0.425053 * 1 0.550366 1.25 0.661871 1.5 0.757175 1.75 0.834112 * 2 0.890511 2.25 0.924568 2.5 0.93592 2.75 0.924568 * 3 0.890511 3.25 0.834112 3.5 0.757175 3.75 0.661871 * 4 0.550366 4.25 0.425053 4.5 0.289215 4.75 0.146362 * 5 1.11022e-16 5.25 -0.146362 5.5 -0.289215 5.75 -0.425053 * 6 -0.550366 6.25 -0.661871 6.5 -0.757175 6.75 -0.834112 * 7 -0.890511 7.25 -0.924568 7.5 -0.93592 7.75 -0.924568 * 8 -0.890511 8.25 -0.834112 8.5 -0.757175 8.75 -0.661871 * 9 -0.550366 9.25 -0.425053 9.5 -0.289215 9.75 -0.146362 * 10 -2.498e-16 10.125 0.0734001 10.25 0.146362 10.375 0.218446 10.5 0.289215 BETA1 = 1 BETA2 = 100 T, Spline(T) -0.5 0.493821 -0.375 0.253349 -0.25 0.0991202 -0.125 0.0187861 * 0 0 0.25 0.0976829 0.5 0.293391 0.75 0.488348 * 1 0.583776 1.25 0.646403 1.5 0.768109 1.75 0.887847 * 2 0.94457 2.25 0.948218 2.5 0.949435 2.75 0.948218 * 3 0.94457 3.25 0.887847 3.5 0.768109 3.75 0.646403 * 4 0.583776 4.25 0.488348 4.5 0.293391 4.75 0.0976829 * 5 1.21431e-16 5.25 -0.0976829 5.5 -0.293391 5.75 -0.488348 * 6 -0.583776 6.25 -0.646403 6.5 -0.768109 6.75 -0.887847 * 7 -0.94457 7.25 -0.948218 7.5 -0.949435 7.75 -0.948218 * 8 -0.94457 8.25 -0.887847 8.5 -0.768109 8.75 -0.646403 * 9 -0.583776 9.25 -0.488348 9.5 -0.293391 9.75 -0.0976829 * 10 -2.44596e-16 10.125 -0.0187861 10.25 -0.0991202 10.375 -0.253349 10.5 -0.493821 BETA1 = 100 BETA2 = 0 T, Spline(T) -0.5 -1.93953 -0.375 -1.49508 -0.25 -1.12416 -0.125 -0.820073 * 0 -0.576146 0.25 -0.242029 0.5 -0.0683376 0.75 -0.00160438 * 1 0.0116391 1.25 0.345362 1.5 0.518042 1.75 0.583355 * 2 0.594978 2.25 0.800836 2.5 0.906547 2.75 0.945493 * 3 0.951056 3.25 0.950418 3.5 0.948782 3.75 0.946484 * 4 0.943863 4.25 0.736973 4.5 0.628614 4.75 0.585951 * 5 0.576146 5.25 0.242029 5.5 0.0683376 5.75 0.00160438 * 6 -0.0116391 6.25 -0.345362 6.5 -0.518042 6.75 -0.583355 * 7 -0.594978 7.25 -0.800836 7.5 -0.906547 7.75 -0.945493 * 8 -0.951056 8.25 -0.950418 8.5 -0.948782 8.75 -0.946484 * 9 -0.943863 9.25 -0.736973 9.5 -0.628614 9.75 -0.585951 * 10 -0.576146 10.125 -0.573304 10.25 -0.566362 10.375 -0.551217 10.5 -0.523763 TEST145 SPLINE_CONSTANT_VAL evaluates a piecewise constant spline. Runge's function, evenly spaced knots. The data to be interpolated: Number of data values = 12 T Y * 0.0384615 * -1 * 0.0470588 * -0.8 * 0.0754717 * -0.6 * 0.137931 * -0.4 * 0.307692 * -0.2 * 0.8 * 0 * 0.8 * 0.2 * 0.307692 * 0.4 * 0.137931 * 0.6 * 0.0754717 * 0.8 * 0.0470588 * 1 * 0.0384615 T Y(interp) Y(exact) * 0.0384615 -1.99265 0.0384615 0.00997347 -1.94553 0.0384615 0.0104573 -1.82468 0.0384615 0.0118713 -1.75309 0.0384615 0.012848 -1.73553 0.0384615 0.013106 -1.62182 0.0384615 0.0149796 -1.56017 0.0384615 0.0161672 -1.12633 0.0384615 0.0305667 * -1 0.0384615 * 0.0470588 -0.969689 0.0470588 0.040804 * -0.8 0.0588235 * 0.0754717 * -0.6 0.1 * 0.137931 -0.596991 0.137931 0.100909 * -0.4 0.2 * 0.307692 -0.394775 0.307692 0.204241 -0.338772 0.307692 0.258454 -0.201844 0.307692 0.495411 * -0.2 0.5 * 0.8 * 0 1 * 0.8 * 0.2 0.5 * 0.307692 0.246782 0.307692 0.396427 * 0.4 0.2 * 0.137931 0.535863 0.137931 0.122268 * 0.6 0.1 * 0.0754717 * 0.8 0.0588235 * 0.0470588 * 1 0.0384615 * 0.0384615 1.01869 0.0384615 0.0371148 1.18915 0.0384615 0.0275089 1.31804 0.0384615 0.022507 1.59002 0.0384615 0.0155754 1.82527 0.0384615 0.0118638 TEST15 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL evaluates it. Runge's function, evenly spaced knots. I T Y 0 -1 0.0384615 1 -0.8 0.0588235 2 -0.6 0.1 3 -0.4 0.2 4 -0.2 0.5 5 0 1 6 0.2 0.5 7 0.4 0.2 8 0.6 0.1 9 0.8 0.0588235 10 1 0.0384615 Boundary condition 0 at both ends: Spline is quadratic in boundary intervals. SPLINE''(T), F''(T): 0.323396 0.210514 0.323396 0.478323 1.50519 1.3 2.47937 4.4 18.5773 12.5 -46.7887 -50 18.5773 12.5 2.47937 4.4 1.50519 1.3 0.323396 0.478323 0.323396 0.210514 T, SPLINE(T), F(T) -2 0.130689 0.00990099 -1 0.0384615 0.0384615 -0.9 0.0470256 0.0470588 -0.8 0.0588235 0.0588235 -0.7 0.0748403 0.0754717 -0.6 0.1 0.1 -0.5 0.140039 0.137931 -0.4 0.2 0.2 -0.3 0.297358 0.307692 -0.2 0.5 0.5 -0.1 0.820528 0.8 0 1 1 0.1 0.820528 0.8 0.2 0.5 0.5 0.3 0.297358 0.307692 0.4 0.2 0.2 0.5 0.140039 0.137931 0.6 0.1 0.1 0.7 0.0748403 0.0754717 0.8 0.0588235 0.0588235 0.9 0.0470256 0.0470588 1 0.0384615 0.0384615 2 0.130689 0.00990099 Boundary condition 1 at both ends: Y'(left) = 0.0739645 Y'(right) = -0.0739645 SPLINE''(T), F''(T): 0.245555 0.210514 0.344254 0.478323 1.4996 1.3 2.48088 4.4 18.5769 12.5 -46.7884 -50 18.5769 12.5 2.48088 4.4 1.4996 1.3 0.344254 0.478323 0.245555 0.210514 T, SPLINE(T), F(T) -2 0.00502451 0.00990099 -1 0.0384615 0.0384615 -0.9 0.047168 0.0470588 -0.8 0.0588235 0.0588235 -0.7 0.0748021 0.0754717 -0.6 0.1 0.1 -0.5 0.140049 0.137931 -0.4 0.2 0.2 -0.3 0.297356 0.307692 -0.2 0.5 0.5 -0.1 0.820529 0.8 0 1 1 0.1 0.820529 0.8 0.2 0.5 0.5 0.3 0.297356 0.307692 0.4 0.2 0.2 0.5 0.140049 0.137931 0.6 0.1 0.1 0.7 0.0748021 0.0754717 0.8 0.0588235 0.0588235 0.9 0.047168 0.0470588 1 0.0384615 0.0384615 2 0.00502451 0.00990099 Boundary condition 2 at both ends: YP''(left) = 0.210514 YP''(right) = 0.210514 SPLINE''(T), F''(T): 0.210514 0.210514 0.353644 0.478323 1.49708 1.3 2.48155 4.4 18.5767 12.5 -46.7883 -50 18.5767 12.5 2.48155 4.4 1.49708 1.3 0.353644 0.478323 0.210514 0.210514 T, SPLINE(T), F(T) -2 -0.0515433 0.00990099 -1 0.0384615 0.0384615 -0.9 0.0472321 0.0470588 -0.8 0.0588235 0.0588235 -0.7 0.0747849 0.0754717 -0.6 0.1 0.1 -0.5 0.140053 0.137931 -0.4 0.2 0.2 -0.3 0.297354 0.307692 -0.2 0.5 0.5 -0.1 0.820529 0.8 0 1 1 0.1 0.820529 0.8 0.2 0.5 0.5 0.3 0.297354 0.307692 0.4 0.2 0.2 0.5 0.140053 0.137931 0.6 0.1 0.1 0.7 0.0747849 0.0754717 0.8 0.0588235 0.0588235 0.9 0.0472321 0.0470588 1 0.0384615 0.0384615 2 -0.0515433 0.00990099 Natural spline: YP''(left) = 0 YP''(right) = 0 SPLINE''(T), F''(T): 0 0.210514 0.410052 0.478323 1.48196 1.3 2.48563 4.4 18.5755 12.5 -46.7878 -50 18.5755 12.5 2.48563 4.4 1.48196 1.3 0.410052 0.478323 0 0.210514 T, SPLINE(T), F(T) -2 -0.39139 0.00990099 -1 0.0384615 0.0384615 -0.9 0.0476174 0.0470588 -0.8 0.0588235 0.0588235 -0.7 0.0746817 0.0754717 -0.6 0.1 0.1 -0.5 0.140081 0.137931 -0.4 0.2 0.2 -0.3 0.297347 0.307692 -0.2 0.5 0.5 -0.1 0.820531 0.8 0 1 1 0.1 0.820531 0.8 0.2 0.5 0.5 0.3 0.297347 0.307692 0.4 0.2 0.2 0.5 0.140081 0.137931 0.6 0.1 0.1 0.7 0.0746817 0.0754717 0.8 0.0588235 0.0588235 0.9 0.0476174 0.0470588 1 0.0384615 0.0384615 2 -0.39139 0.00990099 "Not-a-not" spline: SPLINE''(T), F''(T): -0.411671 0.210514 0.520362 0.478323 1.4524 1.3 2.49359 4.4 18.5733 12.5 -46.7866 -50 18.5733 12.5 2.49359 4.4 1.4524 1.3 0.520362 0.478323 -0.411671 0.210514 T, SPLINE(T), F(T) -2 -1.05598 0.00990099 -1 0.0384615 0.0384615 -0.9 0.0483708 0.0470588 -0.8 0.0588235 0.0588235 -0.7 0.0744799 0.0754717 -0.6 0.1 0.1 -0.5 0.140135 0.137931 -0.4 0.2 0.2 -0.3 0.297333 0.307692 -0.2 0.5 0.5 -0.1 0.820533 0.8 0 1 1 0.1 0.820533 0.8 0.2 0.5 0.5 0.3 0.297333 0.307692 0.4 0.2 0.2 0.5 0.140135 0.137931 0.6 0.1 0.1 0.7 0.0744799 0.0754717 0.8 0.0588235 0.0588235 0.9 0.0483708 0.0470588 1 0.0384615 0.0384615 2 -1.05598 0.00990099 TEST16 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL2 evaluates it. Runge's function, evenly spaced knots. I T Y 0 -1 0.0384615 1 -0.8 0.0588235 2 -0.6 0.1 3 -0.4 0.2 4 -0.2 0.5 5 0 1 6 0.2 0.5 7 0.4 0.2 8 0.6 0.1 9 0.8 0.0588235 10 1 0.0384615 Boundary condition 0 at both ends: Spline is quadratic in boundary intervals. SPLINE''(T), F''(T): 0.323396 0.210514 0.323396 0.478323 1.50519 1.3 2.47937 4.4 18.5773 12.5 -46.7887 -50 18.5773 12.5 2.47937 4.4 1.50519 1.3 0.323396 0.478323 0.323396 0.210514 T, SPLINE(T), F(T), LEFT_IN, LEFT_OUT -2 -0.399681 0.00990099 0 0 -1 0.0384615 0.0384615 0 0 -0.9 0.105399 0.0470588 0 0 -0.8 0.175246 0.0588235 0 0 -0.7 0.0738555 0.0754717 0 1 -0.6 0.0921214 0.1 1 1 -0.5 0.140212 0.137931 1 2 -0.4 0.201384 0.2 2 2 -0.3 0.284755 0.307692 2 3 -0.2 0.399175 0.5 3 3 -0.1 0.888415 0.8 3 4 0 1.54309 1 4 4 0.1 0.711585 0.8 4 5 0.2 -0.371546 0.5 5 5 0.3 0.365245 0.307692 5 6 0.4 0.743093 0.2 6 6 0.5 0.127435 0.137931 6 7 0.6 -0.000825126 0.1 7 7 0.7 0.0750133 0.0754717 7 8 0.8 0.0602076 0.0588235 8 8 0.9 0.0460407 0.0470588 8 9 1 0.0305829 0.0384615 9 9 2 -1.57109 0.00990099 9 9 Boundary condition 1 at both ends: Y'(left) = 0.0739645 Y'(right) = -0.0739645 SPLINE''(T), F''(T): 0.245555 0.210514 0.344254 0.478323 1.4996 1.3 2.48088 4.4 18.5769 12.5 -46.7884 -50 18.5769 12.5 2.48088 4.4 1.4996 1.3 0.344254 0.478323 0.245555 0.210514 T, SPLINE(T), F(T), LEFT_IN, LEFT_OUT -2 -0.477522 0.00990099 0 0 -1 0.0384615 0.0384615 0 0 -0.9 0.107617 0.0470588 0 0 -0.8 0.178983 0.0588235 0 0 -0.7 0.0739216 0.0754717 0 1 -0.6 0.0929557 0.1 1 1 -0.5 0.140194 0.137931 1 2 -0.4 0.20116 0.2 2 2 -0.3 0.28476 0.307692 2 3 -0.2 0.399235 0.5 3 3 -0.1 0.888413 0.8 3 4 0 1.54308 1 4 4 0.1 0.711587 0.8 4 5 0.2 -0.371538 0.5 5 5 0.3 0.36524 0.307692 5 6 0.4 0.743076 0.2 6 6 0.5 0.127453 0.137931 6 7 0.6 -0.000764917 0.1 7 7 0.7 0.0749472 0.0754717 7 8 0.8 0.059984 0.0588235 8 8 0.9 0.0462875 0.0470588 8 9 1 0.0314172 0.0384615 9 9 2 -1.51654 0.00990099 9 9 Boundary condition 2 at both ends: YP''(left) = 0.210514 YP''(right) = 0.210514 SPLINE''(T), F''(T): 0.210514 0.210514 0.353644 0.478323 1.49708 1.3 2.48155 4.4 18.5767 12.5 -46.7883 -50 18.5767 12.5 2.48155 4.4 1.49708 1.3 0.353644 0.478323 0.210514 0.210514 T, SPLINE(T), F(T), LEFT_IN, LEFT_OUT -2 -0.512563 0.00990099 0 0 -1 0.0384615 0.0384615 0 0 -0.9 0.108616 0.0470588 0 0 -0.8 0.180665 0.0588235 0 0 -0.7 0.0739514 0.0754717 0 1 -0.6 0.0933313 0.1 1 1 -0.5 0.140186 0.137931 1 2 -0.4 0.20106 0.2 2 2 -0.3 0.284762 0.307692 2 3 -0.2 0.399262 0.5 3 3 -0.1 0.888413 0.8 3 4 0 1.54307 1 4 4 0.1 0.711587 0.8 4 5 0.2 -0.371534 0.5 5 5 0.3 0.365238 0.307692 5 6 0.4 0.743068 0.2 6 6 0.5 0.127461 0.137931 6 7 0.6 -0.000737814 0.1 7 7 0.7 0.0749174 0.0754717 7 8 0.8 0.0598833 0.0588235 8 8 0.9 0.0463985 0.0470588 8 9 1 0.0317928 0.0384615 9 9 2 -1.49199 0.00990099 9 9 TEST17 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL evaluates it. Cubic function, unevenly spaced knots. T, Y 0 0 4 1 0.01 4.0302 2 0.04 4.12326 3 0.09 4.28693 4 0.16 4.5353 5 0.25 4.89062 6 0.36 5.38586 7 0.49 6.06785 8 0.64 7.00134 9 0.81 8.27364 10 1 10 Boundary condition 0 at both ends: Spline is quadratic in boundary intervals. SPLINE''(T), F''(T): 4.08313 4 4.08313 4.06 4.28559 4.24 4.5783 4.54 5.00033 4.96 5.54069 5.5 6.19653 6.16 6.99433 6.94 7.82227 7.84 9.13008 8.86 9.13008 10 T, SPLINE(T), F(T) -1 3.04188 2 0 4 4 0.005 4.01505 4.01505 0.01 4.0302 4.0302 0.025 4.07626 4.07627 0.04 4.12326 4.12326 0.065 4.20371 4.20372 0.09 4.28693 4.28693 0.125 4.40818 4.4082 0.16 4.5353 4.5353 0.205 4.70762 4.70767 0.25 4.89062 4.89062 0.305 5.12936 5.12942 0.36 5.38586 5.38586 0.425 5.71292 5.71302 0.49 6.06785 6.06785 0.565 6.51376 6.51381 0.64 7.00134 7.00134 0.725 7.60687 7.60733 0.81 8.27364 8.27364 0.905 9.09562 9.09427 1 10 10 2 24.5185 26 Boundary condition 1 at both ends: Y'(left) = 3 Y'(right) = 10 SPLINE''(T), F''(T): 3.96541 4 4.12918 4.06 4.27031 4.24 4.58302 4.54 4.99908 4.96 5.54033 5.5 6.19966 6.16 6.9811 6.94 7.87564 7.84 8.91737 8.86 9.97132 10 T, SPLINE(T), F(T) -1 0.253146 2 0 4 4 0.005 4.01505 4.01505 0.01 4.0302 4.0302 0.025 4.07626 4.07627 0.04 4.12326 4.12326 0.065 4.20371 4.20372 0.09 4.28693 4.28693 0.125 4.40818 4.4082 0.16 4.5353 4.5353 0.205 4.70762 4.70767 0.25 4.89062 4.89062 0.305 5.12936 5.12942 0.36 5.38586 5.38586 0.425 5.71293 5.71302 0.49 6.06785 6.06785 0.565 6.5137 6.51381 0.64 7.00134 7.00134 0.725 7.60716 7.60733 0.81 8.27364 8.27364 0.905 9.0942 9.09427 1 10 10 2 25.9102 26 Boundary condition 2 at both ends: YP''(left) = 4 YP''(right) = 10 SPLINE''(T), F''(T): 4 4 4.11565 4.06 4.27481 4.24 4.58162 4.54 4.99951 4.96 5.54018 5.5 6.1998 6.16 6.98064 6.94 7.87746 7.84 8.91012 8.86 10 10 T, SPLINE(T), F(T) -1 1.07261 2 0 4 4 0.005 4.01505 4.01505 0.01 4.0302 4.0302 0.025 4.07626 4.07627 0.04 4.12326 4.12326 0.065 4.20371 4.20372 0.09 4.28693 4.28693 0.125 4.40818 4.4082 0.16 4.5353 4.5353 0.205 4.70762 4.70767 0.25 4.89062 4.89062 0.305 5.12936 5.12942 0.36 5.38586 5.38586 0.425 5.71293 5.71302 0.49 6.06785 6.06785 0.565 6.5137 6.51381 0.64 7.00134 7.00134 0.725 7.60717 7.60733 0.81 8.27364 8.27364 0.905 9.09415 9.09427 1 10 10 2 25.9576 26 TEST18 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL evaluates it. Cubic function, evenly spaced knots. T Y 0 4 0.1 4.321 0.2 4.688 0.3 5.107 0.4 5.584 0.5 6.125 0.6 6.736 0.7 7.423 0.8 8.192 0.9 9.049 1 10 Boundary condition 0 at both ends: Spline is quadratic in boundary intervals. SPLINE''(T) F''(T): 4.47321 4 4.47321 4.6 5.23396 5.2 5.79094 5.8 6.40226 6.4 7 7 7.59774 7.6 8.20906 8.2 8.76604 8.8 9.52679 9.4 9.52679 10 T SPLINE(T) F(T) -1 3.25026 2 -1.48687 2 4.47321 -2 0 4 4 2.98634 3 4.47321 4 0.05 4.15491 4.15512 3.21 3.2075 4.47321 4.3 0.1 4.321 4.321 3.43366 3.43 4.47321 4.6 0.15 4.49843 4.49838 3.66683 3.6675 4.85358 4.9 0.2 4.688 4.688 3.91902 3.92 5.23396 5.2 0.25 4.89061 4.89062 4.18768 4.1875 5.51245 5.5 0.3 5.107 5.107 4.47026 4.47 5.79094 5.8 0.35 5.33788 5.33788 4.76745 4.7675 6.0966 6.1 0.4 5.584 5.584 5.07992 5.08 6.40226 6.4 0.45 5.84612 5.84612 5.40751 5.4075 6.70113 6.7 0.5 6.125 6.125 5.75004 5.75 7 7 0.55 6.42138 6.42138 6.10751 6.1075 7.29887 7.3 0.6 6.736 6.736 6.47992 6.48 7.59774 7.6 0.65 7.06962 7.06963 6.86745 6.8675 7.9034 7.9 0.7 7.423 7.423 7.27026 7.27 8.20906 8.2 0.75 7.79689 7.79688 7.68768 7.6875 8.48755 8.5 0.8 8.192 8.192 8.11902 8.12 8.76604 8.8 0.85 8.60907 8.60913 8.56683 8.5675 9.14642 9.1 0.9 9.049 9.049 9.03366 9.03 9.52679 9.4 0.95 9.51259 9.51237 9.51 9.5075 9.52679 9.7 1 10 10 9.98634 10 9.52679 10 2 24.7497 26 19.5131 23 9.52679 16 Boundary condition 1 at both ends: Y'(left) = 3 Y'(right) = 10 SPLINE''(T) F''(T): 4 4 4.6 4.6 5.2 5.2 5.8 5.8 6.4 6.4 7 7 7.6 7.6 8.2 8.2 8.8 8.8 9.4 9.4 10 10 T SPLINE(T) F(T) -1 2 2 2 2 -2 -2 0 4 4 3 3 4 4 0.05 4.15512 4.15512 3.2075 3.2075 4.3 4.3 0.1 4.321 4.321 3.43 3.43 4.6 4.6 0.15 4.49837 4.49838 3.6675 3.6675 4.9 4.9 0.2 4.688 4.688 3.92 3.92 5.2 5.2 0.25 4.89062 4.89062 4.1875 4.1875 5.5 5.5 0.3 5.107 5.107 4.47 4.47 5.8 5.8 0.35 5.33787 5.33788 4.7675 4.7675 6.1 6.1 0.4 5.584 5.584 5.08 5.08 6.4 6.4 0.45 5.84612 5.84612 5.4075 5.4075 6.7 6.7 0.5 6.125 6.125 5.75 5.75 7 7 0.55 6.42138 6.42138 6.1075 6.1075 7.3 7.3 0.6 6.736 6.736 6.48 6.48 7.6 7.6 0.65 7.06963 7.06963 6.8675 6.8675 7.9 7.9 0.7 7.423 7.423 7.27 7.27 8.2 8.2 0.75 7.79688 7.79688 7.6875 7.6875 8.5 8.5 0.8 8.192 8.192 8.12 8.12 8.8 8.8 0.85 8.60913 8.60913 8.5675 8.5675 9.1 9.1 0.9 9.049 9.049 9.03 9.03 9.4 9.4 0.95 9.51237 9.51237 9.5075 9.5075 9.7 9.7 1 10 10 10 10 10 10 2 26 26 23 23 16 16 Boundary condition 2 at both ends: YP''(left) = 4 YP''(right) = 10 SPLINE''(T) F''(T): 4 4 4.6 4.6 5.2 5.2 5.8 5.8 6.4 6.4 7 7 7.6 7.6 8.2 8.2 8.8 8.8 9.4 9.4 10 10 T SPLINE(T) F(T) -1 2 2 2 2 -2 -2 0 4 4 3 3 4 4 0.05 4.15512 4.15512 3.2075 3.2075 4.3 4.3 0.1 4.321 4.321 3.43 3.43 4.6 4.6 0.15 4.49837 4.49838 3.6675 3.6675 4.9 4.9 0.2 4.688 4.688 3.92 3.92 5.2 5.2 0.25 4.89062 4.89062 4.1875 4.1875 5.5 5.5 0.3 5.107 5.107 4.47 4.47 5.8 5.8 0.35 5.33787 5.33788 4.7675 4.7675 6.1 6.1 0.4 5.584 5.584 5.08 5.08 6.4 6.4 0.45 5.84612 5.84612 5.4075 5.4075 6.7 6.7 0.5 6.125 6.125 5.75 5.75 7 7 0.55 6.42138 6.42138 6.1075 6.1075 7.3 7.3 0.6 6.736 6.736 6.48 6.48 7.6 7.6 0.65 7.06963 7.06963 6.8675 6.8675 7.9 7.9 0.7 7.423 7.423 7.27 7.27 8.2 8.2 0.75 7.79688 7.79688 7.6875 7.6875 8.5 8.5 0.8 8.192 8.192 8.12 8.12 8.8 8.8 0.85 8.60913 8.60913 8.5675 8.5675 9.1 9.1 0.9 9.049 9.049 9.03 9.03 9.4 9.4 0.95 9.51237 9.51237 9.5075 9.5075 9.7 9.7 1 10 10 10 10 10 10 2 26 26 23 23 16 16 TEST19 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL evaluates it. Cubic function, evenly spaced knots. ONLY TWO KNOTS! The data to be interpolated: Number of data values = 2 T Y 0 4 1 10 Boundary condition 0 at left end. Boundary condition 0 at right end. SPLINE''(T) F''(T) 0 4 0 10 T SPLINE(T) F(T) -1 -2 2 6 2 0 -2 0 4 4 6 3 0 4 0.5 7 6.125 6 5.75 0 7 1 10 10 6 10 0 10 2 16 26 6 23 0 16 Boundary condition 1 at right end. Y'(right) = 10 SPLINE''(T) F''(T) 8 4 8 10 T SPLINE(T) F(T) -1 6 2 -6 2 8 -2 0 4 4 2 3 8 4 0.5 6 6.125 6 5.75 8 7 1 10 10 10 10 8 10 2 24 26 18 23 8 16 Boundary condition 2 at right end. YP''(right) = 10 SPLINE''(T) F''(T) 10 4 10 10 T SPLINE(T) F(T) -1 8 2 -9 2 10 -2 0 4 4 1 3 10 4 0.5 5.75 6.125 6 5.75 10 7 1 10 10 11 10 10 10 2 26 26 21 23 10 16 Boundary condition 1 at left end. Y'(left) = 3 Boundary condition 0 at right end. SPLINE''(T) F''(T) 6 4 6 10 T SPLINE(T) F(T) -1 4 2 -3 2 6 -2 0 4 4 3 3 6 4 0.5 6.25 6.125 6 5.75 6 7 1 10 10 9 10 6 10 2 22 26 15 23 6 16 Boundary condition 1 at right end. Y'(right) = 10 SPLINE''(T) F''(T) 4 4 10 10 T SPLINE(T) F(T) -1 2 2 2 2 -2 -2 0 4 4 3 3 4 4 0.5 6.125 6.125 5.75 5.75 7 7 1 10 10 10 10 10 10 2 26 26 23 23 16 16 Boundary condition 2 at right end. YP''(right) = 10 SPLINE''(T) F''(T) 4 4 10 10 T SPLINE(T) F(T) -1 2 2 2 2 -2 -2 0 4 4 3 3 4 4 0.5 6.125 6.125 5.75 5.75 7 7 1 10 10 10 10 10 10 2 26 26 23 23 16 16 Boundary condition 2 at left end. YP''(left) = 4 Boundary condition 0 at right end. SPLINE''(T) F''(T) 4 4 4 10 T SPLINE(T) F(T) -1 2 2 0 2 4 -2 0 4 4 4 3 4 4 0.5 6.5 6.125 6 5.75 4 7 1 10 10 8 10 4 10 2 20 26 12 23 4 16 Boundary condition 1 at right end. Y'(right) = 10 SPLINE''(T) F''(T) 4 4 10 10 T SPLINE(T) F(T) -1 2 2 2 2 -2 -2 0 4 4 3 3 4 4 0.5 6.125 6.125 5.75 5.75 7 7 1 10 10 10 10 10 10 2 26 26 23 23 16 16 Boundary condition 2 at right end. YP''(right) = 10 SPLINE''(T) F''(T) 4 4 10 10 T SPLINE(T) F(T) -1 2 2 2 2 -2 -2 0 4 4 3 3 4 4 0.5 6.125 6.125 5.75 5.75 7 7 1 10 10 10 10 10 10 2 26 26 23 23 16 16 TEST20 SPLINE_HERMITE_SET sets up a Hermite spline; SPLINE_HERMITE_VAL evaluates it. Data TDATA(I) YDATA[I] Y'DATA[I] 0 0 1 0.523599 0.5 0.866025 1.0472 0.866025 0.5 1.5708 1 6.12323e-17 T Y(hermite) Y(exact) Y'(hermite) Y'(exact) * 0 0 0 1 1 0.174533 0.173611 0.173648 0.984564 0.984808 0.349066 0.341978 0.34202 0.939906 0.939693 * 0.523599 0.5 0.5 0.866025 0.866025 0.698132 0.642681 0.642788 0.765409 0.766044 0.872665 0.765934 0.766044 0.643401 0.642788 * 1.0472 0.866025 0.866025 0.5 0.5 1.22173 0.939545 0.939693 0.341164 0.34202 1.39626 0.984658 0.984808 0.174497 0.173648 * 1.5708 1 1 1.11022e-16 6.12323e-17 TEST205 SPLINE_LINEAR_INTSET is given some interval endpoints, and a value associated with each interval. It determines a linear spline, with breakpoints at the centers of each interval, whose integral over each interval is equal to the given value. The interval end points: 0: 0.000000 1: 1.000000 2: 4.000000 3: 5.000000 4: 10.000000 The desired interval integral values: 0: 10.000000 1: 2.000000 2: 8.000000 3: 27.500000 The spline break points: 0: 0.500000 1: 2.500000 2: 4.500000 3: 7.500000 The spline data values: 0: 10.000000 1: -4.632621 2: 8.997625 3: 5.500000 As a check, call SPLINE_LINEAR_INT to compute the integral of the spline over each interval, and compare to the desired value. A B Desired Computed 0 1 10 10 1 4 2 2 4 5 8 8 5 10 27.5 27.5 TEST21 SPLINE_LINEAR_VAL evaluates a linear spline. Runge's function, evenly spaced knots. The data to be interpolated: Number of data values = 11 T Y -1 0.0384615 -0.8 0.0588235 -0.6 0.1 -0.4 0.2 -0.2 0.5 0 1 0.2 0.5 0.4 0.2 0.6 0.1 0.8 0.0588235 1 0.0384615 Interpolation: T Y Yexact -2 -0.0633484 0.00990099 -1 0.0384615 0.0384615 -0.9 0.0486425 0.0470588 -0.8 0.0588235 0.0588235 -0.7 0.0794118 0.0754717 -0.6 0.1 0.1 -0.5 0.15 0.137931 -0.4 0.2 0.2 -0.3 0.35 0.307692 -0.2 0.5 0.5 -0.1 0.75 0.8 0 1 1 0.1 0.75 0.8 0.2 0.5 0.5 0.3 0.35 0.307692 0.4 0.2 0.2 0.5 0.15 0.137931 0.6 0.1 0.1 0.7 0.0794118 0.0754717 0.8 0.0588235 0.0588235 0.9 0.0486425 0.0470588 1 0.0384615 0.0384615 2 -0.0633484 0.00990099 TEST215 SPLINE_LINEAR_INT computes the integral of a linear spline. The data to be interpolated: Number of data values = 3 T Y 2 3 4.5 3.75 7.5 5.5 A B Integral 0 4 12 4 5 3.78542 5 10 27.5 0 10 43.2854 10 0 -43.2854 TEST22 SPLINE_OVERHAUSER_UNI_VAL evaluates the uniform Overhauser spline. The data to be interpolated: Number of data values = 11 T Y 0 0 1 0.587785 2 0.951057 3 0.951057 4 0.587785 5 1.22465e-16 6 -0.587785 7 -0.951057 8 -0.951057 9 -0.587785 10 -2.44929e-16 T, Spline(T) -0.5 -0.378085 -0.375 -0.278302 -0.25 -0.182027 -0.125 -0.0892593 * 0 0 0.25 0.167994 0.5 0.321957 0.75 0.461887 * 1 0.587785 1.25 0.702903 1.5 0.806157 1.75 0.891043 * 2 0.951057 2.25 0.985113 2.5 0.996465 2.75 0.985113 * 3 0.951057 3.25 0.891043 3.5 0.806157 3.75 0.702903 * 4 0.587785 4.25 0.456625 4.5 0.307925 4.75 0.152208 * 5 1.22465e-16 5.25 -0.152208 5.5 -0.307925 5.75 -0.456625 * 6 -0.587785 6.25 -0.702903 6.5 -0.806157 6.75 -0.891043 * 7 -0.951057 7.25 -0.985113 7.5 -0.996465 7.75 -0.985113 * 8 -0.951057 8.25 -0.891043 8.5 -0.806157 8.75 -0.702903 * 9 -0.587785 9.25 -0.461887 9.5 -0.321957 9.75 -0.167994 * 10 -2.44929e-16 10.125 0.0892593 10.25 0.182027 10.375 0.278302 10.5 0.378085 TEST225 SPLINE_OVERHAUSER_NONUNI_VAL evaluates the nonuniform Overhauser spline. In this draft of a test, we simply repeat the work for the uniform test. The data to be interpolated: Number of data values = 11 T Y 0 0 1 0.587785 2 0.951057 3 0.951057 4 0.587785 5 1.22465e-16 6 -0.587785 7 -0.951057 8 -0.951057 9 -0.587785 10 -2.44929e-16 T, Spline(T) -0.5 -0.352636 -0.375 -0.26017 -0.25 -0.170575 -0.125 -0.0838514 * 0 0 0.25 0.159087 0.5 0.306688 0.75 0.4428 * 1 0.587785 1.25 0.699212 1.5 0.803345 1.75 0.890516 * 2 0.951057 2.25 0.982075 2.5 0.992414 2.75 0.982075 * 3 0.951057 3.25 0.890516 3.5 0.803345 3.75 0.699212 * 4 0.587785 4.25 0.454902 4.5 0.306393 4.75 0.151634 * 5 1.22465e-16 5.25 -0.151634 5.5 -0.306393 5.75 -0.454902 * 6 -0.587785 6.25 -0.699212 6.5 -0.803345 6.75 -0.890516 * 7 -0.951057 7.25 -0.982075 7.5 -0.992414 7.75 -0.982075 * 8 -0.951057 8.25 -0.890516 8.5 -0.803345 8.75 -0.699212 * 9 -0.567426 9.25 -0.4428 9.5 -0.306688 9.75 -0.159087 * 10 -2.44929e-16 10.125 0.0838514 10.25 0.170575 10.375 0.26017 10.5 0.352636 TEST23 SPLINE_OVERHAUSER_VAL evaluates the Overhauser spline. Data TDATA[I], YDATA[I], ZDATA[I] 1 0 0 2 1 1 3 2 -1 4 3 0 T, Spline value 0 -1 -4 0.166667 -0.833333 -3.125 0.333333 -0.666667 -2.33333 0.5 -0.5 -1.625 0.666667 -0.333333 -1 0.833333 -0.166667 -0.458333 1 0 0 1.16667 0.166667 0.375 1.33333 0.333333 0.666667 1.5 0.5 0.875 1.66667 0.666667 1 1.83333 0.833333 1.04167 2 1 1 2.16667 1.16667 0.805556 2.33333 1.33333 0.444444 2.5 1.5 0 2.66667 1.66667 -0.444444 2.83333 1.83333 -0.805556 3 2 -1 3.16667 2.16667 -1.04167 3.33333 2.33333 -1 3.5 2.5 -0.875 3.66667 2.66667 -0.666667 3.83333 2.83333 -0.375 4 3 0 4.16667 3.16667 0.458333 4.33333 3.33333 1 4.5 3.5 1.625 TEST235 SPLINE_PCHIP_SET sets up a piecewise cubic Hermite interpolant. SPLINE_PCHIP_VAL evaluates the interpolant. -1 0.0384615 0.0384615 0 -0.99 0.0392118 0.039181 -3.08918e-05 -0.98 0.039984 0.0399355 -4.85212e-05 -0.97 0.0407789 0.0407237 -5.52114e-05 -0.96 0.0415973 0.041544 -5.33257e-05 -0.95 0.0424403 0.042395 -4.52705e-05 -0.94 0.0433088 0.0432753 -3.34976e-05 -0.93 0.0442038 0.0441833 -2.05064e-05 -0.92 0.0451264 0.0451175 -8.84751e-06 -0.91 0.0460776 0.0460765 -1.12499e-06 -0.9 0.0470588 0.0470588 0 -0.89 0.0480711 0.0480689 -2.285e-06 -0.88 0.0491159 0.0491128 -3.1031e-06 -0.87 0.0501945 0.0501918 -2.67772e-06 -0.86 0.0513084 0.0513071 -1.30444e-06 -0.85 0.052459 0.0524597 6.44554e-07 -0.84 0.0536481 0.0536508 2.71564e-06 -0.83 0.0548772 0.0548816 4.36864e-06 -0.82 0.0561482 0.0561532 4.97128e-06 -0.81 0.057463 0.0574668 3.79328e-06 -0.8 0.0588235 0.0588235 0 -0.79 0.0602319 0.0602279 -3.99457e-06 -0.78 0.0616903 0.061685 -5.36439e-06 -0.77 0.0632011 0.0631966 -4.50436e-06 -0.76 0.0647668 0.0647649 -1.94428e-06 -0.75 0.06639 0.0663917 1.64206e-06 -0.74 0.0680735 0.0680789 5.42702e-06 -0.73 0.0698202 0.0698286 8.41856e-06 -0.72 0.0716332 0.0716427 9.4488e-06 -0.71 0.0735159 0.0735231 7.16174e-06 -0.7 0.0754717 0.0754717 0 -0.69 0.0775044 0.0774969 -7.42334e-06 -0.68 0.0796178 0.0796081 -9.7478e-06 -0.67 0.0818163 0.0818086 -7.7577e-06 -0.66 0.0841043 0.0841018 -2.50322e-06 -0.65 0.0864865 0.0864912 4.68003e-06 -0.64 0.088968 0.0889801 1.215e-05 -0.63 0.0915541 0.0915721 1.79354e-05 -0.62 0.0942507 0.0942704 1.9711e-05 -0.61 0.0970638 0.0970786 1.47709e-05 -0.6 0.1 0.1 0 -0.59 0.103066 0.103051 -1.48073e-05 -0.58 0.10627 0.106251 -1.85423e-05 -0.57 0.109619 0.109606 -1.30638e-05 -0.56 0.113122 0.113121 -7.80745e-07 -0.55 0.116788 0.116804 1.53042e-05 -0.54 0.120627 0.120659 3.15492e-05 -0.53 0.124649 0.124693 4.36227e-05 -0.52 0.128866 0.128912 4.64503e-05 -0.51 0.133289 0.133323 3.41559e-05 -0.5 0.137931 0.137931 0 -0.49 0.142806 0.142774 -3.18942e-05 -0.48 0.147929 0.147893 -3.56766e-05 -0.47 0.153315 0.153298 -1.70057e-05 -0.46 0.158983 0.159 1.72978e-05 -0.45 0.164948 0.165008 5.91638e-05 -0.44 0.171233 0.171332 9.91804e-05 -0.43 0.177857 0.177983 0.000126497 -0.42 0.184843 0.184972 0.000128722 -0.41 0.192215 0.192307 9.18191e-05 -0.4 0.2 0.2 0 -0.39 0.208225 0.208152 -7.33518e-05 -0.38 0.21692 0.216862 -5.78857e-05 -0.37 0.226116 0.22614 2.31136e-05 -0.36 0.235849 0.235993 0.000144198 -0.35 0.246154 0.246432 0.000277675 -0.34 0.257069 0.257463 0.00039355 -0.33 0.268637 0.269096 0.000459492 -0.32 0.280899 0.28134 0.000440847 -0.31 0.293902 0.294202 0.000300698 -0.3 0.307692 0.307692 0 -0.29 0.322321 0.322151 -0.000169729 -0.28 0.337838 0.337865 2.70537e-05 -0.27 0.354296 0.354761 0.000465165 -0.26 0.371747 0.372766 0.00101906 -0.25 0.390244 0.391808 0.00156376 -0.24 0.409836 0.411812 0.00197606 -0.23 0.430571 0.432707 0.00213613 -0.22 0.452489 0.454418 0.00192946 -0.21 0.475624 0.476874 0.00124936 -0.2 0.5 0.5 0 -0.19 0.525624 0.525224 -0.000399804 -0.18 0.552486 0.55352 0.00103381 -0.17 0.580552 0.584133 0.0035816 -0.16 0.609756 0.61631 0.0065539 -0.15 0.64 0.649297 0.00929687 -0.14 0.671141 0.68234 0.0111991 -0.13 0.702988 0.714686 0.0116979 -0.12 0.735294 0.74558 0.0102859 -0.11 0.767754 0.774269 0.00651506 -0.1 0.8 0.8 0 -0.09 0.831601 0.82504 -0.00656083 -0.08 0.862069 0.85152 -0.010549 -0.07 0.890869 0.87848 -0.0123886 -0.06 0.917431 0.90496 -0.0124712 -0.05 0.941176 0.93 -0.0111765 -0.04 0.961538 0.95264 -0.00889846 -0.03 0.977995 0.97192 -0.00607511 -0.02 0.990099 0.98688 -0.00321901 -0.01 0.997506 0.99656 -0.000946234 0 1 1 0 TEST24 SPLINE_QUADRATIC_VAL evaluates a quadratic spline. Runge''s function, evenly spaced knots. The data to be interpolated: Number of data values = 11 T Y -1 0.0384615 -0.8 0.0588235 -0.6 0.1 -0.4 0.2 -0.2 0.5 0 1 0.2 0.5 0.4 0.2 0.6 0.1 0.8 0.0588235 1 0.0384615 Interpolated values T Y Y(exact) -2 0.248869 0.00990099 -1 0.0384615 0.0384615 -0.9 0.0460407 0.0470588 -0.8 0.0588235 0.0588235 -0.7 0.07681 0.0754717 -0.6 0.1 0.1 -0.5 0.125 0.137931 -0.4 0.2 0.2 -0.3 0.325 0.307692 -0.2 0.5 0.5 -0.1 0.875 0.8 0 1 1 0.1 0.875 0.8 0.2 0.5 0.5 0.3 0.325 0.307692 0.4 0.2 0.2 0.5 0.125 0.137931 0.6 0.1 0.1 0.7 0.07681 0.0754717 0.8 0.0588235 0.0588235 0.9 0.0460407 0.0470588 1 0.0384615 0.0384615 2 0.248869 0.00990099 SPLINE_PRB Normal end of execution. 22 January 2017 10:47:30 AM