Fri Apr 3 18:01:27 2026 fem1d_lagrange_test(): numpy version: 1.26.4 python version: 3.10.12 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: array([0., 1., 2., 3., 4.]) I X L1(X) L2(X) L3(X) L4(X) L5(X) 0 0.000000 1.000000 0.000000 -0.000000 0.000000 -0.000000 1 0.500000 0.273438 1.093750 -0.546875 0.218750 -0.039062 2 1.000000 -0.000000 1.000000 0.000000 -0.000000 0.000000 3 1.500000 -0.039062 0.468750 0.703125 -0.156250 0.023438 4 2.000000 0.000000 -0.000000 1.000000 0.000000 -0.000000 5 2.500000 0.023438 -0.156250 0.703125 0.468750 -0.039062 6 3.000000 -0.000000 0.000000 -0.000000 1.000000 0.000000 7 3.500000 -0.039062 0.218750 -0.546875 1.093750 0.273438 8 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: array([0., 1., 2., 3., 4.]) I X L1'(X) L2'(X) L3'(X) L4'(X) L5'(X) 0 0.000000 -2.083333 4.000000 -3.000000 1.333333 -0.250000 1 0.500000 -0.916667 0.708333 0.375000 -0.208333 0.041667 2 1.000000 -0.250000 -0.833333 1.500000 -0.500000 0.083333 3 1.500000 0.041667 -1.125000 1.125000 -0.041667 0.000000 4 2.000000 0.083333 -0.666667 0.000000 0.666667 -0.083333 5 2.500000 0.000000 0.041667 -1.125000 1.125000 -0.041667 6 3.000000 -0.083333 0.500000 -1.500000 0.833333 0.250000 7 3.500000 -0.041667 0.208333 -0.375000 -0.708333 0.916667 8 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 15 points. I X U U(exact) Error 0 0.0000 -4.56755e-15 0 4.56755e-15 1 0.1000 0.0147663 0.0147663 1.30711e-14 2 0.2000 0.0286795 0.0286795 4.26707e-14 3 0.3000 0.0408782 0.0408782 3.85872e-14 4 0.4000 0.0504834 0.0504834 7.94156e-14 5 0.5000 0.0565906 0.0565906 7.03118e-14 6 0.6000 0.0582599 0.0582599 5.26662e-14 7 0.7000 0.0545074 0.0545074 7.00065e-14 8 0.8000 0.0442945 0.0442945 3.00246e-14 9 0.9000 0.0265183 0.0265183 2.14585e-14 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) The mesh used 21 points. Quadrature uses 15 points. I X U U(exact) Error 0 0.0000 -8.14018e-13 0 8.14018e-13 1 0.0500 0.00743636 0.00743636 3.9636e-09 2 0.1000 0.0147663 0.0147663 4.18218e-09 3 0.1500 0.0218831 0.0218831 3.14437e-09 4 0.2000 0.0286795 0.0286795 1.64773e-08 5 0.2500 0.0350476 0.0350476 4.55208e-09 6 0.3000 0.0408782 0.0408782 2.37154e-08 7 0.3500 0.0460608 0.0460608 1.83813e-09 8 0.4000 0.0504834 0.0504834 2.79553e-08 9 0.4500 0.054032 0.054032 4.15014e-09 10 0.5000 0.0565906 0.0565906 1.6532e-08 11 0.5500 0.0580403 0.0580403 2.2107e-09 12 0.6000 0.0582599 0.0582599 8.82583e-09 13 0.6500 0.0571249 0.0571249 3.6631e-09 14 0.7000 0.0545074 0.0545074 1.85606e-09 15 0.7500 0.0502758 0.0502758 1.41444e-09 16 0.8000 0.0442945 0.0442945 3.60642e-09 17 0.8500 0.0364236 0.0364236 1.72987e-09 18 0.9000 0.0265183 0.0265183 2.76425e-09 19 0.9500 0.0144289 0.0144289 2.35084e-09 20 1.0000 0 0 0 fem1d_lagrange_test(): Normal end of execution. Fri Apr 3 18:01:27 2026