(71B) Gauss-Chebyshev Quadrature - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (71B) Gauss-Chebyshev Quadrature (/thread-5739.html) |
(71B) Gauss-Chebyshev Quadrature - Namir - 02-22-2016 03:42 PM This is an HP-71B program that performs the Gauss-Chebyshev Quadrature for a function f(x). This algorithm is of teh same class as the Gauss-Legendre Qudrature, except calculating the roots of the Chebyshev polynomials is MUCH easier than calculating the roots of the Legendre polynomial. Thus, you can easily specify the number of points (which is also the order of the Chebyshev polynomial) used to calculate the integral. The program prompts you to enter A, B which define the integral limit and also prompts you for N the Chebyshev polynomial order (which is also the number of points used in the quadrature. The program displays the value of the integral, stored in variable R. The listing is: Code: 10 REM GAUSS-CHEBYSHEV QUADRATURE Line 1010 starts the calculation for the function f(x) which is stored in the variable F. Line 2010 is optional and allows you to calculate or assign the exact value of the integral and store it in the variable Y. The subroutine displays that value and also displays the % error. If calculating the exact integral is too difficult or not possible, then make line 2010 to simply contain a RETURN statement. Enjoy! Namir |