23 April 2020 02:23:52 PM TEST_MATRIX_EXPONENTIAL_TEST: C++ version Test the TEST_MATRIX_EXPONENTIAL library. The C8LIB and R8LIB libraries are needed. TEST_MATRIX_EXPONENTIAL_TEST01: Retrieve the data for each matrix exponential test. Test #1 This matrix is diagonal. The calculation of the matrix exponential is simple. Matrix order N = 2 Matrix A: Col: 0 1 Row 0: 1 0 1: 0 2 Exact Exponential exp(A): Col: 0 1 Row 0: 2.71828 0 1: 0 7.38906 Test #2 This matrix is symmetric. The calculation of the matrix exponential is straightforward. Matrix order N = 2 Matrix A: Col: 0 1 Row 0: 1 3 1: 3 2 Exact Exponential exp(A): Col: 0 1 Row 0: 39.3228 46.1663 1: 46.1663 54.7116 Test #3 This example is due to Laub. This matrix is ill-suited for the Taylor series approach. As powers of A are computed, the entries blow up too quickly. Matrix order N = 2 Matrix A: Col: 0 1 Row 0: 0 1 1: -39 -40 Exact Exponential exp(A): Col: 0 1 Row 0: 0.37756 -0.37756 1: 0.00968104 -0.00968104 Test #4 This example is due to Moler and Van Loan. The example will cause problems for the series summation approach, as well as for diagonal Pade approximations. Matrix order N = 2 Matrix A: Col: 0 1 Row 0: -49 24 1: -64 31 Exact Exponential exp(A): Col: 0 1 Row 0: -0.735759 0.551819 1: -1.47152 1.10364 Test #5 This example is due to Moler and Van Loan. This matrix is strictly upper triangular All powers of A are zero beyond some (low) limit. This example will cause problems for Pade approximations. Matrix order N = 4 Matrix A: Col: 0 1 2 3 Row 0: 0 6 0 0 1: 0 0 6 0 2: 0 0 0 6 3: 0 0 0 0 Exact Exponential exp(A): Col: 0 1 2 3 Row 0: 1 6 18 36 1: 0 1 6 18 2: 0 0 1 6 3: 0 0 0 1 Test #6 This example is due to Moler and Van Loan. This matrix does not have a complete set of eigenvectors. That means the eigenvector approach will fail. Matrix order N = 2 Matrix A: Col: 0 1 Row 0: 1 1 1: 0 1 Exact Exponential exp(A): Col: 0 1 Row 0: 2.71828 2.71828 1: 0 2.71828 Test #7 This example is due to Moler and Van Loan. This matrix is very close to example 5. Mathematically, it has a complete set of eigenvectors. Numerically, however, the calculation will be suspect. Matrix order N = 2 Matrix A: Col: 0 1 Row 0: 1 0 1: 0 1 Exact Exponential exp(A): Col: 0 1 Row 0: 2.71828 2.71828 1: 0 2.71828 Test #8 This matrix was an example in Wikipedia. Matrix order N = 3 Matrix A: Col: 0 1 2 Row 0: 21 17 6 1: -5 -1 -6 2: 4 4 16 Exact Exponential exp(A): Col: 0 1 2 Row 0: 2.88798e+07 2.88798e+07 4.44303e+06 1: -1.99937e+07 -1.99937e+07 -4.44303e+06 2: 3.55444e+07 3.55444e+07 8.88611e+06 Test #9 This matrix is due to the NAG Library. It is an example for function F01ECF. Matrix order N = 4 Matrix A: Col: 0 1 2 3 Row 0: 1 2 2 2 1: 3 1 1 2 2: 3 2 1 2 3: 3 3 3 1 Exact Exponential exp(A): Col: 0 1 2 3 Row 0: 740.704 610.85 542.274 549.175 1: 731.251 603.552 535.088 542.274 2: 823.763 679.426 603.552 610.85 3: 998.436 823.763 731.251 740.704 Test #10 This is Ward's example #1. It is defective and nonderogatory. The eigenvalues are 3, 3 and 6. Matrix order N = 3 Matrix A: Col: 0 1 2 Row 0: 4 2 0 1: 1 4 1 2: 1 1 4 Exact Exponential exp(A): Col: 0 1 2 Row 0: 147.867 183.765 71.797 1: 127.781 183.765 91.8826 2: 127.781 163.68 111.968 Test #11 This is Ward's example #2. It is a symmetric matrix. The eigenvalues are 20, 30, 40. Matrix order N = 3 Matrix A: Col: 0 1 2 Row 0: 29.8794 0.781575 -2.28952 1: 0.781575 25.7266 8.68074 2: -2.28952 8.68074 34.394 Exact Exponential exp(A): Col: 0 1 2 Row 0: 5.49631e+15 -1.82319e+16 -3.04758e+16 1: -1.82319e+16 6.06052e+16 1.01292e+17 2: -3.04758e+16 1.01292e+17 1.69294e+17 Test #12 This is Ward's example #3. Ward's algorithm has difficulty estimating the accuracy of its results. The eigenvalues are -1, -2, -20. Matrix order N = 3 Matrix A: Col: 0 1 2 Row 0: -131 19 18 1: -390 56 54 2: -387 57 52 Exact Exponential exp(A): Col: 0 1 2 Row 0: -1.50964 0.367879 0.135335 1: -5.63257 1.47152 0.406006 2: -4.93494 1.10364 0.541341 Test #13 This is Ward's example #4. This is a version of the Forsythe matrix. The eigenvector problem is badly conditioned. Ward's algorithm has difficulty estimating the accuracy of its results for this problem. Matrix order N = 10 Matrix A: Col: 0 1 2 3 4 Row 0: 0 1 0 0 0 1: 0 0 1 0 0 2: 0 0 0 1 0 3: 0 0 0 0 1 4: 0 0 0 0 0 5: 0 0 0 0 0 6: 0 0 0 0 0 7: 0 0 0 0 0 8: 0 0 0 0 0 9: 1e-10 0 0 0 0 Col: 5 6 7 8 9 Row 0: 0 0 0 0 0 1: 0 0 0 0 0 2: 0 0 0 0 0 3: 0 0 0 0 0 4: 1 0 0 0 0 5: 0 1 0 0 0 6: 0 0 1 0 0 7: 0 0 0 1 0 8: 0 0 0 0 1 9: 0 0 0 0 0 Exact Exponential exp(A): Col: 0 1 2 3 4 Row 0: 1 1 0.5 0.166667 0.0416667 1: 2.75573e-16 1 1 0.5 0.166667 2: 2.48016e-15 2.75573e-16 1 1 0.5 3: 1.98413e-14 2.48016e-15 2.75573e-16 1 1 4: 1.38889e-13 1.98413e-14 2.48016e-15 2.75573e-16 1 5: 8.33333e-13 1.38889e-13 1.98413e-14 2.48016e-15 2.75573e-16 6: 4.16667e-12 8.33333e-13 1.38889e-13 1.98413e-14 2.48016e-15 7: 1.66667e-11 4.16667e-12 8.33333e-13 1.38889e-13 1.98413e-14 8: 5e-11 1.66667e-11 4.16667e-12 8.33333e-13 1.38889e-13 9: 1e-10 5e-11 1.66667e-11 4.16667e-12 8.33333e-13 Col: 5 6 7 8 9 Row 0: 0.00833333 0.00138889 0.000198413 2.48016e-05 2.75573e-06 1: 0.0416667 0.00833333 0.00138889 0.000198413 2.48016e-05 2: 0.166667 0.0416667 0.00833333 0.00138889 0.000198413 3: 0.5 0.166667 0.0416667 0.00833333 0.00138889 4: 1 0.5 0.166667 0.0416667 0.00833333 5: 1 1 0.5 0.166667 0.0416667 6: 2.75573e-16 1 1 0.5 0.166667 7: 2.48016e-15 2.75573e-16 1 1 0.5 8: 1.98413e-14 2.48016e-15 2.75573e-16 1 1 9: 1.38889e-13 1.98413e-14 2.48016e-15 2.75573e-16 1 Test #14 This is Moler's example. This badly scaled matrix caused problems for MATLAB's expm(). Matrix order N = 3 Matrix A: Col: 0 1 2 Row 0: 0 1e-08 0 1: -2.00667e+10 -3 2e+10 2: 66.6667 0 -66.6667 Exact Exponential exp(A): Col: 0 1 2 Row 0: 0.446849 1.54044e-09 0.462811 1: -5.74307e+06 -0.015283 -4.52654e+06 2: 0.447723 1.5427e-09 0.463481 TEST_MATRIX_EXPONENTIAL_TEST02: Retrieve the data for each matrix exponential test. Test #1 This matrix is diagonal. The diagonal entries are real. Matrix order N = 2 Matrix A: Col: 1 2 Row --- 1: 1 0 0 0 2: 0 0 2 0 Exact Exponential exp(A): Col: 1 2 Row --- 1: 2.71828 0 0 0 2: 0 0 7.38906 0 Test #2 This matrix is diagonal. The diagonal entries are pure imaginary. Matrix order N = 2 Matrix A: Col: 1 2 Row --- 1: 0 3 0 0 2: 0 0 0 -4 Exact Exponential exp(A): Col: 1 2 Row --- 1: -0.989992 0.14112 0 0 2: 0 0 -0.653644 0.756802 Test #3 This matrix is diagonal. The diagonal entries are complex. Matrix order N = 2 Matrix A: Col: 1 2 Row --- 1: 5 6 0 0 2: 0 0 7 -8 Exact Exponential exp(A): Col: 1 2 Row --- 1: 142.502 -41.4689 0 0 2: 0 0 -159.56 -1084.96 TEST_MATRIX_EXPONENTIAL_TEST: Normal end of execution. 23 April 2020 02:23:52 PM