18 June 2014 08:01:42 AM FEM1D_BVP_QUADRATIC_PRB C++ version Test the FEM1D_BVP_QUADRATIC library. 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.93741e-05 L2 norm of error = 0.000475788 Seminorm of error = 0.0183976 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.93102e-05 L2 norm of error = 0.000475222 Seminorm of error = 0.0183976 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.99606e-05 L2 norm of error = 0.000475415 Seminorm of error = 0.0183976 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 = 0.000393096 L2 norm of error = 0.00047883 Seminorm of error = 0.018419 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.00330076 L2 norm of error = 0.000628343 Seminorm of error = 0.0184672 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 11 0.000260194 0.000838808 0.0325225 21 3.2355e-05 0.000105326 0.0081608 41 4.03905e-06 1.31807e-05 0.00204209 81 5.0472e-07 1.64806e-06 0.00051064 161 6.30967e-08 2.06021e-07 0.000127667 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 11 0.259994 0.0698852 1.72248 21 0.110522 0.0175705 0.975957 41 0.0316338 0.00366719 0.502186 81 0.00435471 0.000407677 0.119887 161 0.000516943 4.76744e-05 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.489681 L2 norm of error = 0.0569727 Seminorm of error = 0.212209 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.612843 L2 norm of error = 0.080793 Seminorm of error = 0.222691 FEM1D_BVP_QUADRATIC_PRB Normal end of execution. 18 June 2014 08:01:42 AM