# (Solved) : 4 20 Pts Implement Gauss Legendre Quadrature Rule N Nodes Computation Quadrature Nodes Wei Q40082658 . . .

$9.00

PYTHON PROGRAMMING HELP

4. (20 pts) Implement the Gauss-Legendre Quadrature rule with N nodes. For the computation of the quadrature nodes and weights of the Gauss-Legendre quadrature rule use the PYTHON module numpy. polynomial.legendre.leggauss. Test your function by showing its exactness is at least 1 for N = 1 and one interval: 2xdx = 1 exactly. If the exactness is not at least 1, fix your code – Fill in the following table by computing the integrals over (0, 1] of the indicated integrands using your code. It is given that the degree of exactness of the method is 2N – 1 Error for N =2 Error for N = 3 f 3×2 4r3 5×4 6×5 7×6 Degree 3 – Get accuracy estimates of the integral of the Runge function over the interval -5,5) Recall that the exact answer is 2 arctan(5). Fill in the following table: N Gauss-Legendre Result Error 3 7 11 15 You might be surprised at how much better Gauss-Legendre integration is than the other methods, using a single interval. There is a similar advantage for composite integration but it is hard to see for small N. When Gauss-Legendre integration is used in a computer program, it is generally in the form of a composite formulation because it is difficult to compute the weights and integration points accurately for high order Gauss-Legendre ntegration Show transcribed image text 4. (20 pts) Implement the Gauss-Legendre Quadrature rule with N nodes. For the computation of the quadrature nodes and weights of the Gauss-Legendre quadrature rule use the PYTHON module numpy. polynomial.legendre.leggauss. Test your function by showing its exactness is at least 1 for N = 1 and one interval: 2xdx = 1 exactly. If the exactness is not at least 1, fix your code – Fill in the following table by computing the integrals over (0, 1] of the indicated integrands using your code. It is given that the degree of exactness of the method is 2N – 1 Error for N =2 Error for N = 3 f 3×2 4r3 5×4 6×5 7×6 Degree 3 – Get accuracy estimates of the integral of the Runge function over the interval -5,5) Recall that the exact answer is 2 arctan(5). Fill in the following table: N Gauss-Legendre Result Error 3 7 11 15 You might be surprised at how much better Gauss-Legendre integration is than the other methods, using a single interval. There is a similar advantage for composite integration but it is hard to see for small N. When Gauss-Legendre integration is used in a computer program, it is generally in the form of a composite formulation because it is difficult to compute the weights and integration points accurately for high order Gauss-Legendre ntegration

## Expert Answer

Answer to 4. (20 pts) Implement the Gauss-Legendre Quadrature rule with N nodes. For the computation of the quadrature nodes and w…