07-Jan-2022 19:00:03 differ_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test differ(). 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 0 2 4.44116e-16 2 3.14669e-16 2 4.70298e-16 2 6.86161e-14 3 6.73895e-14 3 5.42148e-15 3 2.26566e-14 3 1.63045e-14 3 4.41273e-14 4 1.06587e-12 4 1.12574e-13 4 1.20959e-13 4 7.07151e-14 4 1.03752e-13 5 8.77868e-12 5 1.35701e-12 5 9.10505e-13 5 1.2857e-12 5 9.16135e-12 6 2.73769e-11 6 4.30171e-12 6 1.17441e-10 6 5.26388e-12 6 4.95188e-12 7 2.91116e-10 7 5.85898e-11 7 7.56816e-11 7 3.46585e-11 7 1.90238e-09 8 5.36791e-10 8 1.20261e-06 8 4.90211e-09 8 2.47475e-09 8 8.32445e-10 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 6.99159e-16 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 6.99159e-16 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. 07-Jan-2022 19:00:03