19 January 2020 11:30:35 AM FEM1D_LAGRANGE_TEST C version. Test the FEM1D_LAGRANGE library. LEGENDRE_SET_TEST LEGENDRE_SET returns points and weights of Gauss-Legendre quadrature rules. N 1 X^4 Runge 1 2 0 2 2 2 0.222222 0.214286 3 2 0.4 0.958333 4 2 0.4 0.370927 5 2 0.4 0.706948 6 2 0.4 0.461701 7 2 0.4 0.616122 8 2 0.4 0.508122 9 2 0.4 0.578703 10 2 0.4 0.530372 LAGRANGE_VALUE_TEST LAGRANGE_VALUE evaluates the Lagrange basis polynomials. Lagrange basis points: 0: 0 1: 1 2: 2 3: 3 4: 4 I X L1(X) L2(X) L3(X) L4(X) L5(X) 0 0.0000 1.0000 0.0000 -0.0000 0.0000 -0.0000 1 0.5000 0.2734 1.0938 -0.5469 0.2188 -0.0391 2 1.0000 -0.0000 1.0000 0.0000 -0.0000 0.0000 3 1.5000 -0.0391 0.4688 0.7031 -0.1562 0.0234 4 2.0000 0.0000 -0.0000 1.0000 0.0000 -0.0000 5 2.5000 0.0234 -0.1562 0.7031 0.4688 -0.0391 6 3.0000 -0.0000 0.0000 -0.0000 1.0000 0.0000 7 3.5000 -0.0391 0.2188 -0.5469 1.0938 0.2734 8 4.0000 0.0000 -0.0000 0.0000 -0.0000 1.0000 LAGRANGE_DERIVATIVE_TEST LAGRANGE_DERIVATIVE evaluates the Lagrange basis derivative. Lagrange basis points: 0: 0 1: 1 2: 2 3: 3 4: 4 I X L1'(X) L2'(X) L3'(X) L4'(X) L5'(X) 0 0.0000 -2.0833 4.0000 -3.0000 1.3333 -0.2500 1 0.5000 -0.9167 0.7083 0.3750 -0.2083 0.0417 2 1.0000 -0.2500 -0.8333 1.5000 -0.5000 0.0833 3 1.5000 0.0417 -1.1250 1.1250 -0.0417 0.0000 4 2.0000 0.0833 -0.6667 0.0000 0.6667 -0.0833 5 2.5000 0.0000 0.0417 -1.1250 1.1250 -0.0417 6 3.0000 -0.0833 0.5000 -1.5000 0.8333 0.2500 7 3.5000 -0.0417 0.2083 -0.3750 -0.7083 0.9167 8 4.0000 0.2500 -1.3333 3.0000 -4.0000 2.0833 FEM1D_LAGRANGE_STIFFNESS_TEST FEM1D_LAGRANGE_STIFFNESS computes the stiffness matrix, the mass matrix, and right hand side vector for a finite element problem using Lagrange interpolation basis polynomials. Solving: -u''+u=x on 0 < x < 1 u(0) = u(1) = 0 Exact solution: u(x) = x - sinh(x)/sinh(1) Number of mesh points = 11 Number of quadrature points = 5 I X U U(exact) Error 0 0.0000 -1.73472e-15 0 1.73472e-15 1 0.1000 0.0956213 0.0147663 0.080855 2 0.2000 0.227141 0.0286795 0.198462 3 0.3000 0.25017 0.0408782 0.209292 4 0.4000 0.406593 0.0504834 0.35611 5 0.5000 0.5 0.0565906 0.443409 6 0.6000 0.498838 0.0582599 0.440578 7 0.7000 0.676584 0.0545074 0.622077 8 0.8000 0.74956 0.0442945 0.705265 9 0.9000 0.744763 0.0265183 0.718244 10 1.0000 0 0 0 FEM1D_LAGRANGE_STIFFNESS_TEST FEM1D_LAGRANGE_STIFFNESS computes the stiffness matrix, the mass matrix, and right hand side vector for a finite element problem using Lagrange interpolation basis polynomials. Solving: -u''+u=x on 0 < x < 1 u(0) = u(1) = 0 Exact solution: u(x) = x - sinh(x)/sinh(1) Number of mesh points = 11 Number of quadrature points = 10 I X U U(exact) Error 0 0.0000 -3.88578e-16 0 3.88578e-16 1 0.1000 0.0147663 0.0147663 2.02616e-15 2 0.2000 0.0286795 0.0286795 1.77081e-14 3 0.3000 0.0408782 0.0408782 2.08167e-15 4 0.4000 0.0504834 0.0504834 2.67286e-14 5 0.5000 0.0565906 0.0565906 1.07692e-14 6 0.6000 0.0582599 0.0582599 7.02216e-15 7 0.7000 0.0545074 0.0545074 2.06155e-14 8 0.8000 0.0442945 0.0442945 1.79717e-15 9 0.9000 0.0265183 0.0265183 4.80171e-15 10 1.0000 0 0 0 FEM1D_LAGRANGE_TEST Normal end of execution. 19 January 2020 11:30:35 AM