07-Jan-2022 19:59:35 fem1d_lagrange_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test fem1d_lagrange(). 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: 1: 0 2: 1 3: 2 4: 3 5: 4 I X L1(X) L2(X) L3(X) L4(X) L5(X) 1 0.000000 1.000000 0.000000 -0.000000 0.000000 -0.000000 2 0.500000 0.273438 1.093750 -0.546875 0.218750 -0.039062 3 1.000000 -0.000000 1.000000 0.000000 -0.000000 0.000000 4 1.500000 -0.039062 0.468750 0.703125 -0.156250 0.023438 5 2.000000 0.000000 -0.000000 1.000000 0.000000 -0.000000 6 2.500000 0.023438 -0.156250 0.703125 0.468750 -0.039062 7 3.000000 -0.000000 0.000000 -0.000000 1.000000 0.000000 8 3.500000 -0.039062 0.218750 -0.546875 1.093750 0.273438 9 4.000000 0.000000 -0.000000 0.000000 -0.000000 1.000000 LAGRANGE_DERIVATIVE_TEST LAGRANGE_DERIVATIVE evaluates the Lagrange basis derivatives. Lagrange basis points: 1: 0 2: 1 3: 2 4: 3 5: 4 I X L1'(X) L2'(X) L3'(X) L4'(X) L5'(X) 1 0.000000 -2.083333 4.000000 -3.000000 1.333333 -0.250000 2 0.500000 -0.916667 0.708333 0.375000 -0.208333 0.041667 3 1.000000 -0.250000 -0.833333 1.500000 -0.500000 0.083333 4 1.500000 0.041667 -1.125000 1.125000 -0.041667 0.000000 5 2.000000 0.083333 -0.666667 0.000000 0.666667 -0.083333 6 2.500000 0.000000 0.041667 -1.125000 1.125000 -0.041667 7 3.000000 -0.083333 0.500000 -1.500000 0.833333 0.250000 8 3.500000 -0.041667 0.208333 -0.375000 -0.708333 0.916667 9 4.000000 0.250000 -1.333333 3.000000 -4.000000 2.083333 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) The mesh used 11 points. Quadrature uses 5 points. I X U U(exact) Error 1 0.0000 -1.86566e-16 0 1.86566e-16 2 0.1000 0.0956213 0.0147663 0.080855 3 0.2000 0.227141 0.0286795 0.198462 4 0.3000 0.25017 0.0408782 0.209292 5 0.4000 0.406593 0.0504834 0.35611 6 0.5000 0.5 0.0565906 0.443409 7 0.6000 0.498838 0.0582599 0.440578 8 0.7000 0.676584 0.0545074 0.622077 9 0.8000 0.74956 0.0442945 0.705265 10 0.9000 0.744763 0.0265183 0.718244 11 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) The mesh used 11 points. Quadrature uses 10 points. I X U U(exact) Error 1 0.0000 3.05531e-16 0 3.05531e-16 2 0.1000 0.0147663 0.0147663 3.17454e-16 3 0.2000 0.0286795 0.0286795 1.30937e-14 4 0.3000 0.0408782 0.0408782 9.8116e-15 5 0.4000 0.0504834 0.0504834 1.62856e-14 6 0.5000 0.0565906 0.0565906 1.249e-16 7 0.6000 0.0582599 0.0582599 1.52864e-14 8 0.7000 0.0545074 0.0545074 1.4766e-14 9 0.8000 0.0442945 0.0442945 5.98827e-15 10 0.9000 0.0265183 0.0265183 2.97679e-15 11 1.0000 0 0 0 fem1d_lagrange_test() Normal end of execution. 07-Jan-2022 19:59:35