24-Mar-2019 16:52:28 spline_test MATLAB version: Test spline. 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. 1 2.000000 15.000000 17.000000 2 4.000000 45.000000 61.000000 3 6.000000 91.000000 137.000000 4 8.000000 153.000000 245.000000 5 10.000000 231.000000 385.000000 Interpolated data: LEFT, X, Y1, Y2 1 1.000000 6.000000 7.000000 2 3.000000 28.000000 35.000000 3 5.000000 66.000000 95.000000 3 7.000000 120.000000 187.000000 3 9.000000 190.000000 311.000000 TEST002 R8VEC_BRACKET finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 6 5.000000 7 7.000000 8 8.000000 9 9.000000 10 10.000000 LEFT RIGHT X(LEFT) XVAL X(RIGHT) 1 2 1.000000 -10.000000 2.000000 1 2 1.000000 1.000000 2.000000 4 5 4.000000 4.500000 5.000000 6 7 5.000000 5.000000 7.000000 9 10 9.000000 10.000000 10.000000 9 10 9.000000 12.000000 10.000000 TEST003 R8VEC_BRACKET3 finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 6 5.000000 7 7.000000 8 8.000000 9 9.000000 10 10.000000 Search for XVAL = -10.000000 Starting guess for interval is = 5 Nearest interval: X[1]= 1.000000 X[2]= 2.000000 Search for XVAL = 1.000000 Starting guess for interval is = 1 Nearest interval: X[1]= 1.000000 X[2]= 2.000000 Search for XVAL = 4.500000 Starting guess for interval is = 1 Nearest interval: X[4]= 4.000000 X[5]= 5.000000 Search for XVAL = 5.000000 Starting guess for interval is = 4 Nearest interval: X[4]= 4.000000 X[5]= 5.000000 Search for XVAL = 10.000000 Starting guess for interval is = 4 Nearest interval: X[9]= 9.000000 X[10]= 10.000000 Search for XVAL = 12.000000 Starting guess for interval is = 9 Nearest interval: X[9]= 9.000000 X[10]= 10.000000 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. The following vector has order type -1 1 1.000000 2 3.000000 3 2.000000 4 4.000000 The following vector has order type 0 1 2.000000 2 2.000000 3 2.000000 4 2.000000 The following vector has order type 1 1 1.000000 2 2.000000 3 2.000000 4 4.000000 The following vector has order type 2 1 1.000000 2 2.000000 3 3.000000 4 4.000000 The following vector has order type 3 1 4.000000 2 4.000000 3 3.000000 4 1.000000 The following vector has order type 4 1 9.000000 2 7.000000 3 3.000000 4 0.000000 TEST005 D3_NP_FS factors and solves a tridiagonal linear system. Matrix order N = 10 Solution: 1 1.000000 2 2.000000 3 3.000000 4 4.000000 5 5.000000 6 6.000000 7 7.000000 8 8.000000 9 9.000000 10 10.000000 TEST006 Approximate Y = EXP(X) using orders 1 to 8 Evaluate at X = 2.500000 where EXP(X)= 12.182494 Order Approximate Y Error 1 1.000000 -11.182494 2 5.295705 -6.886789 3 10.831628 -1.350866 4 12.417007 0.234513 5 12.076491 -0.106003 6 12.252022 0.069528 7 12.126351 -0.056143 8 12.234320 0.051826 TEST01 BASIS_FUNCTION_B_VAL evaluates the B spline basis function. T B(T) -0.500000 0.000000 -0.375000 0.000000 -0.250000 0.000000 -0.125000 0.000000 * 0.000000 0.000000 0.250000 0.002604 0.500000 0.020833 0.750000 0.070312 * 1.000000 0.166667 1.750000 0.315104 2.500000 0.479167 3.250000 0.611979 * 4.000000 0.666667 4.500000 0.611979 5.000000 0.479167 5.500000 0.315104 * 6.000000 0.166667 7.000000 0.070312 8.000000 0.020833 9.000000 0.002604 * 10.000000 0.000000 10.500000 0.000000 11.000000 0.000000 11.500000 0.000000 12.000000 0.000000 TEST02 BASIS_FUNCTION_BETA_VAL evaluates the Beta spline basis function. BETA1 = 1.000000 BETA2 = 0.000000 T B(T) -0.500000 0.000000 -0.375000 0.000000 -0.250000 0.000000 -0.125000 0.000000 * 0.000000 0.000000 0.250000 0.002604 0.500000 0.020833 0.750000 0.070312 * 1.000000 0.166667 1.750000 0.315104 2.500000 0.479167 3.250000 0.611979 * 4.000000 0.666667 4.500000 0.611979 5.000000 0.479167 5.500000 0.315104 * 6.000000 0.166667 7.000000 0.070312 8.000000 0.020833 9.000000 0.002604 * 10.000000 0.000000 10.500000 0.000000 11.000000 0.000000 11.500000 0.000000 12.000000 0.000000 BETA1 = 1.000000 BETA2 = 100.000000 T B(T) -0.500000 0.000000 -0.375000 0.000000 -0.250000 0.000000 -0.125000 0.000000 * 0.000000 0.000000 0.250000 0.000279 0.500000 0.002232 0.750000 0.007533 * 1.000000 0.017857 1.750000 0.173270 2.500000 0.497768 3.250000 0.818917 * 4.000000 0.964286 4.500000 0.818917 5.000000 0.497768 5.500000 0.173270 * 6.000000 0.017857 7.000000 0.007533 8.000000 0.002232 9.000000 0.000279 * 10.000000 0.000000 10.500000 0.000000 11.000000 0.000000 11.500000 0.000000 12.000000 0.000000 BETA1 = 100.000000 BETA2 = 0.000000 T B(T) -0.500000 0.000000 -0.375000 0.000000 -0.250000 0.000000 -0.125000 0.000000 * 0.000000 0.000000 0.250000 0.000000 0.500000 0.000000 0.750000 0.000000 * 1.000000 0.000001 1.750000 0.001758 2.500000 0.006262 3.250000 0.012585 * 4.000000 0.019800 4.500000 0.584721 5.000000 0.871213 5.500000 0.972099 * 6.000000 0.980199 7.000000 0.413521 8.000000 0.122525 9.000000 0.015316 * 10.000000 0.000000 10.500000 0.000000 11.000000 0.000000 11.500000 0.000000 12.000000 0.000000 TEST03 BASIS_MATRIX_B_UNI sets up the basis matrix for the uniform B spline. TDATA YDATA -1.000000 4.000000 0.000000 7.000000 1.000000 12.000000 2.000000 19.000000 T Spline(T) -1.500000 3.583333 -1.375000 3.723958 -1.250000 3.895833 -1.125000 4.098958 * -1.000000 4.333333 -0.750000 4.895833 -0.500000 5.583333 -0.250000 6.395833 * 0.000000 7.333333 0.250000 8.395833 0.500000 9.583333 0.750000 10.895833 * 1.000000 12.333333 1.250000 13.895833 1.500000 15.583333 1.750000 17.395833 * 2.000000 19.333333 2.125000 20.348958 2.250000 21.395833 2.375000 22.473958 2.500000 23.583333 TEST04 BASIS_MATRIX_BETA_UNI sets up the basis matrix for the uniform beta spline. BETA1 = 1.000000 BETA2 = 0.000000 TDATA, YDATA -1.000000 4.000000 0.000000 7.000000 1.000000 12.000000 2.000000 19.000000 T, Spline(T) -1.500000 3.583333 -1.375000 3.723958 -1.250000 3.895833 -1.125000 4.098958 * -1.000000 4.333333 -0.750000 4.895833 -0.500000 5.583333 -0.250000 6.395833 * 0.000000 7.333333 0.250000 8.395833 0.500000 9.583333 0.750000 10.895833 * 1.000000 12.333333 1.250000 13.895833 1.500000 15.583333 1.750000 17.395833 * 2.000000 19.333333 2.125000 20.348958 2.250000 21.395833 2.375000 22.473958 2.500000 23.583333 BETA1 = 1.000000 BETA2 = 100.000000 TDATA, YDATA -1.000000 4.000000 0.000000 7.000000 1.000000 12.000000 2.000000 19.000000 T, Spline(T) -1.500000 66.901786 -1.375000 55.180664 -1.250000 45.032366 -1.125000 36.352260 * -1.000000 29.035714 -0.750000 18.074777 -0.500000 11.312500 -0.250000 7.911830 * 0.000000 7.035714 0.250000 7.847098 0.500000 9.508929 0.750000 11.184152 * 1.000000 12.035714 1.250000 11.226563 1.500000 7.919643 1.750000 1.277902 * 2.000000 -9.535714 2.125000 -16.768555 2.250000 -25.358259 2.375000 -35.409459 2.500000 -47.026786 BETA1 = 100.000000 BETA2 = 0.000000 TDATA, YDATA -1.000000 4.000000 0.000000 7.000000 1.000000 12.000000 2.000000 19.000000 T, Spline(T) -1.500000 -38.451172 -1.375000 -31.989037 -1.250000 -26.170670 -1.125000 -20.962191 * -1.000000 -16.329718 -0.750000 -8.657276 -0.500000 -2.882301 -0.250000 1.266247 * 0.000000 4.059408 0.250000 5.768224 0.500000 6.663736 0.750000 7.016985 * 1.000000 7.099012 1.250000 7.180857 1.500000 7.533563 1.750000 8.428169 * 2.000000 10.135716 2.125000 11.379044 2.250000 12.927247 2.375000 14.814206 2.500000 17.073801 TEST05 BASIS_MATRIX_BEZIER sets up the basis matrix for the uniform Bezier spline. TDATA, YDATA 0.000000 7.000000 0.000000 8.333333 1.000000 10.000000 1.000000 12.000000 T, Spline(T) 0.000000 7.000000 0.000000 7.000000 0.000000 7.000000 0.000000 7.000000 * 0.000000 7.000000 0.000000 7.000000 0.000000 7.000000 0.000000 7.000000 * 0.000000 7.000000 0.250000 8.062500 0.500000 9.250000 0.750000 10.562500 * 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 * 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 TEST06 BASIS_MATRIX_HERMITE sets up the basis matrix for the Hermite spline. TDATA, YDATA 0.000000 7.000000 0.000000 12.000000 1.000000 4.000000 1.000000 6.000000 T, Spline(T) 0.000000 7.000000 0.000000 7.000000 0.000000 7.000000 0.000000 7.000000 * 0.000000 7.000000 0.000000 7.000000 0.000000 7.000000 0.000000 7.000000 * 0.000000 7.000000 0.250000 8.062500 0.500000 9.250000 0.750000 10.562500 * 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 * 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 1.000000 12.000000 TEST07 BASIS_MATRIX_OVERHAUSER_UNI sets up the basis matrix for the uniform Overhauser spline. TDATA, YDATA -1.000000 4.000000 0.000000 7.000000 1.000000 12.000000 2.000000 19.000000 T, Spline(T) -1.500000 3.250000 -1.375000 3.390625 -1.250000 3.562500 -1.125000 3.765625 * -1.000000 4.000000 -0.750000 4.562500 -0.500000 5.250000 -0.250000 6.062500 * 0.000000 7.000000 0.250000 8.062500 0.500000 9.250000 0.750000 10.562500 * 1.000000 12.000000 1.250000 13.562500 1.500000 15.250000 1.750000 17.062500 * 2.000000 19.000000 2.125000 20.015625 2.250000 21.062500 2.375000 22.140625 2.500000 23.250000 TEST08 BASIS_MATRIX_OVERHAUSER_NONUNI sets up the basis matrix for the nonuniform Overhauser spline. ALPHA = 0.500000 BETA = 0.500000 TDATA, YDATA 0.000000 7.000000 1.000000 4.000000 2.000000 3.000000 3.000000 4.000000 T, Spline(T) -0.500000 9.250000 -0.375000 8.640625 -0.250000 8.062500 -0.125000 7.515625 * 0.000000 7.000000 0.250000 6.062500 0.500000 5.250000 0.750000 4.562500 * 1.000000 4.000000 1.250000 3.562500 1.500000 3.250000 1.750000 3.062500 * 2.000000 3.000000 2.250000 3.062500 2.500000 3.250000 2.750000 3.562500 * 3.000000 4.000000 3.125000 4.265625 3.250000 4.562500 3.375000 4.890625 3.500000 5.250000 ALPHA = 0.500000 BETA = 0.250000 TDATA, YDATA 0.000000 7.000000 1.000000 4.000000 2.000000 3.000000 5.000000 12.000000 T, Spline(T) -0.500000 9.250000 -0.375000 8.640625 -0.250000 8.062500 -0.125000 7.515625 * 0.000000 7.000000 0.250000 6.062500 0.500000 5.250000 0.750000 4.562500 * 1.000000 4.000000 1.250000 3.562500 1.500000 3.250000 1.750000 3.062500 * 2.000000 3.000000 2.750000 3.562500 3.500000 5.250000 4.250000 8.062500 * 5.000000 12.000000 5.375000 14.390625 5.750000 17.062500 6.125000 20.015625 6.500000 23.250000 ALPHA = 0.250000 BETA = 0.500000 TDATA, YDATA 0.000000 7.000000 3.000000 4.000000 4.000000 7.000000 5.000000 12.000000 T, Spline(T) -1.500000 1104.250000 -1.125000 879.531250 -0.750000 687.437500 -0.375000 525.437500 * 0.000000 391.000000 0.750000 194.687500 1.500000 78.250000 2.250000 21.437500 * 3.000000 4.000000 3.250000 3.437500 3.500000 4.250000 3.750000 5.687500 * 4.000000 7.000000 4.250000 7.437500 4.500000 6.250000 4.750000 2.687500 * 5.000000 -4.000000 5.125000 -8.750000 5.250000 -14.562500 5.375000 -21.531250 5.500000 -29.750000 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.500000 BETA = 0.500000 TDATA, YDATA -1.000000 4.000000 0.000000 7.000000 1.000000 12.000000 2.000000 19.000000 T, Spline(T) -1.500000 3.250000 -1.375000 3.390625 -1.250000 3.562500 -1.125000 3.765625 * -1.000000 4.000000 -0.750000 4.562500 -0.500000 5.250000 -0.250000 6.062500 * 0.000000 7.000000 0.250000 8.062500 0.500000 9.250000 0.750000 10.562500 * 1.000000 12.000000 1.250000 13.562500 1.500000 15.250000 1.750000 17.062500 * 2.000000 19.000000 2.125000 20.015625 2.250000 21.062500 2.375000 22.140625 2.500000 23.250000 Now test that the nonuniform code on a nonuniform grid. ALPHA = 0.666667 BETA = 0.400000 TDATA, YDATA -4.000000 7.000000 -3.000000 4.000000 -1.000000 4.000000 2.000000 19.000000 T, Spline(T) -4.500000 -13.812500 -4.375000 -10.083008 -4.250000 -6.898437 -4.125000 -4.217773 * -4.000000 -2.000000 -3.750000 1.210937 -3.500000 3.062500 -3.250000 3.882813 * -3.000000 4.000000 -2.500000 3.437500 -2.000000 4.000000 -1.500000 8.312500 * -1.000000 19.000000 -0.250000 52.726563 0.500000 115.562500 1.250000 216.367188 * 2.000000 364.000000 2.375000 458.145508 2.750000 567.320313 3.125000 692.631836 3.500000 835.187500 TEST10 BC_VAL evaluates a general Bezier function. T, X(T), Y(T) 0.000000 0.000000 1.000000 0.010000 0.014950 0.980200 0.020000 0.029800 0.960800 0.030000 0.044550 0.941800 0.040000 0.059200 0.923200 0.050000 0.073750 0.905000 0.060000 0.088200 0.887200 0.070000 0.102550 0.869800 0.080000 0.116800 0.852800 0.090000 0.130950 0.836200 0.100000 0.145000 0.820000 0.110000 0.158950 0.804200 0.120000 0.172800 0.788800 0.130000 0.186550 0.773800 0.140000 0.200200 0.759200 0.150000 0.213750 0.745000 0.160000 0.227200 0.731200 0.170000 0.240550 0.717800 0.180000 0.253800 0.704800 0.190000 0.266950 0.692200 0.200000 0.280000 0.680000 0.210000 0.292950 0.668200 0.220000 0.305800 0.656800 0.230000 0.318550 0.645800 0.240000 0.331200 0.635200 0.250000 0.343750 0.625000 0.260000 0.356200 0.615200 0.270000 0.368550 0.605800 0.280000 0.380800 0.596800 0.290000 0.392950 0.588200 0.300000 0.405000 0.580000 0.310000 0.416950 0.572200 0.320000 0.428800 0.564800 0.330000 0.440550 0.557800 0.340000 0.452200 0.551200 0.350000 0.463750 0.545000 0.360000 0.475200 0.539200 0.370000 0.486550 0.533800 0.380000 0.497800 0.528800 0.390000 0.508950 0.524200 0.400000 0.520000 0.520000 0.410000 0.530950 0.516200 0.420000 0.541800 0.512800 0.430000 0.552550 0.509800 0.440000 0.563200 0.507200 0.450000 0.573750 0.505000 0.460000 0.584200 0.503200 0.470000 0.594550 0.501800 0.480000 0.604800 0.500800 0.490000 0.614950 0.500200 0.500000 0.625000 0.500000 0.510000 0.634950 0.500200 0.520000 0.644800 0.500800 0.530000 0.654550 0.501800 0.540000 0.664200 0.503200 0.550000 0.673750 0.505000 0.560000 0.683200 0.507200 0.570000 0.692550 0.509800 0.580000 0.701800 0.512800 0.590000 0.710950 0.516200 0.600000 0.720000 0.520000 0.610000 0.728950 0.524200 0.620000 0.737800 0.528800 0.630000 0.746550 0.533800 0.640000 0.755200 0.539200 0.650000 0.763750 0.545000 0.660000 0.772200 0.551200 0.670000 0.780550 0.557800 0.680000 0.788800 0.564800 0.690000 0.796950 0.572200 0.700000 0.805000 0.580000 0.710000 0.812950 0.588200 0.720000 0.820800 0.596800 0.730000 0.828550 0.605800 0.740000 0.836200 0.615200 0.750000 0.843750 0.625000 0.760000 0.851200 0.635200 0.770000 0.858550 0.645800 0.780000 0.865800 0.656800 0.790000 0.872950 0.668200 0.800000 0.880000 0.680000 0.810000 0.886950 0.692200 0.820000 0.893800 0.704800 0.830000 0.900550 0.717800 0.840000 0.907200 0.731200 0.850000 0.913750 0.745000 0.860000 0.920200 0.759200 0.870000 0.926550 0.773800 0.880000 0.932800 0.788800 0.890000 0.938950 0.804200 0.900000 0.945000 0.820000 0.910000 0.950950 0.836200 0.920000 0.956800 0.852800 0.930000 0.962550 0.869800 0.940000 0.968200 0.887200 0.950000 0.973750 0.905000 0.960000 0.979200 0.923200 0.970000 0.984550 0.941800 0.980000 0.989800 0.960800 0.990000 0.994950 0.980200 1.000000 1.000000 1.000000 The point ( 0.75, 0.536 ) should be on the curve. TEST11 BEZ_VAL evaluates a Bezier function. T, X(T), Y(T) 1 0.000000 1.000000 2 0.050000 0.905000 3 0.100000 0.820000 4 0.150000 0.745000 5 0.200000 0.680000 6 0.250000 0.625000 7 0.300000 0.580000 8 0.350000 0.545000 9 0.400000 0.520000 10 0.450000 0.505000 11 0.500000 0.500000 12 0.550000 0.505000 13 0.600000 0.520000 14 0.650000 0.545000 15 0.700000 0.580000 16 0.750000 0.625000 17 0.800000 0.680000 18 0.850000 0.745000 19 0.900000 0.820000 20 0.950000 0.905000 21 1.000000 1.000000 When X = 0.75E+00 BEZ_VAL(X) should be 0.625E+00. 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.000000 1.000000 0.100000 1.000000 0.200000 1.000000 0.300000 1.000000 0.400000 1.000000 0.500000 1.000000 0.600000 1.000000 0.700000 1.000000 0.800000 1.000000 0.900000 1.000000 1.000000 1.000000 Degree N = 1 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 0.000000 1.000000 0.000000 0.100000 0.900000 0.100000 0.200000 0.800000 0.200000 0.300000 0.700000 0.300000 0.400000 0.600000 0.400000 0.500000 0.500000 0.500000 0.600000 0.400000 0.600000 0.700000 0.300000 0.700000 0.800000 0.200000 0.800000 0.900000 0.100000 0.900000 1.000000 0.000000 1.000000 Degree N = 2 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 0.000000 1.000000 0.000000 0.000000 0.100000 0.810000 0.180000 0.010000 0.200000 0.640000 0.320000 0.040000 0.300000 0.490000 0.420000 0.090000 0.400000 0.360000 0.480000 0.160000 0.500000 0.250000 0.500000 0.250000 0.600000 0.160000 0.480000 0.360000 0.700000 0.090000 0.420000 0.490000 0.800000 0.040000 0.320000 0.640000 0.900000 0.010000 0.180000 0.810000 1.000000 0.000000 0.000000 1.000000 Degree N = 3 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 0.000000 1.000000 0.000000 0.000000 0.000000 0.100000 0.729000 0.243000 0.027000 0.001000 0.200000 0.512000 0.384000 0.096000 0.008000 0.300000 0.343000 0.441000 0.189000 0.027000 0.400000 0.216000 0.432000 0.288000 0.064000 0.500000 0.125000 0.375000 0.375000 0.125000 0.600000 0.064000 0.288000 0.432000 0.216000 0.700000 0.027000 0.189000 0.441000 0.343000 0.800000 0.008000 0.096000 0.384000 0.512000 0.900000 0.001000 0.027000 0.243000 0.729000 1.000000 0.000000 0.000000 0.000000 1.000000 TEST116 BPAB evaluates the Bernstein basis polynomials for the interval [A,B]. A = 1.000000 B = 3.000000 Degree N = 0 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 1.000000 1.000000 1.200000 1.000000 1.400000 1.000000 1.600000 1.000000 1.800000 1.000000 2.000000 1.000000 2.200000 1.000000 2.400000 1.000000 2.600000 1.000000 2.800000 1.000000 3.000000 1.000000 Degree N = 1 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 1.000000 1.000000 0.000000 1.200000 0.900000 0.100000 1.400000 0.800000 0.200000 1.600000 0.700000 0.300000 1.800000 0.600000 0.400000 2.000000 0.500000 0.500000 2.200000 0.400000 0.600000 2.400000 0.300000 0.700000 2.600000 0.200000 0.800000 2.800000 0.100000 0.900000 3.000000 0.000000 1.000000 Degree N = 2 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 1.000000 1.000000 0.000000 0.000000 1.200000 0.810000 0.180000 0.010000 1.400000 0.640000 0.320000 0.040000 1.600000 0.490000 0.420000 0.090000 1.800000 0.360000 0.480000 0.160000 2.000000 0.250000 0.500000 0.250000 2.200000 0.160000 0.480000 0.360000 2.400000 0.090000 0.420000 0.490000 2.600000 0.040000 0.320000 0.640000 2.800000 0.010000 0.180000 0.810000 3.000000 0.000000 0.000000 1.000000 Degree N = 3 X BERN(N,0,X) BERN(N,1,X) BERN(N,2,X) BERN(N,3,X) 1.000000 1.000000 0.000000 0.000000 0.000000 1.200000 0.729000 0.243000 0.027000 0.001000 1.400000 0.512000 0.384000 0.096000 0.008000 1.600000 0.343000 0.441000 0.189000 0.027000 1.800000 0.216000 0.432000 0.288000 0.064000 2.000000 0.125000 0.375000 0.375000 0.125000 2.200000 0.064000 0.288000 0.432000 0.216000 2.400000 0.027000 0.189000 0.441000 0.343000 2.600000 0.008000 0.096000 0.384000 0.512000 2.800000 0.001000 0.027000 0.243000 0.729000 3.000000 0.000000 0.000000 0.000000 1.000000 TEST12 BP_APPROX evaluates the Bernstein polynomial approximant to a function F(X). XDATA, YDATA 2.000000 0.909297 Bernstein approximant of degree N = 0 X F(X) BERN(X) ERROR 2.000000 0.909297 0.909297 0.000000 XDATA, YDATA 1.000000 0.841471 1.666667 0.995408 2.333333 0.723086 3.000000 0.141120 Bernstein approximant of degree N = 3 X F(X) BERN(X) ERROR 1.000000 0.841471 0.841471 0.000000 1.333333 0.971938 0.883458 -0.088480 1.666667 0.995408 0.857641 -0.137767 2.000000 0.909297 0.767259 -0.142038 2.333333 0.723086 0.615552 -0.107534 2.666667 0.457273 0.405759 -0.051513 3.000000 0.141120 0.141120 0.000000 XDATA, YDATA 1.000000 0.841471 1.333333 0.971938 1.666667 0.995408 2.000000 0.909297 2.333333 0.723086 2.666667 0.457273 3.000000 0.141120 Bernstein approximant of degree N = 6 X F(X) BERN(X) ERROR 1.000000 0.841471 0.841471 0.000000 1.166667 0.919445 0.895538 -0.023907 1.333333 0.971938 0.927255 -0.044682 1.500000 0.997495 0.936755 -0.060740 1.666667 0.995408 0.924369 -0.071039 1.833333 0.965735 0.890632 -0.075103 2.000000 0.909297 0.836269 -0.073029 2.166667 0.827660 0.762199 -0.065461 2.333333 0.723086 0.669527 -0.053559 2.500000 0.598472 0.559538 -0.038934 2.666667 0.457273 0.433692 -0.023581 2.833333 0.303400 0.293620 -0.009780 3.000000 0.141120 0.141120 0.000000 XDATA, YDATA 1.000000 0.841471 1.222222 0.939861 1.444444 0.992028 1.666667 0.995408 1.888889 0.949834 2.111111 0.857547 2.333333 0.723086 2.555556 0.553064 2.777778 0.355842 3.000000 0.141120 Bernstein approximant of degree N = 9 X F(X) BERN(X) ERROR 1.000000 0.841471 0.841471 0.000000 1.111111 0.896192 0.885496 -0.010696 1.222222 0.939861 0.919068 -0.020793 1.333333 0.971938 0.942069 -0.029869 1.444444 0.992028 0.954449 -0.037579 1.555556 0.999884 0.956228 -0.043656 1.666667 0.995408 0.947493 -0.047915 1.777778 0.978656 0.928396 -0.050260 1.888889 0.949834 0.899157 -0.050677 2.000000 0.909297 0.860060 -0.049238 2.111111 0.857547 0.811452 -0.046095 2.222222 0.795220 0.753740 -0.041480 2.333333 0.723086 0.687393 -0.035693 2.444444 0.642034 0.612936 -0.029098 2.555556 0.553064 0.530950 -0.022114 2.666667 0.457273 0.442067 -0.015205 2.777778 0.355842 0.346973 -0.008869 2.888889 0.250023 0.246398 -0.003624 3.000000 0.141120 0.141120 0.000000 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 -1.000000 0.370000 -0.900000 0.410000 -0.800000 0.450000 -0.700000 0.500000 -0.600000 0.550000 -0.500000 0.610000 -0.400000 0.670000 -0.300000 0.740000 -0.200000 0.820000 -0.100000 0.900000 0.000000 1.000000 0.100000 1.110000 0.200000 1.220000 0.300000 1.350000 0.400000 1.490000 0.500000 1.650000 0.600000 1.820000 0.700000 2.010000 0.800000 2.230000 0.900000 2.460000 1.000000 2.720000 Use a polynomial of degree: 1 Total approximation error = 0.180081 X, F(X), P(X), Error -1.000000 0.081299 0.370000 -0.288701 -0.966667 0.118398 0.380000 -0.261602 -0.933333 0.155498 0.390000 -0.234502 -0.900000 0.192597 0.410000 -0.217403 -0.866667 0.229697 0.420000 -0.190303 -0.833333 0.266797 0.430000 -0.163203 -0.800000 0.303896 0.450000 -0.146104 -0.766667 0.340996 0.460000 -0.119004 -0.733333 0.378095 0.480000 -0.101905 -0.700000 0.415195 0.500000 -0.084805 -0.666667 0.452294 0.510000 -0.057706 -0.633333 0.489394 0.530000 -0.040606 -0.600000 0.526494 0.550000 -0.023506 -0.566667 0.563593 0.570000 -0.006407 -0.533333 0.600693 0.590000 0.010693 -0.500000 0.637792 0.610000 0.027792 -0.466667 0.674892 0.630000 0.044892 -0.433333 0.711991 0.650000 0.061991 -0.400000 0.749091 0.670000 0.079091 -0.366667 0.786190 0.690000 0.096190 -0.333333 0.823290 0.720000 0.103290 -0.300000 0.860390 0.740000 0.120390 -0.266667 0.897489 0.770000 0.127489 -0.233333 0.934589 0.790000 0.144589 -0.200000 0.971688 0.820000 0.151688 -0.166667 1.008788 0.850000 0.158788 -0.133333 1.045887 0.880000 0.165887 -0.100000 1.082987 0.900000 0.182987 -0.066667 1.120087 0.940000 0.180087 -0.033333 1.157186 0.970000 0.187186 0.000000 1.194286 1.000000 0.194286 0.033333 1.231385 1.030000 0.201385 0.066667 1.268485 1.070000 0.198485 0.100000 1.305584 1.110000 0.195584 0.133333 1.342684 1.140000 0.202684 0.166667 1.379784 1.180000 0.199784 0.200000 1.416883 1.220000 0.196883 0.233333 1.453983 1.260000 0.193983 0.266667 1.491082 1.310000 0.181082 0.300000 1.528182 1.350000 0.178182 0.333333 1.565281 1.400000 0.165281 0.366667 1.602381 1.440000 0.162381 0.400000 1.639481 1.490000 0.149481 0.433333 1.676580 1.540000 0.136580 0.466667 1.713680 1.590000 0.123680 0.500000 1.750779 1.650000 0.100779 0.533333 1.787879 1.700000 0.087879 0.566667 1.824978 1.760000 0.064978 0.600000 1.862078 1.820000 0.042078 0.633333 1.899177 1.880000 0.019177 0.666667 1.936277 1.950000 -0.013723 0.700000 1.973377 2.010000 -0.036623 0.733333 2.010476 2.080000 -0.069524 0.766667 2.047576 2.150000 -0.102424 0.800000 2.084675 2.230000 -0.145325 0.833333 2.121775 2.300000 -0.178225 0.866667 2.158874 2.380000 -0.221126 0.900000 2.195974 2.460000 -0.264026 0.933333 2.233074 2.540000 -0.306926 0.966667 2.270173 2.630000 -0.359827 1.000000 2.307273 2.720000 -0.412727 Use a polynomial of degree: 2 Total approximation error = 0.136015 X, F(X), P(X), Error -1.000000 0.233476 0.370000 -0.136524 -0.966667 0.254824 0.380000 -0.125176 -0.933333 0.276705 0.390000 -0.113295 -0.900000 0.299121 0.410000 -0.110879 -0.866667 0.322071 0.420000 -0.097929 -0.833333 0.345555 0.430000 -0.084445 -0.800000 0.369572 0.450000 -0.080428 -0.766667 0.394124 0.460000 -0.065876 -0.733333 0.419210 0.480000 -0.060790 -0.700000 0.444829 0.500000 -0.055171 -0.666667 0.470983 0.510000 -0.039017 -0.633333 0.497670 0.530000 -0.032330 -0.600000 0.524892 0.550000 -0.025108 -0.566667 0.552647 0.570000 -0.017353 -0.533333 0.580936 0.590000 -0.009064 -0.500000 0.609760 0.610000 -0.000240 -0.466667 0.639117 0.630000 0.009117 -0.433333 0.669008 0.650000 0.019008 -0.400000 0.699433 0.670000 0.029433 -0.366667 0.730392 0.690000 0.040392 -0.333333 0.761885 0.720000 0.041885 -0.300000 0.793912 0.740000 0.053912 -0.266667 0.826473 0.770000 0.056473 -0.233333 0.859568 0.790000 0.069568 -0.200000 0.893197 0.820000 0.073197 -0.166667 0.927360 0.850000 0.077360 -0.133333 0.962057 0.880000 0.082057 -0.100000 0.997287 0.900000 0.097287 -0.066667 1.033052 0.940000 0.093052 -0.033333 1.069351 0.970000 0.099351 0.000000 1.106183 1.000000 0.106183 0.033333 1.143550 1.030000 0.113550 0.066667 1.181450 1.070000 0.111450 0.100000 1.219885 1.110000 0.109885 0.133333 1.258853 1.140000 0.118853 0.166667 1.298356 1.180000 0.118356 0.200000 1.338392 1.220000 0.118392 0.233333 1.378962 1.260000 0.118962 0.266667 1.420066 1.310000 0.110066 0.300000 1.461704 1.350000 0.111704 0.333333 1.503877 1.400000 0.103877 0.366667 1.546583 1.440000 0.106583 0.400000 1.589823 1.490000 0.099823 0.433333 1.633597 1.540000 0.093597 0.466667 1.677905 1.590000 0.087905 0.500000 1.722747 1.650000 0.072747 0.533333 1.768122 1.700000 0.068122 0.566667 1.814032 1.760000 0.054032 0.600000 1.860476 1.820000 0.040476 0.633333 1.907454 1.880000 0.027454 0.666667 1.954965 1.950000 0.004965 0.700000 2.003011 2.010000 -0.006989 0.733333 2.051591 2.080000 -0.028409 0.766667 2.100704 2.150000 -0.049296 0.800000 2.150352 2.230000 -0.079648 0.833333 2.200533 2.300000 -0.099467 0.866667 2.251249 2.380000 -0.128751 0.900000 2.302498 2.460000 -0.157502 0.933333 2.354281 2.540000 -0.185719 0.966667 2.406599 2.630000 -0.223401 1.000000 2.459450 2.720000 -0.260550 Use a polynomial of degree: 3 Total approximation error = 0.132484 X, F(X), P(X), Error -1.000000 0.237885 0.370000 -0.132115 -0.966667 0.270413 0.380000 -0.109587 -0.933333 0.302324 0.390000 -0.087676 -0.900000 0.333656 0.410000 -0.076344 -0.866667 0.364450 0.420000 -0.055550 -0.833333 0.394745 0.430000 -0.035255 -0.800000 0.424580 0.450000 -0.025420 -0.766667 0.453997 0.460000 -0.006003 -0.733333 0.483033 0.480000 0.003033 -0.700000 0.511730 0.500000 0.011730 -0.666667 0.540127 0.510000 0.030127 -0.633333 0.568263 0.530000 0.038263 -0.600000 0.596178 0.550000 0.046178 -0.566667 0.623912 0.570000 0.053912 -0.533333 0.651505 0.590000 0.061505 -0.500000 0.678996 0.610000 0.068996 -0.466667 0.706425 0.630000 0.076425 -0.433333 0.733833 0.650000 0.083833 -0.400000 0.761257 0.670000 0.091257 -0.366667 0.788739 0.690000 0.098739 -0.333333 0.816318 0.720000 0.096318 -0.300000 0.844034 0.740000 0.104034 -0.266667 0.871926 0.770000 0.101926 -0.233333 0.900035 0.790000 0.110035 -0.200000 0.928399 0.820000 0.108399 -0.166667 0.957059 0.850000 0.107059 -0.133333 0.986054 0.880000 0.106054 -0.100000 1.015425 0.900000 0.115425 -0.066667 1.045210 0.940000 0.105210 -0.033333 1.075449 0.970000 0.105449 0.000000 1.106183 1.000000 0.106183 0.033333 1.137451 1.030000 0.107451 0.066667 1.169293 1.070000 0.099293 0.100000 1.201747 1.110000 0.091747 0.133333 1.234855 1.140000 0.094855 0.166667 1.268656 1.180000 0.088656 0.200000 1.303190 1.220000 0.083190 0.233333 1.338495 1.260000 0.078495 0.266667 1.374613 1.310000 0.064613 0.300000 1.411583 1.350000 0.061583 0.333333 1.449443 1.400000 0.049443 0.366667 1.488236 1.440000 0.048236 0.400000 1.527999 1.490000 0.037999 0.433333 1.568772 1.540000 0.028772 0.466667 1.610596 1.590000 0.020596 0.500000 1.653510 1.650000 0.003510 0.533333 1.697554 1.700000 -0.002446 0.566667 1.742767 1.760000 -0.017233 0.600000 1.789190 1.820000 -0.030810 0.633333 1.836861 1.880000 -0.043139 0.666667 1.885822 1.950000 -0.064178 0.700000 1.936110 2.010000 -0.073890 0.733333 1.987767 2.080000 -0.092233 0.766667 2.040832 2.150000 -0.109168 0.800000 2.095344 2.230000 -0.134656 0.833333 2.151343 2.300000 -0.148657 0.866667 2.208870 2.380000 -0.171130 0.900000 2.267963 2.460000 -0.192037 0.933333 2.328663 2.540000 -0.211337 0.966667 2.391009 2.630000 -0.238991 1.000000 2.455041 2.720000 -0.264959 Use a polynomial of degree: 4 Total approximation error = 0.103211 X, F(X), P(X), Error -1.000000 0.161994 0.370000 -0.208006 -0.966667 0.156348 0.380000 -0.223652 -0.933333 0.157419 0.390000 -0.232581 -0.900000 0.164623 0.410000 -0.245377 -0.866667 0.177396 0.420000 -0.242604 -0.833333 0.195195 0.430000 -0.234805 -0.800000 0.217503 0.450000 -0.232497 -0.766667 0.243822 0.460000 -0.216178 -0.733333 0.273675 0.480000 -0.206325 -0.700000 0.306610 0.500000 -0.193390 -0.666667 0.342194 0.510000 -0.167806 -0.633333 0.380018 0.530000 -0.149982 -0.600000 0.419693 0.550000 -0.130307 -0.566667 0.460855 0.570000 -0.109145 -0.533333 0.503158 0.590000 -0.086842 -0.500000 0.546280 0.610000 -0.063720 -0.466667 0.589922 0.630000 -0.040078 -0.433333 0.633806 0.650000 -0.016194 -0.400000 0.677674 0.670000 0.007674 -0.366667 0.721293 0.690000 0.031293 -0.333333 0.764450 0.720000 0.044450 -0.300000 0.806954 0.740000 0.066954 -0.266667 0.848638 0.770000 0.078638 -0.233333 0.889353 0.790000 0.099353 -0.200000 0.928977 0.820000 0.108977 -0.166667 0.967404 0.850000 0.117404 -0.133333 1.004556 0.880000 0.124556 -0.100000 1.040373 0.900000 0.140373 -0.066667 1.074817 0.940000 0.134817 -0.033333 1.107874 0.970000 0.137874 0.000000 1.139551 1.000000 0.139551 0.033333 1.169876 1.030000 0.139876 0.066667 1.198900 1.070000 0.128900 0.100000 1.226695 1.110000 0.116695 0.133333 1.253357 1.140000 0.113357 0.166667 1.279002 1.180000 0.099002 0.200000 1.303767 1.220000 0.083767 0.233333 1.327814 1.260000 0.067814 0.266667 1.351324 1.310000 0.041324 0.300000 1.374503 1.350000 0.024503 0.333333 1.397575 1.400000 -0.002425 0.366667 1.420789 1.440000 -0.019211 0.400000 1.444415 1.490000 -0.045585 0.433333 1.468745 1.540000 -0.071255 0.466667 1.494093 1.590000 -0.095907 0.500000 1.520794 1.650000 -0.129206 0.533333 1.549207 1.700000 -0.150793 0.566667 1.579710 1.760000 -0.180290 0.600000 1.612705 1.820000 -0.207295 0.633333 1.648617 1.880000 -0.231383 0.666667 1.687889 1.950000 -0.262111 0.700000 1.730990 2.010000 -0.279010 0.733333 1.778409 2.080000 -0.301591 0.766667 1.830657 2.150000 -0.319343 0.800000 1.888267 2.230000 -0.341733 0.833333 1.951794 2.300000 -0.348206 0.866667 2.021816 2.380000 -0.358184 0.900000 2.098930 2.460000 -0.361070 0.933333 2.183758 2.540000 -0.356242 0.966667 2.276943 2.630000 -0.353057 1.000000 2.379150 2.720000 -0.340850 Use a polynomial of degree: 5 Total approximation error = 0.103209 X, F(X), P(X), Error -1.000000 0.163446 0.370000 -0.206554 -0.966667 0.158113 0.380000 -0.221887 -0.933333 0.159341 0.390000 -0.230659 -0.900000 0.166571 0.410000 -0.243429 -0.866667 0.179262 0.420000 -0.240738 -0.833333 0.196896 0.430000 -0.233104 -0.800000 0.218973 0.450000 -0.231027 -0.766667 0.245013 0.460000 -0.214987 -0.733333 0.274556 0.480000 -0.205444 -0.700000 0.307163 0.500000 -0.192837 -0.666667 0.342416 0.510000 -0.167584 -0.633333 0.379914 0.530000 -0.150086 -0.600000 0.419279 0.550000 -0.130721 -0.566667 0.460154 0.570000 -0.109846 -0.533333 0.502200 0.590000 -0.087800 -0.500000 0.545101 0.610000 -0.064899 -0.466667 0.588560 0.630000 -0.041440 -0.433333 0.632301 0.650000 -0.017699 -0.400000 0.676071 0.670000 0.006071 -0.366667 0.719634 0.690000 0.029634 -0.333333 0.762779 0.720000 0.042779 -0.300000 0.805314 0.740000 0.065314 -0.266667 0.847068 0.770000 0.077068 -0.233333 0.887891 0.790000 0.097891 -0.200000 0.927656 0.820000 0.107656 -0.166667 0.966255 0.850000 0.116255 -0.133333 1.003605 0.880000 0.123605 -0.100000 1.039640 0.900000 0.139640 -0.066667 1.074320 0.940000 0.134320 -0.033333 1.107623 0.970000 0.137623 0.000000 1.139551 1.000000 0.139551 0.033333 1.170127 1.030000 0.140127 0.066667 1.199397 1.070000 0.129397 0.100000 1.227428 1.110000 0.117428 0.133333 1.254309 1.140000 0.114309 0.166667 1.280151 1.180000 0.100151 0.200000 1.305088 1.220000 0.085088 0.233333 1.329277 1.260000 0.069277 0.266667 1.352895 1.310000 0.042895 0.300000 1.376143 1.350000 0.026143 0.333333 1.399245 1.400000 -0.000755 0.366667 1.422448 1.440000 -0.017552 0.400000 1.446019 1.490000 -0.043981 0.433333 1.470250 1.540000 -0.069750 0.466667 1.495456 1.590000 -0.094544 0.500000 1.521974 1.650000 -0.128026 0.533333 1.550164 1.700000 -0.149836 0.566667 1.580410 1.760000 -0.179590 0.600000 1.613119 1.820000 -0.206881 0.633333 1.648721 1.880000 -0.231279 0.666667 1.687668 1.950000 -0.262332 0.700000 1.730437 2.010000 -0.279563 0.733333 1.777529 2.080000 -0.302471 0.766667 1.829466 2.150000 -0.320534 0.800000 1.886798 2.230000 -0.343202 0.833333 1.950094 2.300000 -0.349906 0.866667 2.019949 2.380000 -0.360051 0.900000 2.096982 2.460000 -0.363018 0.933333 2.181836 2.540000 -0.358164 0.966667 2.275178 2.630000 -0.354822 1.000000 2.377698 2.720000 -0.342302 Use a polynomial of degree: 6 Total approximation error = 0.087915 X, F(X), P(X), Error -1.000000 0.312701 0.370000 -0.057299 -0.966667 0.322392 0.380000 -0.057608 -0.933333 0.320799 0.390000 -0.069201 -0.900000 0.312035 0.410000 -0.097965 -0.866667 0.299560 0.420000 -0.120440 -0.833333 0.286244 0.430000 -0.143756 -0.800000 0.274411 0.450000 -0.175589 -0.766667 0.265894 0.460000 -0.194106 -0.733333 0.262083 0.480000 -0.217917 -0.700000 0.263967 0.500000 -0.236033 -0.666667 0.272185 0.510000 -0.237815 -0.633333 0.287063 0.530000 -0.242937 -0.600000 0.308658 0.550000 -0.241342 -0.566667 0.336791 0.570000 -0.233209 -0.533333 0.371092 0.590000 -0.218908 -0.500000 0.411026 0.610000 -0.198974 -0.466667 0.455932 0.630000 -0.174068 -0.433333 0.505048 0.650000 -0.144952 -0.400000 0.557545 0.670000 -0.112455 -0.366667 0.612549 0.690000 -0.077451 -0.333333 0.669169 0.720000 -0.050831 -0.300000 0.726517 0.740000 -0.013483 -0.266667 0.783733 0.770000 0.013733 -0.233333 0.839996 0.790000 0.049996 -0.200000 0.894551 0.820000 0.074551 -0.166667 0.946715 0.850000 0.096715 -0.133333 0.995894 0.880000 0.115894 -0.100000 1.041593 0.900000 0.141593 -0.066667 1.083428 0.940000 0.143428 -0.033333 1.121125 0.970000 0.151125 0.000000 1.154535 1.000000 0.154535 0.033333 1.183630 1.030000 0.153630 0.066667 1.208505 1.070000 0.138505 0.100000 1.229381 1.110000 0.119381 0.133333 1.246598 1.140000 0.106598 0.166667 1.260610 1.180000 0.080610 0.200000 1.271984 1.220000 0.051984 0.233333 1.281382 1.260000 0.021382 0.266667 1.289560 1.310000 -0.020440 0.300000 1.297346 1.350000 -0.052654 0.333333 1.305635 1.400000 -0.094365 0.366667 1.315362 1.440000 -0.124638 0.400000 1.327493 1.490000 -0.162507 0.433333 1.342997 1.540000 -0.197003 0.466667 1.362828 1.590000 -0.227172 0.500000 1.387899 1.650000 -0.262101 0.533333 1.419056 1.700000 -0.280944 0.566667 1.457048 1.760000 -0.302952 0.600000 1.502498 1.820000 -0.317502 0.633333 1.555870 1.880000 -0.324130 0.666667 1.617437 1.950000 -0.332563 0.700000 1.687241 2.010000 -0.322759 0.733333 1.765055 2.080000 -0.314945 0.766667 1.850348 2.150000 -0.299652 0.800000 1.942236 2.230000 -0.287764 0.833333 2.039441 2.300000 -0.260559 0.866667 2.140247 2.380000 -0.239753 0.900000 2.242446 2.460000 -0.217554 0.933333 2.343294 2.540000 -0.196706 0.966667 2.439457 2.630000 -0.190543 1.000000 2.526953 2.720000 -0.193047 TEST126 LEAST_SET sets a least squares polynomial, LEAST_VAL evaluates it. X, F(X), P(X), Error Using polynomial order = 1 -1.000000 0.370000 1.194286 0.824286 -0.900000 0.410000 1.194286 0.784286 -0.800000 0.450000 1.194286 0.744286 -0.700000 0.500000 1.194286 0.694286 -0.600000 0.550000 1.194286 0.644286 -0.500000 0.610000 1.194286 0.584286 -0.400000 0.670000 1.194286 0.524286 -0.300000 0.740000 1.194286 0.454286 -0.200000 0.820000 1.194286 0.374286 -0.100000 0.900000 1.194286 0.294286 0.000000 1.000000 1.194286 0.194286 0.100000 1.110000 1.194286 0.084286 0.200000 1.220000 1.194286 -0.025714 0.300000 1.350000 1.194286 -0.155714 0.400000 1.490000 1.194286 -0.295714 0.500000 1.650000 1.194286 -0.455714 0.600000 1.820000 1.194286 -0.625714 0.700000 2.010000 1.194286 -0.815714 0.800000 2.230000 1.194286 -1.035714 0.900000 2.460000 1.194286 -1.265714 1.000000 2.720000 1.194286 -1.525714 Using polynomial order = 2 -1.000000 0.370000 0.081299 -0.288701 -0.900000 0.410000 0.192597 -0.217403 -0.800000 0.450000 0.303896 -0.146104 -0.700000 0.500000 0.415195 -0.084805 -0.600000 0.550000 0.526494 -0.023506 -0.500000 0.610000 0.637792 0.027792 -0.400000 0.670000 0.749091 0.079091 -0.300000 0.740000 0.860390 0.120390 -0.200000 0.820000 0.971688 0.151688 -0.100000 0.900000 1.082987 0.182987 0.000000 1.000000 1.194286 0.194286 0.100000 1.110000 1.305584 0.195584 0.200000 1.220000 1.416883 0.196883 0.300000 1.350000 1.528182 0.178182 0.400000 1.490000 1.639481 0.149481 0.500000 1.650000 1.750779 0.100779 0.600000 1.820000 1.862078 0.042078 0.700000 2.010000 1.973377 -0.036623 0.800000 2.230000 2.084675 -0.145325 0.900000 2.460000 2.195974 -0.264026 1.000000 2.720000 2.307273 -0.412727 Using polynomial order = 3 -1.000000 0.370000 0.425003 0.055003 -0.900000 0.410000 0.433190 0.023190 -0.800000 0.450000 0.452232 0.002232 -0.700000 0.500000 0.482127 -0.017873 -0.600000 0.550000 0.522876 -0.027124 -0.500000 0.610000 0.574478 -0.035522 -0.400000 0.670000 0.636935 -0.033065 -0.300000 0.740000 0.710245 -0.029755 -0.200000 0.820000 0.794409 -0.025591 -0.100000 0.900000 0.889427 -0.010573 0.000000 1.000000 0.995299 -0.004701 0.100000 1.110000 1.112025 0.002025 0.200000 1.220000 1.239604 0.019604 0.300000 1.350000 1.378037 0.028037 0.400000 1.490000 1.527324 0.037324 0.500000 1.650000 1.687465 0.037465 0.600000 1.820000 1.858460 0.038460 0.700000 2.010000 2.040308 0.030308 0.800000 2.230000 2.233011 0.003011 0.900000 2.460000 2.436567 -0.023433 1.000000 2.720000 2.650977 -0.069023 Using polynomial order = 4 -1.000000 0.370000 0.363870 -0.006130 -0.900000 0.410000 0.408737 -0.001263 -0.800000 0.450000 0.454806 0.004806 -0.700000 0.500000 0.503148 0.003148 -0.600000 0.550000 0.554836 0.004836 -0.500000 0.610000 0.610944 0.000944 -0.400000 0.670000 0.672542 0.002542 -0.300000 0.740000 0.740704 0.000704 -0.200000 0.820000 0.816503 -0.003497 -0.100000 0.900000 0.901010 0.001010 0.000000 1.000000 0.995299 -0.004701 0.100000 1.110000 1.100442 -0.009558 0.200000 1.220000 1.217510 -0.002490 0.300000 1.350000 1.347578 -0.002422 0.400000 1.490000 1.491717 0.001717 0.500000 1.650000 1.651000 0.001000 0.600000 1.820000 1.826499 0.006499 0.700000 2.010000 2.019287 0.009287 0.800000 2.230000 2.230437 0.000437 0.900000 2.460000 2.461020 0.001020 1.000000 2.720000 2.712110 -0.007890 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.000000 -4.000000 -5.633333 -3.000000 0.000000 -0.900000 -4.290000 -5.633333 -2.800000 0.000000 -0.800000 -4.560000 -5.633333 -2.600000 0.000000 -0.700000 -4.810000 -5.633333 -2.400000 0.000000 -0.600000 -5.040000 -5.633333 -2.200000 0.000000 -0.500000 -5.250000 -5.633333 -2.000000 0.000000 -0.400000 -5.440000 -5.633333 -1.800000 0.000000 -0.300000 -5.610000 -5.633333 -1.600000 0.000000 -0.200000 -5.760000 -5.633333 -1.400000 0.000000 -0.100000 -5.890000 -5.633333 -1.200000 0.000000 0.000000 -6.000000 -5.633333 -1.000000 0.000000 0.100000 -6.090000 -5.633333 -0.800000 0.000000 0.200000 -6.160000 -5.633333 -0.600000 0.000000 0.300000 -6.210000 -5.633333 -0.400000 0.000000 0.400000 -6.240000 -5.633333 -0.200000 0.000000 0.500000 -6.250000 -5.633333 0.000000 0.000000 0.600000 -6.240000 -5.633333 0.200000 0.000000 0.700000 -6.210000 -5.633333 0.400000 0.000000 0.800000 -6.160000 -5.633333 0.600000 0.000000 0.900000 -6.090000 -5.633333 0.800000 0.000000 1.000000 -6.000000 -5.633333 1.000000 0.000000 Using polynomial order = 2 -1.000000 -4.000000 -4.633333 -3.000000 -1.000000 -0.900000 -4.290000 -4.733333 -2.800000 -1.000000 -0.800000 -4.560000 -4.833333 -2.600000 -1.000000 -0.700000 -4.810000 -4.933333 -2.400000 -1.000000 -0.600000 -5.040000 -5.033333 -2.200000 -1.000000 -0.500000 -5.250000 -5.133333 -2.000000 -1.000000 -0.400000 -5.440000 -5.233333 -1.800000 -1.000000 -0.300000 -5.610000 -5.333333 -1.600000 -1.000000 -0.200000 -5.760000 -5.433333 -1.400000 -1.000000 -0.100000 -5.890000 -5.533333 -1.200000 -1.000000 0.000000 -6.000000 -5.633333 -1.000000 -1.000000 0.100000 -6.090000 -5.733333 -0.800000 -1.000000 0.200000 -6.160000 -5.833333 -0.600000 -1.000000 0.300000 -6.210000 -5.933333 -0.400000 -1.000000 0.400000 -6.240000 -6.033333 -0.200000 -1.000000 0.500000 -6.250000 -6.133333 0.000000 -1.000000 0.600000 -6.240000 -6.233333 0.200000 -1.000000 0.700000 -6.210000 -6.333333 0.400000 -1.000000 0.800000 -6.160000 -6.433333 0.600000 -1.000000 0.900000 -6.090000 -6.533333 0.800000 -1.000000 1.000000 -6.000000 -6.633333 1.000000 -1.000000 Using polynomial order = 3 -1.000000 -4.000000 -4.000000 -3.000000 -3.000000 -0.900000 -4.290000 -4.290000 -2.800000 -2.800000 -0.800000 -4.560000 -4.560000 -2.600000 -2.600000 -0.700000 -4.810000 -4.810000 -2.400000 -2.400000 -0.600000 -5.040000 -5.040000 -2.200000 -2.200000 -0.500000 -5.250000 -5.250000 -2.000000 -2.000000 -0.400000 -5.440000 -5.440000 -1.800000 -1.800000 -0.300000 -5.610000 -5.610000 -1.600000 -1.600000 -0.200000 -5.760000 -5.760000 -1.400000 -1.400000 -0.100000 -5.890000 -5.890000 -1.200000 -1.200000 0.000000 -6.000000 -6.000000 -1.000000 -1.000000 0.100000 -6.090000 -6.090000 -0.800000 -0.800000 0.200000 -6.160000 -6.160000 -0.600000 -0.600000 0.300000 -6.210000 -6.210000 -0.400000 -0.400000 0.400000 -6.240000 -6.240000 -0.200000 -0.200000 0.500000 -6.250000 -6.250000 0.000000 0.000000 0.600000 -6.240000 -6.240000 0.200000 0.200000 0.700000 -6.210000 -6.210000 0.400000 0.400000 0.800000 -6.160000 -6.160000 0.600000 0.600000 0.900000 -6.090000 -6.090000 0.800000 0.800000 1.000000 -6.000000 -6.000000 1.000000 1.000000 Using polynomial order = 4 -1.000000 -4.000000 -4.000000 -3.000000 -3.000000 -0.900000 -4.290000 -4.290000 -2.800000 -2.800000 -0.800000 -4.560000 -4.560000 -2.600000 -2.600000 -0.700000 -4.810000 -4.810000 -2.400000 -2.400000 -0.600000 -5.040000 -5.040000 -2.200000 -2.200000 -0.500000 -5.250000 -5.250000 -2.000000 -2.000000 -0.400000 -5.440000 -5.440000 -1.800000 -1.800000 -0.300000 -5.610000 -5.610000 -1.600000 -1.600000 -0.200000 -5.760000 -5.760000 -1.400000 -1.400000 -0.100000 -5.890000 -5.890000 -1.200000 -1.200000 0.000000 -6.000000 -6.000000 -1.000000 -1.000000 0.100000 -6.090000 -6.090000 -0.800000 -0.800000 0.200000 -6.160000 -6.160000 -0.600000 -0.600000 0.300000 -6.210000 -6.210000 -0.400000 -0.400000 0.400000 -6.240000 -6.240000 -0.200000 -0.200000 0.500000 -6.250000 -6.250000 0.000000 0.000000 0.600000 -6.240000 -6.240000 0.200000 0.200000 0.700000 -6.210000 -6.210000 0.400000 0.400000 0.800000 -6.160000 -6.160000 0.600000 0.600000 0.900000 -6.090000 -6.090000 0.800000 0.800000 1.000000 -6.000000 -6.000000 1.000000 1.000000 TEST13 SPLINE_B_VAL evaluates the B spline. The data to be interpolated: Number of data values = 11 T Y 0.000000 0.000000 1.000000 0.587785 2.000000 0.951057 3.000000 0.951057 4.000000 0.587785 5.000000 0.000000 6.000000 -0.587785 7.000000 -0.951057 8.000000 -0.951057 9.000000 -0.587785 10.000000 -0.000000 T, Spline(T) -0.500000 -0.289215 -0.375000 -0.218446 -0.250000 -0.146362 -0.125000 -0.073400 * 0.000000 0.000000 0.250000 0.146362 0.500000 0.289215 0.750000 0.425053 * 1.000000 0.550366 1.250000 0.661871 1.500000 0.757175 1.750000 0.834112 * 2.000000 0.890511 2.250000 0.924568 2.500000 0.935920 2.750000 0.924568 * 3.000000 0.890511 3.250000 0.834112 3.500000 0.757175 3.750000 0.661871 * 4.000000 0.550366 4.250000 0.425053 4.500000 0.289215 4.750000 0.146362 * 5.000000 0.000000 5.250000 -0.146362 5.500000 -0.289215 5.750000 -0.425053 * 6.000000 -0.550366 6.250000 -0.661871 6.500000 -0.757175 6.750000 -0.834112 * 7.000000 -0.890511 7.250000 -0.924568 7.500000 -0.935920 7.750000 -0.924568 * 8.000000 -0.890511 8.250000 -0.834112 8.500000 -0.757175 8.750000 -0.661871 * 9.000000 -0.550366 9.250000 -0.425053 9.500000 -0.289215 9.750000 -0.146362 * 10.000000 -0.000000 10.125000 0.073400 10.250000 0.146362 10.375000 0.218446 10.500000 0.289215 TEST14 SPLINE_BETA_VAL evaluates the BETA spline. The data to be interpolated: Number of data values = 11 T Y 0.000000 0.000000 1.000000 0.587785 2.000000 0.951057 3.000000 0.951057 4.000000 0.587785 5.000000 0.000000 6.000000 -0.587785 7.000000 -0.951057 8.000000 -0.951057 9.000000 -0.587785 10.000000 -0.000000 BETA1 = 1.000000 BETA2 = 0.000000 T, Spline(T) -0.500000 -0.289215 -0.375000 -0.218446 -0.250000 -0.146362 -0.125000 -0.073400 * 0.000000 0.000000 0.250000 0.146362 0.500000 0.289215 0.750000 0.425053 * 1.000000 0.550366 1.250000 0.661871 1.500000 0.757175 1.750000 0.834112 * 2.000000 0.890511 2.250000 0.924568 2.500000 0.935920 2.750000 0.924568 * 3.000000 0.890511 3.250000 0.834112 3.500000 0.757175 3.750000 0.661871 * 4.000000 0.550366 4.250000 0.425053 4.500000 0.289215 4.750000 0.146362 * 5.000000 0.000000 5.250000 -0.146362 5.500000 -0.289215 5.750000 -0.425053 * 6.000000 -0.550366 6.250000 -0.661871 6.500000 -0.757175 6.750000 -0.834112 * 7.000000 -0.890511 7.250000 -0.924568 7.500000 -0.935920 7.750000 -0.924568 * 8.000000 -0.890511 8.250000 -0.834112 8.500000 -0.757175 8.750000 -0.661871 * 9.000000 -0.550366 9.250000 -0.425053 9.500000 -0.289215 9.750000 -0.146362 * 10.000000 -0.000000 10.125000 0.073400 10.250000 0.146362 10.375000 0.218446 10.500000 0.289215 BETA1 = 1.000000 BETA2 = 100.000000 T, Spline(T) -0.500000 0.493821 -0.375000 0.253349 -0.250000 0.099120 -0.125000 0.018786 * 0.000000 0.000000 0.250000 0.097683 0.500000 0.293391 0.750000 0.488348 * 1.000000 0.583776 1.250000 0.646403 1.500000 0.768109 1.750000 0.887847 * 2.000000 0.944570 2.250000 0.948218 2.500000 0.949435 2.750000 0.948218 * 3.000000 0.944570 3.250000 0.887847 3.500000 0.768109 3.750000 0.646403 * 4.000000 0.583776 4.250000 0.488348 4.500000 0.293391 4.750000 0.097683 * 5.000000 0.000000 5.250000 -0.097683 5.500000 -0.293391 5.750000 -0.488348 * 6.000000 -0.583776 6.250000 -0.646403 6.500000 -0.768109 6.750000 -0.887847 * 7.000000 -0.944570 7.250000 -0.948218 7.500000 -0.949435 7.750000 -0.948218 * 8.000000 -0.944570 8.250000 -0.887847 8.500000 -0.768109 8.750000 -0.646403 * 9.000000 -0.583776 9.250000 -0.488348 9.500000 -0.293391 9.750000 -0.097683 * 10.000000 -0.000000 10.125000 -0.018786 10.250000 -0.099120 10.375000 -0.253349 10.500000 -0.493821 BETA1 = 100.000000 BETA2 = 0.000000 T, Spline(T) -0.500000 -1.939532 -0.375000 -1.495083 -0.250000 -1.124158 -0.125000 -0.820073 * 0.000000 -0.576146 0.250000 -0.242029 0.500000 -0.068338 0.750000 -0.001604 * 1.000000 0.011639 1.250000 0.345362 1.500000 0.518042 1.750000 0.583355 * 2.000000 0.594978 2.250000 0.800836 2.500000 0.906547 2.750000 0.945493 * 3.000000 0.951056 3.250000 0.950418 3.500000 0.948782 3.750000 0.946484 * 4.000000 0.943863 4.250000 0.736973 4.500000 0.628614 4.750000 0.585951 * 5.000000 0.576146 5.250000 0.242029 5.500000 0.068338 5.750000 0.001604 * 6.000000 -0.011639 6.250000 -0.345362 6.500000 -0.518042 6.750000 -0.583355 * 7.000000 -0.594978 7.250000 -0.800836 7.500000 -0.906547 7.750000 -0.945493 * 8.000000 -0.951056 8.250000 -0.950418 8.500000 -0.948782 8.750000 -0.946484 * 9.000000 -0.943863 9.250000 -0.736973 9.500000 -0.628614 9.750000 -0.585951 * 10.000000 -0.576146 10.125000 -0.573304 10.250000 -0.566362 10.375000 -0.551217 10.500000 -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.038462 * -1.000000 * 0.047059 * -0.800000 * 0.075472 * -0.600000 * 0.137931 * -0.400000 * 0.307692 * -0.200000 * 0.800000 * 0.000000 * 0.800000 * 0.200000 * 0.307692 * 0.400000 * 0.137931 * 0.600000 * 0.075472 * 0.800000 * 0.047059 * 1.000000 * 0.038462 T Y(interp) Y(exact) * 0.038462 -1.992647 0.038462 0.009973 -1.945532 0.038462 0.010457 -1.824684 0.038462 0.011871 -1.753091 0.038462 0.012848 -1.735525 0.038462 0.013106 -1.621821 0.038462 0.014980 -1.560173 0.038462 0.016167 -1.126327 0.038462 0.030567 * -1.000000 0.038462 * 0.047059 -0.969689 0.047059 0.040804 * -0.800000 0.058824 * 0.075472 * -0.600000 0.100000 * 0.137931 -0.596991 0.137931 0.100909 * -0.400000 0.200000 * 0.307692 -0.394775 0.307692 0.204241 -0.338772 0.307692 0.258454 -0.201844 0.307692 0.495411 * -0.200000 0.500000 * 0.800000 * 0.000000 1.000000 * 0.800000 * 0.200000 0.500000 * 0.307692 0.246782 0.307692 0.396427 * 0.400000 0.200000 * 0.137931 0.535863 0.137931 0.122268 * 0.600000 0.100000 * 0.075472 * 0.800000 0.058824 * 0.047059 * 1.000000 0.038462 * 0.038462 1.018694 0.038462 0.037115 1.189148 0.038462 0.027509 1.318037 0.038462 0.022507 1.590016 0.038462 0.015575 1.825270 0.038462 0.011864 TEST15 SPLINE_CUBIC_SET sets up a cubic spline SPLINE_CUBIC_VAL evaluates it. Runge's function, evenly spaced knots. The data to be interpolated: Number of data values = 11 T Y -1.000000 0.038462 -0.800000 0.058824 -0.600000 0.100000 -0.400000 0.200000 -0.200000 0.500000 0.000000 1.000000 0.200000 0.500000 0.400000 0.200000 0.600000 0.100000 0.800000 0.058824 1.000000 0.038462 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.505190 1.300000 2.479372 4.400000 18.577322 12.500000 -46.788661 -50.000000 18.577322 12.500000 2.479372 4.400000 1.505190 1.300000 0.323396 0.478323 0.323396 0.210514 T, SPLINE(T), F(T) -2.000000 0.130689 0.009901 -1.000000 0.038462 0.038462 -0.900000 0.047026 0.047059 -0.800000 0.058824 0.058824 -0.700000 0.074840 0.075472 -0.600000 0.100000 0.100000 -0.500000 0.140039 0.137931 -0.400000 0.200000 0.200000 -0.300000 0.297358 0.307692 -0.200000 0.500000 0.500000 -0.100000 0.820528 0.800000 0.000000 1.000000 1.000000 0.100000 0.820528 0.800000 0.200000 0.500000 0.500000 0.300000 0.297358 0.307692 0.400000 0.200000 0.200000 0.500000 0.140039 0.137931 0.600000 0.100000 0.100000 0.700000 0.074840 0.075472 0.800000 0.058824 0.058824 0.900000 0.047026 0.047059 1.000000 0.038462 0.038462 2.000000 0.130689 0.009901 Boundary condition 1 at both ends: Y'(left) = 0.073964 Y'(right) = -0.073964 SPLINE"(T), F"(T): 0.245555 0.210514 0.344254 0.478323 1.499599 1.300000 2.480877 4.400000 18.576892 12.500000 -46.788446 -50.000000 18.576892 12.500000 2.480877 4.400000 1.499599 1.300000 0.344254 0.478323 0.245555 0.210514 T, SPLINE(T), F(T) -2.000000 0.005025 0.009901 -1.000000 0.038462 0.038462 -0.900000 0.047168 0.047059 -0.800000 0.058824 0.058824 -0.700000 0.074802 0.075472 -0.600000 0.100000 0.100000 -0.500000 0.140049 0.137931 -0.400000 0.200000 0.200000 -0.300000 0.297356 0.307692 -0.200000 0.500000 0.500000 -0.100000 0.820529 0.800000 0.000000 1.000000 1.000000 0.100000 0.820529 0.800000 0.200000 0.500000 0.500000 0.300000 0.297356 0.307692 0.400000 0.200000 0.200000 0.500000 0.140049 0.137931 0.600000 0.100000 0.100000 0.700000 0.074802 0.075472 0.800000 0.058824 0.058824 0.900000 0.047168 0.047059 1.000000 0.038462 0.038462 2.000000 0.005025 0.009901 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.497083 1.300000 2.481555 4.400000 18.576699 12.500000 -46.788349 -50.000000 18.576699 12.500000 2.481555 4.400000 1.497083 1.300000 0.353644 0.478323 0.210514 0.210514 T, SPLINE(T), F(T) -2.000000 -0.051543 0.009901 -1.000000 0.038462 0.038462 -0.900000 0.047232 0.047059 -0.800000 0.058824 0.058824 -0.700000 0.074785 0.075472 -0.600000 0.100000 0.100000 -0.500000 0.140053 0.137931 -0.400000 0.200000 0.200000 -0.300000 0.297354 0.307692 -0.200000 0.500000 0.500000 -0.100000 0.820529 0.800000 0.000000 1.000000 1.000000 0.100000 0.820529 0.800000 0.200000 0.500000 0.500000 0.300000 0.297354 0.307692 0.400000 0.200000 0.200000 0.500000 0.140053 0.137931 0.600000 0.100000 0.100000 0.700000 0.074785 0.075472 0.800000 0.058824 0.058824 0.900000 0.047232 0.047059 1.000000 0.038462 0.038462 2.000000 -0.051543 0.009901 "Natural" spline: Boundary condition 2 at both ends: YP"(left) = 0.000000 YP"(right) = 0.000000 I Y(I) YPP(I) 1 0.038462 0.000000 2 0.058824 0.410052 3 0.100000 1.481963 4 0.200000 2.485625 5 0.500000 18.575536 6 1.000000 -46.787768 7 0.500000 18.575536 8 0.200000 2.485625 9 0.100000 1.481963 10 0.058824 0.410052 11 0.038462 0.000000 SPLINE"(T), F"(T): 0.000000 0.210514 0.410052 0.478323 1.481963 1.300000 2.485625 4.400000 18.575536 12.500000 -46.787768 -50.000000 18.575536 12.500000 2.485625 4.400000 1.481963 1.300000 0.410052 0.478323 0.000000 0.210514 T, SPLINE(T), F(T) -2.000000 -0.391390 0.009901 -1.000000 0.038462 0.038462 -0.900000 0.047617 0.047059 -0.800000 0.058824 0.058824 -0.700000 0.074682 0.075472 -0.600000 0.100000 0.100000 -0.500000 0.140081 0.137931 -0.400000 0.200000 0.200000 -0.300000 0.297347 0.307692 -0.200000 0.500000 0.500000 -0.100000 0.820531 0.800000 0.000000 1.000000 1.000000 0.100000 0.820531 0.800000 0.200000 0.500000 0.500000 0.300000 0.297347 0.307692 0.400000 0.200000 0.200000 0.500000 0.140081 0.137931 0.600000 0.100000 0.100000 0.700000 0.074682 0.075472 0.800000 0.058824 0.058824 0.900000 0.047617 0.047059 1.000000 0.038462 0.038462 2.000000 -0.391390 0.009901 "Not-a-knot" spline: SPLINE"(T), F"(T): -0.411671 0.210514 0.520362 0.478323 1.452395 1.300000 2.493586 4.400000 18.573261 12.500000 -46.786631 -50.000000 18.573261 12.500000 2.493586 4.400000 1.452395 1.300000 0.520362 0.478323 -0.411671 0.210514 T, SPLINE(T), F(T) -2.000000 -1.055978 0.009901 -1.000000 0.038462 0.038462 -0.900000 0.048371 0.047059 -0.800000 0.058824 0.058824 -0.700000 0.074480 0.075472 -0.600000 0.100000 0.100000 -0.500000 0.140135 0.137931 -0.400000 0.200000 0.200000 -0.300000 0.297333 0.307692 -0.200000 0.500000 0.500000 -0.100000 0.820533 0.800000 0.000000 1.000000 1.000000 0.100000 0.820533 0.800000 0.200000 0.500000 0.500000 0.300000 0.297333 0.307692 0.400000 0.200000 0.200000 0.500000 0.140135 0.137931 0.600000 0.100000 0.100000 0.700000 0.074480 0.075472 0.800000 0.058824 0.058824 0.900000 0.048371 0.047059 1.000000 0.038462 0.038462 2.000000 -1.055978 0.009901 TEST16 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL2 evaluates it. Runge's function, evenly spaced knots. The data to be interpolated: Number of data values = 11 T Y -1.000000 0.038462 -0.800000 0.058824 -0.600000 0.100000 -0.400000 0.200000 -0.200000 0.500000 0.000000 1.000000 0.200000 0.500000 0.400000 0.200000 0.600000 0.100000 0.800000 0.058824 1.000000 0.038462 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.505190 1.300000 2.479372 4.400000 18.577322 12.500000 -46.788661 -50.000000 18.577322 12.500000 2.479372 4.400000 1.505190 1.300000 0.323396 0.478323 0.323396 0.210514 T, SPLINE(T), F(T), LEFT_IN, LEFT_OUT -2.000000 0.130689 0.009901 0 0 -1.000000 0.038462 0.038462 0 0 -0.900000 0.047026 0.047059 0 0 -0.800000 0.058824 0.058824 0 0 -0.700000 0.074840 0.075472 0 0 -0.600000 0.100000 0.100000 0 0 -0.500000 0.140039 0.137931 0 0 -0.400000 0.200000 0.200000 0 0 -0.300000 0.297358 0.307692 0 0 -0.200000 0.500000 0.500000 0 0 -0.100000 0.820528 0.800000 0 0 0.000000 1.000000 1.000000 0 0 0.100000 0.820528 0.800000 0 0 0.200000 0.500000 0.500000 0 0 0.300000 0.297358 0.307692 0 0 0.400000 0.200000 0.200000 0 0 0.500000 0.140039 0.137931 0 0 0.600000 0.100000 0.100000 0 0 0.700000 0.074840 0.075472 0 0 0.800000 0.058824 0.058824 0 0 0.900000 0.047026 0.047059 0 0 1.000000 0.038462 0.038462 0 0 2.000000 0.130689 0.009901 0 0 Boundary condition 1 at both ends: Y'(left) = 0.073964 Y'(right) = -0.073964 SPLINE"(T), F"(T): 0.245555 0.210514 0.344254 0.478323 1.499599 1.300000 2.480877 4.400000 18.576892 12.500000 -46.788446 -50.000000 18.576892 12.500000 2.480877 4.400000 1.499599 1.300000 0.344254 0.478323 0.245555 0.210514 T, SPLINE(T), F(T), LEFT_IN, LEFT_OUT -2.000000 0.005025 0.009901 0 0 -1.000000 0.038462 0.038462 0 0 -0.900000 0.047168 0.047059 0 0 -0.800000 0.058824 0.058824 0 0 -0.700000 0.074802 0.075472 0 0 -0.600000 0.100000 0.100000 0 0 -0.500000 0.140049 0.137931 0 0 -0.400000 0.200000 0.200000 0 0 -0.300000 0.297356 0.307692 0 0 -0.200000 0.500000 0.500000 0 0 -0.100000 0.820529 0.800000 0 0 0.000000 1.000000 1.000000 0 0 0.100000 0.820529 0.800000 0 0 0.200000 0.500000 0.500000 0 0 0.300000 0.297356 0.307692 0 0 0.400000 0.200000 0.200000 0 0 0.500000 0.140049 0.137931 0 0 0.600000 0.100000 0.100000 0 0 0.700000 0.074802 0.075472 0 0 0.800000 0.058824 0.058824 0 0 0.900000 0.047168 0.047059 0 0 1.000000 0.038462 0.038462 0 0 2.000000 0.005025 0.009901 0 0 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.497083 1.300000 2.481555 4.400000 18.576699 12.500000 -46.788349 -50.000000 18.576699 12.500000 2.481555 4.400000 1.497083 1.300000 0.353644 0.478323 0.210514 0.210514 T, SPLINE(T), F(T), LEFT_IN, LEFT_OUT -2.000000 -0.051543 0.009901 0 0 -1.000000 0.038462 0.038462 0 0 -0.900000 0.047232 0.047059 0 0 -0.800000 0.058824 0.058824 0 0 -0.700000 0.074785 0.075472 0 0 -0.600000 0.100000 0.100000 0 0 -0.500000 0.140053 0.137931 0 0 -0.400000 0.200000 0.200000 0 0 -0.300000 0.297354 0.307692 0 0 -0.200000 0.500000 0.500000 0 0 -0.100000 0.820529 0.800000 0 0 0.000000 1.000000 1.000000 0 0 0.100000 0.820529 0.800000 0 0 0.200000 0.500000 0.500000 0 0 0.300000 0.297354 0.307692 0 0 0.400000 0.200000 0.200000 0 0 0.500000 0.140053 0.137931 0 0 0.600000 0.100000 0.100000 0 0 0.700000 0.074785 0.075472 0 0 0.800000 0.058824 0.058824 0 0 0.900000 0.047232 0.047059 0 0 1.000000 0.038462 0.038462 0 0 2.000000 -0.051543 0.009901 0 0 TEST17 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL evaluates it. Cubic data, unevenly spaced knots. The data to be interpolated: Number of data values = 11 T Y 0.000000 4.000000 0.010000 4.030201 0.040000 4.123264 0.090000 4.286929 0.160000 4.535296 0.250000 4.890625 0.360000 5.385856 0.490000 6.067849 0.640000 7.001344 0.810000 8.273641 1.000000 10.000000 Boundary condition 0 at both ends: Spline is quadratic in boundary intervals. SPLINE"(T), F"(T): 4.052872 4.000000 4.052872 4.060000 4.241385 4.240000 4.539845 4.540000 4.959543 4.960000 5.501744 5.500000 6.154031 6.160000 6.960563 6.940000 7.768403 7.840000 9.111397 8.860000 9.111397 10.000000 T, SPLINE(T), F(T) -1.000000 3.026600 2.000000 0.000000 4.000000 4.000000 0.005000 4.015050 4.015050 0.010000 4.030201 4.030201 0.025000 4.076266 4.076266 0.040000 4.123264 4.123264 0.065000 4.203724 4.203725 0.090000 4.286929 4.286929 0.125000 4.408203 4.408203 0.160000 4.535296 4.535296 0.205000 4.707664 4.707665 0.250000 4.890625 4.890625 0.305000 5.129426 5.129423 0.360000 5.385856 5.385856 0.425000 5.713000 5.713016 0.490000 6.067849 6.067849 0.565000 6.513884 6.513812 0.640000 7.001344 7.001344 0.725000 7.607003 7.607328 0.810000 8.273641 8.273641 0.905000 9.095705 9.094268 1.000000 10.000000 10.000000 2.000000 24.507381 26.000000 Boundary condition 1 at both ends: Y'(left) = 3.000000 Y'(right) = 10.000000 SPLINE"(T), F"(T): 4.000000 4.000000 4.060000 4.060000 4.240000 4.240000 4.540000 4.540000 4.960000 4.960000 5.500000 5.500000 6.160000 6.160000 6.940000 6.940000 7.840000 7.840000 8.860000 8.860000 10.000000 10.000000 T, SPLINE(T), F(T) -1.000000 2.000000 2.000000 0.000000 4.000000 4.000000 0.005000 4.015050 4.015050 0.010000 4.030201 4.030201 0.025000 4.076266 4.076266 0.040000 4.123264 4.123264 0.065000 4.203725 4.203725 0.090000 4.286929 4.286929 0.125000 4.408203 4.408203 0.160000 4.535296 4.535296 0.205000 4.707665 4.707665 0.250000 4.890625 4.890625 0.305000 5.129423 5.129423 0.360000 5.385856 5.385856 0.425000 5.713016 5.713016 0.490000 6.067849 6.067849 0.565000 6.513812 6.513812 0.640000 7.001344 7.001344 0.725000 7.607328 7.607328 0.810000 8.273641 8.273641 0.905000 9.094268 9.094268 1.000000 10.000000 10.000000 2.000000 26.000000 26.000000 Boundary condition 2 at both ends: YP"(left) = 4.000000 YP"(right) = 10.000000 SPLINE"(T), F"(T): 4.000000 4.000000 4.060000 4.060000 4.240000 4.240000 4.540000 4.540000 4.960000 4.960000 5.500000 5.500000 6.160000 6.160000 6.940000 6.940000 7.840000 7.840000 8.860000 8.860000 10.000000 10.000000 T, SPLINE(T), F(T) -1.000000 2.000000 2.000000 0.000000 4.000000 4.000000 0.005000 4.015050 4.015050 0.010000 4.030201 4.030201 0.025000 4.076266 4.076266 0.040000 4.123264 4.123264 0.065000 4.203725 4.203725 0.090000 4.286929 4.286929 0.125000 4.408203 4.408203 0.160000 4.535296 4.535296 0.205000 4.707665 4.707665 0.250000 4.890625 4.890625 0.305000 5.129423 5.129423 0.360000 5.385856 5.385856 0.425000 5.713016 5.713016 0.490000 6.067849 6.067849 0.565000 6.513812 6.513812 0.640000 7.001344 7.001344 0.725000 7.607328 7.607328 0.810000 8.273641 8.273641 0.905000 9.094268 9.094268 1.000000 10.000000 10.000000 2.000000 26.000000 26.000000 TEST18 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL evaluates it. Cubic data, evenly spaced knots. The data to be interpolated: Number of data values = 11 T Y 0.000000 4.000000 0.100000 4.321000 0.200000 4.688000 0.300000 5.107000 0.400000 5.584000 0.500000 6.125000 0.600000 6.736000 0.700000 7.423000 0.800000 8.192000 0.900000 9.049000 1.000000 10.000000 Boundary condition 0 at both ends: Spline is quadratic in boundary intervals. SPLINE"(T), F"(T): 4.473208 4.000000 4.473208 4.600000 5.233962 5.200000 5.790943 5.800000 6.402264 6.400000 7.000000 7.000000 7.597736 7.600000 8.209057 8.200000 8.766038 8.800000 9.526792 9.400000 9.526792 10.000000 T, SPLINE(T), F(T) -1.000000 3.250264 2.000000 -1.486868 2.000000 4.473208 -2.000000 0.000000 4.000000 4.000000 2.986340 3.000000 4.473208 4.000000 0.050000 4.154908 4.155125 3.210000 3.207500 4.473208 4.300000 0.100000 4.321000 4.321000 3.433660 3.430000 4.473208 4.600000 0.150000 4.498433 4.498375 3.666830 3.667500 4.853585 4.900000 0.200000 4.688000 4.688000 3.919019 3.920000 5.233962 5.200000 0.250000 4.890609 4.890625 4.187679 4.187500 5.512453 5.500000 0.300000 5.107000 5.107000 4.470264 4.470000 5.790943 5.800000 0.350000 5.337879 5.337875 4.767453 4.767500 6.096604 6.100000 0.400000 5.584000 5.584000 5.079925 5.080000 6.402264 6.400000 0.450000 5.846124 5.846125 5.407509 5.407500 6.701132 6.700000 0.500000 6.125000 6.125000 5.750038 5.750000 7.000000 7.000000 0.550000 6.421376 6.421375 6.107509 6.107500 7.298868 7.300000 0.600000 6.736000 6.736000 6.479925 6.480000 7.597736 7.600000 0.650000 7.069621 7.069625 6.867453 6.867500 7.903396 7.900000 0.700000 7.423000 7.423000 7.270264 7.270000 8.209057 8.200000 0.750000 7.796891 7.796875 7.687679 7.687500 8.487547 8.500000 0.800000 8.192000 8.192000 8.119019 8.120000 8.766038 8.800000 0.850000 8.609067 8.609125 8.566830 8.567500 9.146415 9.100000 0.900000 9.049000 9.049000 9.033660 9.030000 9.526792 9.400000 0.950000 9.512592 9.512375 9.510000 9.507500 9.526792 9.700000 1.000000 10.000000 10.000000 9.986340 10.000000 9.526792 10.000000 2.000000 24.749736 26.000000 19.513132 23.000000 9.526792 16.000000 Boundary condition 1 at both ends: Y'(left) = 3.000000 Y'(right) = 10.000000 SPLINE"(T), F"(T): 4.000000 4.000000 4.600000 4.600000 5.200000 5.200000 5.800000 5.800000 6.400000 6.400000 7.000000 7.000000 7.600000 7.600000 8.200000 8.200000 8.800000 8.800000 9.400000 9.400000 10.000000 10.000000 T, SPLINE(T), F(T) -1.000000 2.000000 2.000000 2.000000 2.000000 -2.000000 -2.000000 0.000000 4.000000 4.000000 3.000000 3.000000 4.000000 4.000000 0.050000 4.155125 4.155125 3.207500 3.207500 4.300000 4.300000 0.100000 4.321000 4.321000 3.430000 3.430000 4.600000 4.600000 0.150000 4.498375 4.498375 3.667500 3.667500 4.900000 4.900000 0.200000 4.688000 4.688000 3.920000 3.920000 5.200000 5.200000 0.250000 4.890625 4.890625 4.187500 4.187500 5.500000 5.500000 0.300000 5.107000 5.107000 4.470000 4.470000 5.800000 5.800000 0.350000 5.337875 5.337875 4.767500 4.767500 6.100000 6.100000 0.400000 5.584000 5.584000 5.080000 5.080000 6.400000 6.400000 0.450000 5.846125 5.846125 5.407500 5.407500 6.700000 6.700000 0.500000 6.125000 6.125000 5.750000 5.750000 7.000000 7.000000 0.550000 6.421375 6.421375 6.107500 6.107500 7.300000 7.300000 0.600000 6.736000 6.736000 6.480000 6.480000 7.600000 7.600000 0.650000 7.069625 7.069625 6.867500 6.867500 7.900000 7.900000 0.700000 7.423000 7.423000 7.270000 7.270000 8.200000 8.200000 0.750000 7.796875 7.796875 7.687500 7.687500 8.500000 8.500000 0.800000 8.192000 8.192000 8.120000 8.120000 8.800000 8.800000 0.850000 8.609125 8.609125 8.567500 8.567500 9.100000 9.100000 0.900000 9.049000 9.049000 9.030000 9.030000 9.400000 9.400000 0.950000 9.512375 9.512375 9.507500 9.507500 9.700000 9.700000 1.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 2.000000 26.000000 26.000000 23.000000 23.000000 16.000000 16.000000 Boundary condition 2 at both ends: YP"(left) = 4.000000 YP"(right) = 10.000000 SPLINE"(T), F"(T): 4.000000 4.000000 4.600000 4.600000 5.200000 5.200000 5.800000 5.800000 6.400000 6.400000 7.000000 7.000000 7.600000 7.600000 8.200000 8.200000 8.800000 8.800000 9.400000 9.400000 10.000000 10.000000 T, SPLINE(T), F(T) -1.000000 2.000000 2.000000 2.000000 2.000000 -2.000000 -2.000000 0.000000 4.000000 4.000000 3.000000 3.000000 4.000000 4.000000 0.050000 4.155125 4.155125 3.207500 3.207500 4.300000 4.300000 0.100000 4.321000 4.321000 3.430000 3.430000 4.600000 4.600000 0.150000 4.498375 4.498375 3.667500 3.667500 4.900000 4.900000 0.200000 4.688000 4.688000 3.920000 3.920000 5.200000 5.200000 0.250000 4.890625 4.890625 4.187500 4.187500 5.500000 5.500000 0.300000 5.107000 5.107000 4.470000 4.470000 5.800000 5.800000 0.350000 5.337875 5.337875 4.767500 4.767500 6.100000 6.100000 0.400000 5.584000 5.584000 5.080000 5.080000 6.400000 6.400000 0.450000 5.846125 5.846125 5.407500 5.407500 6.700000 6.700000 0.500000 6.125000 6.125000 5.750000 5.750000 7.000000 7.000000 0.550000 6.421375 6.421375 6.107500 6.107500 7.300000 7.300000 0.600000 6.736000 6.736000 6.480000 6.480000 7.600000 7.600000 0.650000 7.069625 7.069625 6.867500 6.867500 7.900000 7.900000 0.700000 7.423000 7.423000 7.270000 7.270000 8.200000 8.200000 0.750000 7.796875 7.796875 7.687500 7.687500 8.500000 8.500000 0.800000 8.192000 8.192000 8.120000 8.120000 8.800000 8.800000 0.850000 8.609125 8.609125 8.567500 8.567500 9.100000 9.100000 0.900000 9.049000 9.049000 9.030000 9.030000 9.400000 9.400000 0.950000 9.512375 9.512375 9.507500 9.507500 9.700000 9.700000 1.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 2.000000 26.000000 26.000000 23.000000 23.000000 16.000000 16.000000 TEST19 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL evaluates it. Cubic data, evenly spaced knots. ONLY TWO KNOTS! The data to be interpolated: Number of data values = 2 T Y 0.000000 4.000000 1.000000 10.000000 Boundary condition 0 at left end. Boundary condition 0 at right end. SPLINE"(T), F"(T): 0.000000 4.000000 0.000000 10.000000 T, SPLINE(T), F(T) -1.000000 -2.000000 2.000000 6.000000 2.000000 0.000000 -2.000000 0.000000 4.000000 4.000000 6.000000 3.000000 0.000000 4.000000 0.500000 7.000000 6.125000 6.000000 5.750000 0.000000 7.000000 1.000000 10.000000 10.000000 6.000000 10.000000 0.000000 10.000000 2.000000 16.000000 26.000000 6.000000 23.000000 0.000000 16.000000 Boundary condition 1 at right end. Y'(right) = 10.000000 SPLINE"(T), F"(T): 8.000000 4.000000 8.000000 10.000000 T, SPLINE(T), F(T) -1.000000 6.000000 2.000000 -6.000000 2.000000 8.000000 -2.000000 0.000000 4.000000 4.000000 2.000000 3.000000 8.000000 4.000000 0.500000 6.000000 6.125000 6.000000 5.750000 8.000000 7.000000 1.000000 10.000000 10.000000 10.000000 10.000000 8.000000 10.000000 2.000000 24.000000 26.000000 18.000000 23.000000 8.000000 16.000000 Boundary condition 2 at right end. YP"(right) = 10.000000 SPLINE"(T), F"(T): 10.000000 4.000000 10.000000 10.000000 T, SPLINE(T), F(T) -1.000000 8.000000 2.000000 -9.000000 2.000000 10.000000 -2.000000 0.000000 4.000000 4.000000 1.000000 3.000000 10.000000 4.000000 0.500000 5.750000 6.125000 6.000000 5.750000 10.000000 7.000000 1.000000 10.000000 10.000000 11.000000 10.000000 10.000000 10.000000 2.000000 26.000000 26.000000 21.000000 23.000000 10.000000 16.000000 Boundary condition 1 at left end. Y'(left) = 3.000000 Boundary condition 0 at right end. SPLINE"(T), F"(T): 6.000000 4.000000 6.000000 10.000000 T, SPLINE(T), F(T) -1.000000 4.000000 2.000000 -3.000000 2.000000 6.000000 -2.000000 0.000000 4.000000 4.000000 3.000000 3.000000 6.000000 4.000000 0.500000 6.250000 6.125000 6.000000 5.750000 6.000000 7.000000 1.000000 10.000000 10.000000 9.000000 10.000000 6.000000 10.000000 2.000000 22.000000 26.000000 15.000000 23.000000 6.000000 16.000000 Boundary condition 1 at right end. Y'(right) = 10.000000 SPLINE"(T), F"(T): 4.000000 4.000000 10.000000 10.000000 T, SPLINE(T), F(T) -1.000000 2.000000 2.000000 2.000000 2.000000 -2.000000 -2.000000 0.000000 4.000000 4.000000 3.000000 3.000000 4.000000 4.000000 0.500000 6.125000 6.125000 5.750000 5.750000 7.000000 7.000000 1.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 2.000000 26.000000 26.000000 23.000000 23.000000 16.000000 16.000000 Boundary condition 2 at right end. YP"(right) = 10.000000 SPLINE"(T), F"(T): 4.000000 4.000000 10.000000 10.000000 T, SPLINE(T), F(T) -1.000000 2.000000 2.000000 2.000000 2.000000 -2.000000 -2.000000 0.000000 4.000000 4.000000 3.000000 3.000000 4.000000 4.000000 0.500000 6.125000 6.125000 5.750000 5.750000 7.000000 7.000000 1.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 2.000000 26.000000 26.000000 23.000000 23.000000 16.000000 16.000000 Boundary condition 2 at left ends: YP"(left) = 4.000000 Boundary condition 0 at right end. SPLINE"(T), F"(T): 4.000000 4.000000 4.000000 10.000000 T, SPLINE(T), F(T) -1.000000 2.000000 2.000000 0.000000 2.000000 4.000000 -2.000000 0.000000 4.000000 4.000000 4.000000 3.000000 4.000000 4.000000 0.500000 6.500000 6.125000 6.000000 5.750000 4.000000 7.000000 1.000000 10.000000 10.000000 8.000000 10.000000 4.000000 10.000000 2.000000 20.000000 26.000000 12.000000 23.000000 4.000000 16.000000 Boundary condition 1 at right end. Y'(right) = 10.000000 SPLINE"(T), F"(T): 4.000000 4.000000 10.000000 10.000000 T, SPLINE(T), F(T) -1.000000 2.000000 2.000000 2.000000 2.000000 -2.000000 -2.000000 0.000000 4.000000 4.000000 3.000000 3.000000 4.000000 4.000000 0.500000 6.125000 6.125000 5.750000 5.750000 7.000000 7.000000 1.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 2.000000 26.000000 26.000000 23.000000 23.000000 16.000000 16.000000 Boundary condition 2 at right end. YP"(right) = 10.000000 SPLINE"(T), F"(T): 4.000000 4.000000 10.000000 10.000000 T, SPLINE(T), F(T) -1.000000 2.000000 2.000000 2.000000 2.000000 -2.000000 -2.000000 0.000000 4.000000 4.000000 3.000000 3.000000 4.000000 4.000000 0.500000 6.125000 6.125000 5.750000 5.750000 7.000000 7.000000 1.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 2.000000 26.000000 26.000000 23.000000 23.000000 16.000000 16.000000 TEST195 SPLINE_CUBIC_SET sets up a cubic spline; SPLINE_CUBIC_VAL evaluates it. Matlab's build in spline() function uses the "not-a-knot" boundary condition, which we can match. Runge's function, evenly spaced knots. The data to be interpolated: Number of data values = 11 T Y -1.000000 0.038462 -0.800000 0.058824 -0.600000 0.100000 -0.400000 0.200000 -0.200000 0.500000 0.000000 1.000000 0.200000 0.500000 0.400000 0.200000 0.600000 0.100000 0.800000 0.058824 1.000000 0.038462 Boundary condition 3 ("not a knot") at both ends: SPLINE"(T), F"(T): -0.411671 0.210514 0.520362 0.478323 1.452395 1.300000 2.493586 4.400000 18.573261 12.500000 -46.786631 -50.000000 18.573261 12.500000 2.493586 4.400000 1.452395 1.300000 0.520362 0.478323 -0.411671 0.210514 (Mathworks) T SPLINE(T) SPLINE(T) F(T) 0.414504 0.189894 0.189894 0.188845 -0.689089 0.076701 0.076701 0.077694 -0.152410 0.649431 0.649431 0.632624 0.756948 0.064654 0.064654 0.065256 0.856068 0.052621 0.052621 0.051756 -0.730939 0.068800 0.068800 0.069653 -0.695078 0.075467 0.075467 0.076462 0.620786 0.093654 0.093654 0.094035 0.769183 0.062877 0.062877 0.063327 0.228516 0.426788 0.426788 0.433748 0.095836 0.833084 0.833084 0.813262 -0.487064 0.146658 0.146658 0.144284 0.892868 0.049043 0.049043 0.047778 -0.132548 0.715842 0.715842 0.694819 0.915335 0.046932 0.046932 0.045567 -0.167045 0.601113 0.601113 0.589066 -0.293940 0.305807 0.305807 0.316454 0.778020 0.061656 0.061656 0.061985 -0.782370 0.061073 0.061073 0.061340 0.128722 0.728558 0.728558 0.707098 -0.831768 0.055161 0.055161 0.054657 0.151814 0.651419 0.651419 0.634444 -0.461573 0.160521 0.160521 0.158072 -0.887001 0.049600 0.049600 0.048381 0.774169 0.062182 0.062182 0.062565 TEST20 SPLINE_HERMITE_SET sets up a Hermite spline; SPLINE_HERMITE_VAL evaluates it. The data to be interpolated: Number of data values = 4 T Y Y" 0.000000 0.000000 1.000000 0.523599 0.500000 0.866025 1.047198 0.866025 0.500000 1.570796 1.000000 0.000000 T Y(hermite) Y(exact) Y'(hermite) Y'(exact) * 0.000000 0.000000 0.000000 1.000000 1.000000 0.174533 0.173611 0.173648 0.984564 0.984808 0.349066 0.341978 0.342020 0.939906 0.939693 * 0.523599 0.500000 0.500000 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.047198 0.866025 0.866025 0.500000 0.500000 1.221730 0.939545 0.939693 0.341164 0.342020 1.396263 0.984658 0.984808 0.174497 0.173648 * 1.570796 1.000000 1.000000 0.000000 0.000000 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: 1 0.000000 2 1.000000 3 4.000000 4 5.000000 5 10.000000 The desired interval integral values: 1 10.000000 2 2.000000 3 8.000000 4 27.500000 The spline break points: 1 0.500000 2 2.500000 3 4.500000 4 7.500000 The spline data values: 1 10.000000 2 -4.632621 3 8.997625 4 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.000000 1.000000 10.000000 10.000000 1.000000 4.000000 2.000000 2.000000 4.000000 5.000000 8.000000 8.000000 5.000000 10.000000 27.500000 27.500000 TEST21 SPLINE_LINEAR_VAL evaluates a linear spline. Runge's function, evenly spaced knots. T, Y -1.000000 0.038462 -0.800000 0.058824 -0.600000 0.100000 -0.400000 0.200000 -0.200000 0.500000 0.000000 1.000000 0.200000 0.500000 0.400000 0.200000 0.600000 0.100000 0.800000 0.058824 1.000000 0.038462 -2.000000 -0.063348 0.009901 -1.000000 0.038462 0.038462 -0.900000 0.048643 0.047059 -0.800000 0.058824 0.058824 -0.700000 0.079412 0.075472 -0.600000 0.100000 0.100000 -0.500000 0.150000 0.137931 -0.400000 0.200000 0.200000 -0.300000 0.350000 0.307692 -0.200000 0.500000 0.500000 -0.100000 0.750000 0.800000 0.000000 1.000000 1.000000 0.100000 0.750000 0.800000 0.200000 0.500000 0.500000 0.300000 0.350000 0.307692 0.400000 0.200000 0.200000 0.500000 0.150000 0.137931 0.600000 0.100000 0.100000 0.700000 0.079412 0.075472 0.800000 0.058824 0.058824 0.900000 0.048643 0.047059 1.000000 0.038462 0.038462 2.000000 -0.063348 0.009901 TEST215 SPLINE_LINEAR_INT computes the integral of a linear spline. The data to be interpolated: Number of data values = 3 T Y 2.000000 3.000000 4.500000 3.750000 7.500000 5.500000 A B Integral 0.000000 4.000000 12.000000 4.000000 5.000000 3.785417 5.000000 10.000000 27.500000 0.000000 10.000000 43.285417 10.000000 0.000000 -43.285417 TEST22 SPLINE_OVERHAUSER_UNI_VAL evaluates the uniform Overhauser spline. The data to be interpolated: Number of data values = 11 T Y 0.000000 0.000000 1.000000 0.587785 2.000000 0.951057 3.000000 0.951057 4.000000 0.587785 5.000000 0.000000 6.000000 -0.587785 7.000000 -0.951057 8.000000 -0.951057 9.000000 -0.587785 10.000000 -0.000000 T, Spline(T) -0.500000 -0.378085 -0.375000 -0.278302 -0.250000 -0.182027 -0.125000 -0.089259 * 0.000000 0.000000 0.250000 0.167994 0.500000 0.321957 0.750000 0.461887 * 1.000000 0.587785 1.250000 0.702903 1.500000 0.806157 1.750000 0.891043 * 2.000000 0.951057 2.250000 0.985113 2.500000 0.996465 2.750000 0.985113 * 3.000000 0.951057 3.250000 0.891043 3.500000 0.806157 3.750000 0.702903 * 4.000000 0.587785 4.250000 0.456625 4.500000 0.307925 4.750000 0.152208 * 5.000000 0.000000 5.250000 -0.152208 5.500000 -0.307925 5.750000 -0.456625 * 6.000000 -0.587785 6.250000 -0.702903 6.500000 -0.806157 6.750000 -0.891043 * 7.000000 -0.951057 7.250000 -0.985113 7.500000 -0.996465 7.750000 -0.985113 * 8.000000 -0.951057 8.250000 -0.891043 8.500000 -0.806157 8.750000 -0.702903 * 9.000000 -0.587785 9.250000 -0.461887 9.500000 -0.321957 9.750000 -0.167994 * 10.000000 -0.000000 10.125000 0.089259 10.250000 0.182027 10.375000 0.278302 10.500000 0.378085 TEST225 SPLINE_OVERHAUSER_NONUNI_VAL evaluates the nonuniform Overhauser spline. In this draft of a test, we simply repeat the test for the uniform data case. The data to be interpolated: Number of data values = 11 T Y 0.000000 0.000000 1.000000 0.587785 2.000000 0.951057 3.000000 0.951057 4.000000 0.587785 5.000000 0.000000 6.000000 -0.587785 7.000000 -0.951057 8.000000 -0.951057 9.000000 -0.587785 10.000000 -0.000000 T, Spline(T) -0.500000 -0.352636 -0.375000 -0.260170 -0.250000 -0.170575 -0.125000 -0.083851 * 0.000000 0.000000 0.250000 0.159087 0.500000 0.306688 0.750000 0.442800 * 1.000000 0.587785 1.250000 0.699212 1.500000 0.803345 1.750000 0.890516 * 2.000000 0.951057 2.250000 0.982075 2.500000 0.992414 2.750000 0.982075 * 3.000000 0.951057 3.250000 0.890516 3.500000 0.803345 3.750000 0.699212 * 4.000000 0.587785 4.250000 0.454902 4.500000 0.306393 4.750000 0.151634 * 5.000000 0.000000 5.250000 -0.151634 5.500000 -0.306393 5.750000 -0.454902 * 6.000000 -0.587785 6.250000 -0.699212 6.500000 -0.803345 6.750000 -0.890516 * 7.000000 -0.951057 7.250000 -0.982075 7.500000 -0.992414 7.750000 -0.982075 * 8.000000 -0.951057 8.250000 -0.890516 8.500000 -0.803345 8.750000 -0.699212 * 9.000000 -0.567426 9.250000 -0.442800 9.500000 -0.306688 9.750000 -0.159087 * 10.000000 -0.000000 10.125000 0.083851 10.250000 0.170575 10.375000 0.260170 10.500000 0.352636 TEST23 SPLINE_OVERHAUSER_VAL evaluates the Overhauser spline. The data to be interpolated: Number of data values = 4 T Y 1.000000 0.000000 0.000000 2.000000 1.000000 1.000000 3.000000 2.000000 -1.000000 4.000000 3.000000 0.000000 T, Spline value 0.000000 -1.000000 -4.000000 0.166667 -0.833333 -3.125000 0.333333 -0.666667 -2.333333 0.500000 -0.500000 -1.625000 0.666667 -0.333333 -1.000000 0.833333 -0.166667 -0.458333 1.000000 0.000000 0.000000 1.166667 0.166667 0.375000 1.333333 0.333333 0.666667 1.500000 0.500000 0.875000 1.666667 0.666667 1.000000 1.833333 0.833333 1.041667 2.000000 1.000000 1.000000 2.166667 1.166667 0.805556 2.333333 1.333333 0.444444 2.500000 1.500000 0.000000 2.666667 1.666667 -0.444444 2.833333 1.833333 -0.805556 3.000000 2.000000 -1.000000 3.166667 2.166667 -1.041667 3.333333 2.333333 -1.000000 3.500000 2.500000 -0.875000 3.666667 2.666667 -0.666667 3.833333 2.833333 -0.375000 4.000000 3.000000 0.000000 4.166667 3.166667 0.458333 4.333333 3.333333 1.000000 4.500000 3.500000 1.625000 TEST235 SPLINE_PCHIP_SET sets up a piecewise cubic Hermite interpolant. SPLINE_PCHIP_VAL evaluates the interpolant. -1.000000 0.038462 0.038462 0.000000e+00 -0.990000 0.039212 0.039181 -3.089175e-05 -0.980000 0.039984 0.039935 -4.852123e-05 -0.970000 0.040779 0.040724 -5.521138e-05 -0.960000 0.041597 0.041544 -5.332570e-05 -0.950000 0.042440 0.042395 -4.527054e-05 -0.940000 0.043309 0.043275 -3.349757e-05 -0.930000 0.044204 0.044183 -2.050642e-05 -0.920000 0.045126 0.045118 -8.847506e-06 -0.910000 0.046078 0.046077 -1.124988e-06 -0.900000 0.047059 0.047059 0.000000e+00 -0.890000 0.048071 0.048069 -2.285001e-06 -0.880000 0.049116 0.049113 -3.103098e-06 -0.870000 0.050195 0.050192 -2.677721e-06 -0.860000 0.051308 0.051307 -1.304440e-06 -0.850000 0.052459 0.052460 6.445543e-07 -0.840000 0.053648 0.053651 2.715644e-06 -0.830000 0.054877 0.054882 4.368645e-06 -0.820000 0.056148 0.056153 4.971284e-06 -0.810000 0.057463 0.057467 3.793282e-06 -0.800000 0.058824 0.058824 0.000000e+00 -0.790000 0.060232 0.060228 -3.994568e-06 -0.780000 0.061690 0.061685 -5.364386e-06 -0.770000 0.063201 0.063197 -4.504359e-06 -0.760000 0.064767 0.064765 -1.944278e-06 -0.750000 0.066390 0.066392 1.642060e-06 -0.740000 0.068074 0.068079 5.427023e-06 -0.730000 0.069820 0.069829 8.418561e-06 -0.720000 0.071633 0.071643 9.448800e-06 -0.710000 0.073516 0.073523 7.161742e-06 -0.700000 0.075472 0.075472 0.000000e+00 -0.690000 0.077504 0.077497 -7.423338e-06 -0.680000 0.079618 0.079608 -9.747802e-06 -0.670000 0.081816 0.081809 -7.757698e-06 -0.660000 0.084104 0.084102 -2.503223e-06 -0.650000 0.086486 0.086491 4.680034e-06 -0.640000 0.088968 0.088980 1.215002e-05 -0.630000 0.091554 0.091572 1.793541e-05 -0.620000 0.094251 0.094270 1.971099e-05 -0.610000 0.097064 0.097079 1.477094e-05 -0.600000 0.100000 0.100000 0.000000e+00 -0.590000 0.103066 0.103051 -1.480729e-05 -0.580000 0.106270 0.106251 -1.854234e-05 -0.570000 0.109619 0.109606 -1.306376e-05 -0.560000 0.113122 0.113121 -7.807448e-07 -0.550000 0.116788 0.116804 1.530423e-05 -0.540000 0.120627 0.120659 3.154918e-05 -0.530000 0.124649 0.124693 4.362273e-05 -0.520000 0.128866 0.128912 4.645027e-05 -0.510000 0.133289 0.133323 3.415590e-05 -0.500000 0.137931 0.137931 0.000000e+00 -0.490000 0.142806 0.142774 -3.189423e-05 -0.480000 0.147929 0.147893 -3.567660e-05 -0.470000 0.153315 0.153298 -1.700569e-05 -0.460000 0.158983 0.159000 1.729783e-05 -0.450000 0.164948 0.165008 5.916381e-05 -0.440000 0.171233 0.171332 9.918036e-05 -0.430000 0.177857 0.177983 1.264967e-04 -0.420000 0.184843 0.184972 1.287217e-04 -0.410000 0.192215 0.192307 9.181906e-05 -0.400000 0.200000 0.200000 0.000000e+00 -0.390000 0.208225 0.208152 -7.335181e-05 -0.380000 0.216920 0.216862 -5.788565e-05 -0.370000 0.226116 0.226140 2.311364e-05 -0.360000 0.235849 0.235993 1.441978e-04 -0.350000 0.246154 0.246432 2.776750e-04 -0.340000 0.257069 0.257463 3.935498e-04 -0.330000 0.268637 0.269096 4.594923e-04 -0.320000 0.280899 0.281340 4.408475e-04 -0.310000 0.293902 0.294202 3.006981e-04 -0.300000 0.307692 0.307692 0.000000e+00 -0.290000 0.322321 0.322151 -1.697291e-04 -0.280000 0.337838 0.337865 2.705368e-05 -0.270000 0.354296 0.354761 4.651652e-04 -0.260000 0.371747 0.372766 1.019060e-03 -0.250000 0.390244 0.391808 1.563759e-03 -0.240000 0.409836 0.411812 1.976065e-03 -0.230000 0.430571 0.432707 2.136132e-03 -0.220000 0.452489 0.454418 1.929458e-03 -0.210000 0.475624 0.476874 1.249356e-03 -0.200000 0.500000 0.500000 0.000000e+00 -0.190000 0.525624 0.525224 -3.998037e-04 -0.180000 0.552486 0.553520 1.033812e-03 -0.170000 0.580552 0.584133 3.581601e-03 -0.160000 0.609756 0.616310 6.553902e-03 -0.150000 0.640000 0.649297 9.296875e-03 -0.140000 0.671141 0.682340 1.119906e-02 -0.130000 0.702988 0.714686 1.169793e-02 -0.120000 0.735294 0.745580 1.028588e-02 -0.110000 0.767754 0.774269 6.515056e-03 -0.100000 0.800000 0.800000 0.000000e+00 -0.090000 0.831601 0.825040 -6.560832e-03 -0.080000 0.862069 0.851520 -1.054897e-02 -0.070000 0.890869 0.878480 -1.238860e-02 -0.060000 0.917431 0.904960 -1.247119e-02 -0.050000 0.941176 0.930000 -1.117647e-02 -0.040000 0.961538 0.952640 -8.898462e-03 -0.030000 0.977995 0.971920 -6.075110e-03 -0.020000 0.990099 0.986880 -3.219010e-03 -0.010000 0.997506 0.996560 -9.462344e-04 0.000000 1.000000 1.000000 0.000000e+00 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.000000 0.038462 -0.800000 0.058824 -0.600000 0.100000 -0.400000 0.200000 -0.200000 0.500000 0.000000 1.000000 0.200000 0.500000 0.400000 0.200000 0.600000 0.100000 0.800000 0.058824 1.000000 0.038462 Interpolated values T Y Y(exact) -2.000000 0.248869 0.009901 -1.000000 0.038462 0.038462 -0.900000 0.046041 0.047059 -0.800000 0.058824 0.058824 -0.700000 0.076810 0.075472 -0.600000 0.100000 0.100000 -0.500000 0.125000 0.137931 -0.400000 0.200000 0.200000 -0.300000 0.325000 0.307692 -0.200000 0.500000 0.500000 -0.100000 0.875000 0.800000 0.000000 1.000000 1.000000 0.100000 0.875000 0.800000 0.200000 0.500000 0.500000 0.300000 0.325000 0.307692 0.400000 0.200000 0.200000 0.500000 0.125000 0.137931 0.600000 0.100000 0.100000 0.700000 0.076810 0.075472 0.800000 0.058824 0.058824 0.900000 0.046041 0.047059 1.000000 0.038462 0.038462 2.000000 0.248869 0.009901 spline_test Normal end of execution. 24-Mar-2019 16:52:28