05-Jan-2019 19:28:05 DIFFER_TEST MATLAB version. Test DIFFERy. DIFFER_MATRIX_TEST Demonstrate that the DIFFER matrix is "really" a Vandermonde matrix. Stencil matrix: Col: 1 2 3 4 Row 1 : 2.5 3.3 -1.3 0.5 2 : 6.25 10.89 1.69 0.25 3 : 15.625 35.937 -2.197 0.125 4 : 39.0625 118.592 2.8561 0.0625 Solution of DIFFER system: 1: 1 2: 2 3: 3 4: 4 Solution of VANDERMONDE system: 1: 2.5 2: 6.6 3: -3.9 4: 2 Transformed solution of VANDERMONDE system: 1: 1 2: 2 3: 3 4: 4 DIFFER_TEST02 DIFFER_INVERSE returns the inverse of a DIFFER matrix; N Inverse error 2 2.82259e-16 2 6.8125e-16 2 5.42023e-16 2 7.83052e-16 2 9.87149e-16 3 7.65747e-15 3 1.37097e-13 3 1.48206e-15 3 4.49791e-14 3 2.17359e-14 4 2.24135e-14 4 8.0388e-14 4 4.50622e-14 4 4.2476e-14 4 2.8682e-12 5 1.42913e-10 5 1.17158e-12 5 1.80607e-11 5 6.84053e-13 5 1.23284e-11 6 6.21417e-10 6 8.19882e-11 6 6.95521e-12 6 4.11982e-12 6 1.62727e-11 7 4.69827e-10 7 7.93792e-11 7 5.45725e-10 7 1.9652e-11 7 4.37147e-11 8 7.14295e-10 8 6.32603e-10 8 7.14222e-09 8 1.18461e-09 8 1.34729e-09 DIFFER_TEST03 Reproduce a specific example. Solution of DIFFER system: 1: -0.0833333 2: 0.5 3: -1.5 4: 0.25 DFDX = 3.66931 d exp(x) /dx = 3.6693 DIFFER_TEST04 DIFFER_FORWARD, DIFFER_BACKWARD, and DIFFER_CENTRAL produce coefficients for difference approximations of the O-th derivative, with error of order H^P, for a uniform spacing of H. Use a spacing of H = 1 for all examples. Forward difference coefficients, O = 3, P = 1 1: 0 -1 2: 1 3 3: 2 -3 4: 3 1 Backward difference coefficients, O = 3, P = 1 1: -3 -1 2: -2 3 3: -1 -3 4: 0 1 Central difference coefficients, O = 3, P = 2 1: -2 -0.5 2: -1 1 3: 0 0 4: 1 -1 5: 2 0.5 Central difference coefficients, O = 3, P = 4 1: -3 0.125 2: -2 -1 3: -1 1.625 4: 0 2.12062e-14 5: 1 -1.625 6: 2 1 7: 3 -0.125 Forward difference coefficients, O = 4, P = 1 1: 0 1 2: 1 -4 3: 2 6 4: 3 -4 5: 4 1 Backward difference coefficients, O = 4, P = 1 1: -4 1 2: -3 -4 3: -2 6 4: -1 -4 5: 0 1 Central difference coefficients, O = 4, P = 3 1: -3 -0.166667 2: -2 2 3: -1 -6.5 4: 0 9.33333 5: 1 -6.5 6: 2 2 7: 3 -0.166667 DIFFER_TEST05 DIFFER_STENCIL produces coefficients for difference approximations of the O-th derivative, using arbitrarily spaced data, with maximum spacing H with error of order H^P. For all tests, let X0 = 0 and use a uniformly spacing of 1, so we can compare with previous forward, backward and central differences. Finite difference coefficients, O = 3, P = 1 1: 0 -1 2: 1 3 3: 2 -3 4: 3 1 Backward difference coefficients, O = 3, P = 1 1: -3 -1 2: -2 3 3: -1 -3 4: 0 1 Central difference coefficients, O = 3, P = 2 1: -2 -0.5 2: -1 1 3: 0 0 4: 1 -1 5: 2 0.5 Central difference coefficients, O = 3, P = 4 1: -3 0.125 2: -2 -1 3: -1 1.625 4: 0 2.12062e-14 5: 1 -1.625 6: 2 1 7: 3 -0.125 Finite difference coefficients, O = 4, P = 1 1: 0 1 2: 1 -4 3: 2 6 4: 3 -4 5: 4 1 Backward difference coefficients, O = 4, P = 1 1: -4 1 2: -3 -4 3: -2 6 4: -1 -4 5: 0 1 Central difference coefficients, O = 4, P = 3 1: -3 -0.166667 2: -2 2 3: -1 -6.5 4: 0 9.33333 5: 1 -6.5 6: 2 2 7: 3 -0.166667 DIFFER_TEST Normal end of execution. 05-Jan-2019 19:28:05