Wed Oct 5 20:59:52 2022 differ_test(): Python version: 3.6.9 Test differ(). differ_matrix_test(): Demonstrate that the DIFFER matrix is "really" a Vandermonde matrix. Stencil matrix: [[ 2.500000e+00 3.300000e+00 -1.300000e+00 5.000000e-01] [ 6.250000e+00 1.089000e+01 1.690000e+00 2.500000e-01] [ 1.562500e+01 3.593700e+01 -2.197000e+00 1.250000e-01] [ 3.906250e+01 1.185921e+02 2.856100e+00 6.250000e-02]] Solution of DIFFER system: [1. 2. 3. 4.] Solution of VANDERMONDE system: [ 2.5 6.6 -3.9 2. ] Transformed solution of VANDERMONDE system: [1. 2. 3. 4.] differ_test02(): differ_inverse() returns the inverse of a DIFFER matrix N Inverse error 2 5.71219e-15 2 1.31575e-15 2 1.41799e-15 2 5.42359e-16 2 1.21904e-14 3 6.71369e-15 3 1.05448e-14 3 9.18134e-15 3 4.56659e-15 3 1.5285e-12 4 4.39716e-14 4 1.29445e-13 4 1.91224e-13 4 4.61235e-14 4 2.41589e-13 5 7.91301e-13 5 1.03321e-12 5 3.7174e-13 5 8.97897e-12 5 2.91276e-13 6 7.26911e-10 6 4.7275e-12 6 1.20371e-10 6 1.08178e-10 6 8.94186e-12 7 5.67335e-10 7 6.1611e-11 7 2.45349e-10 7 4.67434e-10 7 1.063e-09 8 1.4603e-10 8 7.05095e-10 8 1.24804e-08 8 1.27583e-07 8 5.90913e-07 differ_test03(): Reproduce a specific example. Solution of DIFFER system: [-0.08333333 0.5 -1.5 0.25 ] DFDX = 3.669313568906812 d exp(x) /dx = 3.6692966676192444 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.0 for all examples. Forward difference coefficients, O = 3 , P = 1 [[ 0. -1.] [ 1. 3.] [ 2. -3.] [ 3. 1.]] Backward difference coefficients, O = 3 , P = 1 [[-3. -1.] [-2. 3.] [-1. -3.] [ 0. 1.]] Central difference coefficients, O = 3 , P = 2 [[-2. -0.5] [-1. 1. ] [ 0. 0. ] [ 1. -1. ] [ 2. 0.5]] Central difference coefficients, O = 3 , P = 4 [[-3.00000000e+00 1.25000000e-01] [-2.00000000e+00 -1.00000000e+00] [-1.00000000e+00 1.62500000e+00] [ 0.00000000e+00 3.38175542e-15] [ 1.00000000e+00 -1.62500000e+00] [ 2.00000000e+00 1.00000000e+00] [ 3.00000000e+00 -1.25000000e-01]] Forward difference coefficients, O = 4 , P = 1 [[ 0. 1.] [ 1. -4.] [ 2. 6.] [ 3. -4.] [ 4. 1.]] Backward difference coefficients, O = 4 , P = 1 [[-4. 1.] [-3. -4.] [-2. 6.] [-1. -4.] [ 0. 1.]] Central difference coefficients, O = 4 , P = 3 [[-3. -0.16666667] [-2. 2. ] [-1. -6.5 ] [ 0. 9.33333333] [ 1. -6.5 ] [ 2. 2. ] [ 3. -0.16666667]] 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.0 and use a uniformly spacing of 1.0 , so we can compare with previous forward, backward and central differences. Finite difference coefficients, O = 3 , P = 1 [[ 0. -1.] [ 1. 3.] [ 2. -3.] [ 3. 1.]] Backward difference coefficients, O = 3 , P = 1 [[-3. -1.] [-2. 3.] [-1. -3.] [ 0. 1.]] Central difference coefficients, O = 3 , P = 2 [[-2. -0.5] [-1. 1. ] [ 0. 0. ] [ 1. -1. ] [ 2. 0.5]] Central difference coefficients, O = 3 , P = 4 [[-3.00000000e+00 1.25000000e-01] [-2.00000000e+00 -1.00000000e+00] [-1.00000000e+00 1.62500000e+00] [ 0.00000000e+00 3.38175542e-15] [ 1.00000000e+00 -1.62500000e+00] [ 2.00000000e+00 1.00000000e+00] [ 3.00000000e+00 -1.25000000e-01]] Finite difference coefficients, O = 4 , P = 1 [[ 0. 1.] [ 1. -4.] [ 2. 6.] [ 3. -4.] [ 4. 1.]] Backward difference coefficients, O = 4 , P = 1 [[-4. 1.] [-3. -4.] [-2. 6.] [-1. -4.] [ 0. 1.]] Central difference coefficients, O = 4 , P = 3 [[-3. -0.16666667] [-2. 2. ] [-1. -6.5 ] [ 0. 9.33333333] [ 1. -6.5 ] [ 2. 2. ] [ 3. -0.16666667]] differ_test(): Normal end of execution. Wed Oct 5 20:59:52 2022