03 March 2020 07:53:48 AM FEM1D_BVP_QUADRATIC_TEST C++ version Test the FEM1D_BVP_QUADRATIC library. TEST00 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A(X) = 1.0 C(X) = 1.0 F(X) = X U(X) = X - SINH(X) / SINH(1) Number of nodes = 11 I X U Uexact Error 0 0 2.91434e-16 0 2.91434e-16 1 0.1 0.0147663 0.0147663 4.25352e-08 2 0.2 0.0286795 0.0286795 5.71764e-08 3 0.3 0.0408783 0.0408782 1.36956e-07 4 0.4 0.0504833 0.0504834 1.01285e-07 5 0.5 0.0565908 0.0565906 2.60108e-07 6 0.6 0.0582598 0.0582599 1.18118e-07 7 0.7 0.0545078 0.0545074 4.3346e-07 8 0.8 0.0442944 0.0442945 9.11125e-08 9 0.9 0.026519 0.0265183 6.8209e-07 10 1 0 0 0 l1 norm of error = 1.74804e-07 L2 norm of error = 3.87933e-05 Seminorm of error = 0.001502 Max norm of error = 7.64223e-05 TEST01 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A1(X) = 1.0 C1(X) = 0.0 F1(X) = X * ( X + 3 ) * exp ( X ) U1(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 -5.55112e-16 0 5.55112e-16 1 0.1 0.0994734 0.0994654 8.05308e-06 2 0.2 0.195424 0.195424 1.06371e-09 3 0.3 0.283482 0.28347 1.1505e-05 4 0.4 0.358038 0.358038 1.73068e-09 5 0.5 0.412197 0.41218 1.62001e-05 6 0.6 0.437309 0.437309 1.88347e-09 7 0.7 0.422911 0.422888 2.25438e-05 8 0.8 0.356087 0.356087 1.37113e-09 9 0.9 0.221395 0.221364 3.10661e-05 10 1 0 0 0 l1 norm of error = 8.12492e-06 L2 norm of error = 0.000475788 Seminorm of error = 0.0183976 Max norm of error = 0.00128552 TEST02 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A2(X) = 1.0 C2(X) = 2.0 F2(X) = X * ( 5 - X ) * exp ( X ) U2(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 1.249e-15 0 1.249e-15 1 0.1 0.0994709 0.0994654 5.50166e-06 2 0.2 0.195419 0.195424 5.0882e-06 3 0.3 0.283475 0.28347 4.73316e-06 4 0.4 0.358029 0.358038 8.49604e-06 5 0.5 0.412187 0.41218 7.16298e-06 6 0.6 0.437299 0.437309 9.62545e-06 7 0.7 0.422902 0.422888 1.40319e-05 8 0.8 0.356079 0.356087 7.3847e-06 9 0.9 0.221392 0.221364 2.72862e-05 10 1 0 0 0 l1 norm of error = 8.11911e-06 L2 norm of error = 0.000475222 Seminorm of error = 0.0183976 Max norm of error = 0.00128743 TEST03 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A3(X) = 1.0 C3(X) = 2.0 * X F3(X) = - X * ( 2 * X * X - 3 * X - 3 ) * exp ( X ) U3(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 1.38778e-16 0 1.38778e-16 1 0.1 0.0994722 0.0994654 6.78361e-06 2 0.2 0.195422 0.195424 2.63832e-06 3 0.3 0.283478 0.28347 7.8112e-06 4 0.4 0.358033 0.358038 4.90736e-06 5 0.5 0.412191 0.41218 1.07886e-05 6 0.6 0.437302 0.437309 6.15514e-06 7 0.7 0.422905 0.422888 1.70217e-05 8 0.8 0.356081 0.356087 5.21325e-06 9 0.9 0.221393 0.221364 2.86415e-05 10 1 0 0 0 l1 norm of error = 8.17824e-06 L2 norm of error = 0.000475415 Seminorm of error = 0.0183976 Max norm of error = 0.00128668 TEST04 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A4(X) = 1.0 + X * X C4(X) = 0.0 F4(X) = ( X + 3 X^2 + 5 X^3 + X^4 ) * exp ( X ) U4(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 1.63758e-15 0 1.63758e-15 1 0.1 0.0994768 0.0994654 1.13792e-05 2 0.2 0.195421 0.195424 3.92651e-06 3 0.3 0.283499 0.28347 2.8503e-05 4 0.4 0.35803 0.358038 7.91252e-06 5 0.5 0.412238 0.41218 5.81535e-05 6 0.6 0.437299 0.437309 9.79047e-06 7 0.7 0.42299 0.422888 0.000102429 8 0.8 0.356079 0.356087 7.58261e-06 9 0.9 0.221528 0.221364 0.000163419 10 1 0 0 0 l1 norm of error = 3.5736e-05 L2 norm of error = 0.00047883 Seminorm of error = 0.018419 Max norm of error = 0.00137041 TEST05 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A5(X) = 1.0 + X * X for X <= 1/3 = 7/9 + X for 1/3 < X C5(X) = 0.0 F5(X) = ( X + 3 X^2 + 5 X^3 + X^4 ) * exp ( X ) for X <= 1/3 = ( - 1 + 10/3 X + 43/9 X^2 + X^3 ) .* exp ( X ) for 1/3 <= X U5(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 1.94289e-16 0 1.94289e-16 1 0.1 0.0996896 0.0994654 0.000224195 2 0.2 0.195842 0.195424 0.000417557 3 0.3 0.284132 0.28347 0.000661161 4 0.4 0.358565 0.358038 0.000526847 5 0.5 0.412668 0.41218 0.000487695 6 0.6 0.437633 0.437309 0.000324708 7 0.7 0.423209 0.422888 0.000321354 8 0.8 0.356238 0.356087 0.000151286 9 0.9 0.22155 0.221364 0.000185962 10 1 0 0 0 l1 norm of error = 0.000300069 L2 norm of error = 0.000628343 Seminorm of error = 0.0184672 Max norm of error = 0.0014469 TEST06 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A6(X) = 1.0 C6(X) = 0.0 F6(X) = pi*pi*sin(pi*X) U6(X) = sin(pi*x) Compute L2 norm and seminorm of error for various N. N l1 error L2 error Seminorm error Maxnorm error 11 2.3654e-05 0.000838808 0.0325225 0.00183654 21 1.54072e-06 0.000105326 0.0081608 0.000239035 41 9.85135e-08 1.31807e-05 0.00204209 3.01793e-05 81 6.23112e-09 1.64806e-06 0.00051064 3.78181e-06 161 3.91905e-10 2.06021e-07 0.000127667 4.7302e-07 TEST07 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. Becker/Carey/Oden example Compute L2 norm and seminorm of error for various N. N l1 error L2 error Seminorm error Maxnorm error 11 0.0236359 0.0698852 0.278261 1.72248 21 0.00526296 0.0175705 0.0869379 0.975957 41 0.000771555 0.00366719 0.0260734 0.502186 81 5.37619e-05 0.000407677 0.00399866 0.119887 161 3.21083e-06 4.76744e-05 0.000543592 0.0291324 TEST08 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A8(X) = 1.0 C8(X) = 0.0 F8(X) = X * ( X + 3 ) * exp ( X ), X <= 2/3 = 2 * exp ( 2/3), 2/3 < X U8(X) = X * ( 1 - X ) * exp ( X ), X <= 2/3 = X * ( 1 - X ) * exp ( 2/3 ), 2/3 < X Number of nodes = 11 I X U Uexact Error 0 0 3.05311e-16 0 3.05311e-16 1 0.1 0.0846356 0.0994654 0.0148298 2 0.2 0.165749 0.195424 0.0296757 3 0.3 0.238968 0.28347 0.0445021 4 0.4 0.298686 0.358038 0.0593515 5 0.5 0.338007 0.41218 0.0741731 6 0.6 0.348281 0.437309 0.0890272 7 0.7 0.319995 0.409024 0.0890287 8 0.8 0.252243 0.311637 0.0593949 9 0.9 0.145599 0.175296 0.0296975 10 1 0 0 0 l1 norm of error = 0.0445164 L2 norm of error = 0.0569727 Seminorm of error = 0.212209 Max norm of error = 0.0967138 TEST09 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A9(X) = 1.0 C9(X) = 0.0 F9(X) = X * ( X + 3 ) * exp ( X ), X <= 2/3 = 2 * exp ( 2/3), 2/3 < X U9(X) = X * ( 1 - X ) * exp ( X ), X <= 2/3 = X * ( 1 - X ) * exp ( 2/3 ), 2/3 < X Number of nodes = 11 I X U Uexact Error 0 0 -5.82867e-16 0 5.82867e-16 1 0.1 0.0734466 0.0994654 0.0260188 2 0.2 0.143371 0.195424 0.0520536 3 0.3 0.205401 0.28347 0.0780689 4 0.4 0.253931 0.358038 0.104107 5 0.5 0.282062 0.41218 0.130118 6 0.6 0.281148 0.437309 0.156161 7 0.7 0.243386 0.21 0.0333861 8 0.8 0.181953 0.16 0.0219531 9 0.9 0.100977 0.09 0.0109765 10 1 0 0 0 l1 norm of error = 0.055713 L2 norm of error = 0.080793 Seminorm of error = 0.222691 Max norm of error = 0.17056 TEST10 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A(X) = 1.0 C(X) = 1.0 F(X) = X U(X) = X - SINH(X) / SINH(1) log(E) E L2error H1error Maxerror 0 2 0.00471405 0.0362083 0.00766215 1 4 0.000602037 0.00930851 0.00108553 2 8 7.57116e-05 0.00234472 0.000146767 3 16 9.47875e-06 0.000587307 1.91493e-05 4 32 1.18531e-06 0.000146898 2.44769e-06 5 64 1.48178e-07 3.67288e-05 3.09464e-07 6 128 1.85228e-08 9.18249e-06 3.89059e-08 log(E1) E1 / E2 L2rate H1rate Maxrate 0 2 / 4 2.96904 1.9597 2.81935 1 4 / 8 2.99127 1.98913 2.8868 2 8 / 16 2.99775 1.99723 2.93816 3 16 / 32 2.99943 1.9993 2.9678 4 32 / 64 2.99986 1.99983 2.98358 5 64 / 128 2.99996 1.99996 2.99171 Created graphics data file "data.txt". Created graphics command file "commands_l2.txt". Created graphics command file "commands_h1.txt". Created graphics command file "commands_mx.txt". FEM1D_BVP_QUADRATIC_TEST Normal end of execution. 03 March 2020 07:53:48 AM