Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get a numerically sorted list of abscissa-weight pairs for various modifications of Gaussian quadrature
ResourceFunction["ModifiedGaussianQuadratureWeights"][type,n] gives a list of the n pairs {xi,wi} of the n-point modified Gaussian formula for quadrature on the interval -1 to 1, where wi is the weight of the abscissa xi. | |
ResourceFunction["ModifiedGaussianQuadratureWeights"][type,n,{a,b}] rescales the Gaussian formula for the interval a to b. | |
ResourceFunction["ModifiedGaussianQuadratureWeights"][type,n,{a,b},prec] uses the working precision prec. |
"AntiGaussian" | Laurie's anti-Gaussian quadrature formula |
"Lobatto" | Gauss–Lobatto quadrature with both endpoints fixed, |
"RadauLeft" | Gauss–Radau quadrature with left endpoint fixed, |
"RadauRight" | Gauss–Radau quadrature with right endpoint fixed, |
The abscissas and weights for a 10-point Lobatto quadrature rule:
In[1]:= |
Out[1]= |
Lobatto quadrature rule over the interval 0 to 1:
In[2]:= |
Out[2]= |
Use the specified precision:
In[3]:= |
Out[3]= |
The abscissas and weights for a 10-point anti-Gaussian rule:
In[4]:= |
Out[4]= |
The "RadauLeft" and "RadauRight" rules are basically reflections of each other over the integration interval:
In[5]:= |
Out[5]= |
In[6]:= |
Out[6]= |
Use the modified Gaussian quadrature to approximate the area under a curve:
In[7]:= |
Compare the results of the various modifications with classical Gaussian quadrature for a fixed n:
In[8]:= |
Out[8]= |
Compare with the result of NIntegrate by computing the absolute error:
In[9]:= |
Out[9]= |
This work is licensed under a Creative Commons Attribution 4.0 International License