11 November 2013 09:23:18 AM

DIFFER_PRB:
  C++ version
  Test the DIFFER library.

TEST01
  Demonstrate that the DIFFER matrix is 'really'
  a Vandermonde matrix.

  Stencil matrix:

  Col:          0             1             2             3       
  Row

    0:          2.5           3.3          -1.3           0.5  
    1:         6.25         10.89          1.69          0.25  
    2:       15.625        35.937        -2.197         0.125  
    3:      39.0625       118.592        2.8561        0.0625  

  Solution of DIFFER system:

         0:              1
         1:              2
         2:              3
         3:              4

  Solution of VANDERMONDE system:

         0:            2.5
         1:            6.6
         2:           -3.9
         3:              2

  Transformed solution of VANDERMONDE system:

         0:              1
         1:              2
         2:              3
         3:              4

TEST02
  DIFFER_INVERSE returns the inverse of a DIFFER matrix;

   N    Inverse error

   2               0
   2     4.44089e-16
   2     8.88185e-16
   2     4.44089e-16
   2               0

   3     1.17776e-14
   3     1.65635e-13
   3     2.87917e-15
   3     5.12266e-14
   3      1.8897e-14

   4     3.14213e-14
   4      8.5015e-14
   4     5.71398e-14
   4     4.28707e-14
   4     2.80585e-12

   5     1.43579e-10
   5     1.45624e-12
   5     1.81003e-11
   5     2.30649e-12
   5     1.19425e-11

   6     8.31044e-10
   6     8.46168e-11
   6     7.55719e-12
   6     7.24273e-12
   6     1.81026e-11

   7     4.73678e-10
   7     5.59992e-11
   7     5.32315e-10
   7     2.01382e-11
   7     3.07994e-11

   8     5.89396e-10
   8      5.9282e-10
   8      9.3962e-09
   8     1.04455e-09
   8      1.7787e-09

TEST03
  Reproduce a specific example.

  Solution of DIFFER system:

         0:     -0.0833333
         1:            0.5
         2:           -1.5
         3:           0.25

  DFDX =         3.66931
  d exp(x) /dx = 3.6693

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

     0:              0              -1
     1:              1               3
     2:              2              -3
     3:              3               1

  Backward difference coefficients, O = 3, P = 1

     0:             -3              -1
     1:             -2               3
     2:             -1              -3
     3:              0               1

  Central difference coefficients, O = 3, P = 2

     0:             -2            -0.5
     1:             -1               1
     2:              0               0
     3:              1              -1
     4:              2             0.5

  Central difference coefficients, O = 3, P = 4

     0:             -3           0.125
     1:             -2              -1
     2:             -1           1.625
     3:              0               0
     4:              1          -1.625
     5:              2               1
     6:              3          -0.125

  Forward difference coefficients, O = 4, P = 1

     0:              0               1
     1:              1              -4
     2:              2               6
     3:              3              -4
     4:              4               1

  Backward difference coefficients, O = 4, P = 1

     0:             -4               1
     1:             -3              -4
     2:             -2               6
     3:             -1              -4
     4:              0               1

  Central difference coefficients, O = 4, P = 3

     0:             -3       -0.166667
     1:             -2               2
     2:             -1            -6.5
     3:              0         9.33333
     4:              1            -6.5
     5:              2               2
     6:              3       -0.166667

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.

  Use a spacing of H = 1 for all examples.

  Forward difference coefficients, O = 3, P = 1

     0:              0              -1
     1:              1               3
     2:              2              -3
     3:              3               1

  Backward difference coefficients, O = 3, P = 1

     0:             -3              -1
     1:             -2               3
     2:             -1              -3
     3:              0               1

  Central difference coefficients, O = 3, P = 2

     0:             -2            -0.5
     1:             -1               1
     2:              0               0
     3:              1              -1
     4:              2             0.5

  Central difference coefficients, O = 3, P = 4

     0:             -3           0.125
     1:             -2              -1
     2:             -1           1.625
     3:              0               0
     4:              1          -1.625
     5:              2               1
     6:              3          -0.125

  Forward difference coefficients, O = 4, P = 1

     0:              0               1
     1:              1              -4
     2:              2               6
     3:              3              -4
     4:              4               1

  Backward difference coefficients, O = 4, P = 1

     0:             -4               1
     1:             -3              -4
     2:             -2               6
     3:             -1              -4
     4:              0               1

  Central difference coefficients, O = 4, P = 3

     0:             -3       -0.166667
     1:             -2               2
     2:             -1            -6.5
     3:              0         9.33333
     4:              1            -6.5
     5:              2               2
     6:              3       -0.166667

DIFFER_PRB:
  Normal end of execution.

11 November 2013 09:23:18 AM