How to resolve the algorithm Numerical integration/Gauss-Legendre Quadrature step by step in the Phix programming language
How to resolve the algorithm Numerical integration/Gauss-Legendre Quadrature step by step in the Phix programming language
Table of Contents
Problem Statement
For this, we first need to calculate the nodes and the weights, but after we have them, we can reuse them for numerious integral evaluations, which greatly speeds up the calculation compared to more simple numerical integration methods.
Task description Similar to the task Numerical Integration, the task here is to calculate the definite integral of a function
f ( x )
{\displaystyle f(x)}
, but by applying an n-point Gauss-Legendre quadrature rule, as described here, for example. The input values should be an function f to integrate, the bounds of the integration interval a and b, and the number of gaussian evaluation points n. An reference implementation in Common Lisp is provided for comparison. To demonstrate the calculation, compute the weights and nodes for an 5-point quadrature rule and then use them to compute:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Numerical integration/Gauss-Legendre Quadrature step by step in the Phix programming language
Source code in the phix programming language
You may also check:How to resolve the algorithm Kosaraju step by step in the Sidef programming language
You may also check:How to resolve the algorithm Semiprime step by step in the Seed7 programming language
You may also check:How to resolve the algorithm Singly-linked list/Element definition step by step in the Clean programming language
You may also check:How to resolve the algorithm Dragon curve step by step in the M4 programming language
You may also check:How to resolve the algorithm Color quantization step by step in the Perl programming language