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 Clenshaw-Curtis quadrature
ResourceFunction["ClenshawCurtisQuadratureWeights"][n,{a,b}] gives a list of the n pairs {xi,wi} of the n-point Clenshaw-Curtis formula for quadrature on the interval a to b, where wi is the weight of the abscissa xi. | |
ResourceFunction["ClenshawCurtisQuadratureWeights"][n,{a,b},prec] uses the working precision prec. |
The abscissas and weights for a 10-point Clenshaw-Curtis quadrature on a given interval:
In[1]:= | ![]() |
Out[1]= | ![]() |
Use the specified precision:
In[2]:= | ![]() |
Out[2]= | ![]() |
Use Clenshaw-Curtis quadrature to approximate the area under a curve:
In[3]:= | ![]() |
Out[3]= | ![]() |
Plot the curve over a given interval:
In[4]:= | ![]() |
Out[4]= | ![]() |
Approximate the area under the curve using n-point Clenshaw-Curtis quadrature:
In[5]:= | ![]() |
In[6]:= | ![]() |
Out[6]= | ![]() |
Compare to the output of NIntegrate:
In[7]:= | ![]() |
Out[7]= | ![]() |
In[8]:= | ![]() |
Out[8]= | ![]() |
The abscissas of n-point Clenshaw-Curtis quadrature are the extrema of the Chebyshev polynomial Tn-1(x), along with the interval extrema ±1:
In[9]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[10]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License