Computing Integral with Gauss-Chebyshev Quadrature in MATLAB

In summary, the conversation is about finding a program to compute an integral using the Gauss-Chebyshev quadrature method in MATLAB. The formula for integration points and weights is provided in two sources and there is also a MATLAB code available. The person asking for help shares their own MATLAB code and asks for confirmation on its correctness. They also ask for suggestions on how to compute a specific integral with a desired accuracy.
  • #1
Fidelio
3
0
Hello, anyone knows where y can find a program to compute the integral

∫ ( from -1 to 1) f(x)/ √(1-x^2) using the Gauss-Chebyshev quadrature, on matlab?

Thanks!
 
Physics news on Phys.org
  • #3
thanks so much AlephZero,

Could you check If it is correct ?

function int = chebquad(funct,accuracy)
f = inline(funct);
old_int = inf;
for n=1:1000

x = cos(((2*(1:n) - 1)/(2*n))*pi);
w = pi/n;
fx = f(x);
int = sum(w.*fx);
if abs(int_old-int) < abs(tol*int),
converge='y';
break;
end
old_int = int;
end

And now If I want to compute this integral [tex] \int_1^2 dx \frac { e^{2x} }{ ( (2-x) ( (1-x))^{1/2} } [/tex] with an accuracy 10^-8 what could I do?
 

Related to Computing Integral with Gauss-Chebyshev Quadrature in MATLAB

1. What is Gauss-Chebyshev quadrature?

Gauss-Chebyshev quadrature is a numerical method used for approximating integrals. It uses a specific set of points, known as Chebyshev nodes, to evaluate the integral and provide a more accurate result compared to other methods.

2. How does Gauss-Chebyshev quadrature work in MATLAB?

In MATLAB, Gauss-Chebyshev quadrature can be implemented using the chebpts function, which generates the Chebyshev nodes needed for the approximation. These nodes are then used in conjunction with the chebfun function to evaluate and compute the integral.

3. What are the advantages of using Gauss-Chebyshev quadrature in MATLAB?

One advantage of using Gauss-Chebyshev quadrature in MATLAB is that it can provide highly accurate results for a wide range of integrals, including those with singularities or near-endpoint singularities. Additionally, the method is relatively efficient and can handle integrals with a large number of points.

4. Are there any limitations to using Gauss-Chebyshev quadrature in MATLAB?

One limitation of using Gauss-Chebyshev quadrature in MATLAB is that it may not be suitable for integrals with highly oscillatory functions. In these cases, other numerical methods may be more effective. Additionally, the accuracy of the results may be affected by the number of Chebyshev nodes used, so it may require some trial and error to find the optimal number of nodes for a specific integral.

5. Can Gauss-Chebyshev quadrature be used for higher-dimensional integrals in MATLAB?

Yes, Gauss-Chebyshev quadrature can be extended to handle higher-dimensional integrals in MATLAB. This can be achieved using the tensorprod function, which combines the 1D Chebyshev nodes into a multidimensional grid. However, the accuracy and efficiency of the method may decrease as the dimensionality of the integral increases.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
955
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
260
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
Back
Top