quadGaussJacobi


Untitled

Gauss-Jacobi quadrature weights and points

Syntax

Q = quadGaussJacobi(n,alpha,beta)

Description

Q = quadGaussJacobi(n,alpha,beta), where n is a positive integer and alpha and beta are real constants > -1, returns the n-point, (alpha,beta)-weighted Gauss–Jacobi quadrature rule Q as a stucture with fields Q.Points and Q.Weights, which store the n points (in ascending order) and corresponding weights, respectively, of the quadrature rule. An additional field, Q.Properties, stores the degree, type and interval, or domain, of the quadrature rule in subfields .Degree, .Type and .Domain, respectively.
Note: An n-point Gauss–Jacobi quadrature rule is of degree 2n-1, that is, it integrates all polynomial up to degree 2n-1 exactly.

Examples

Example 1 The general form of GaussJacobi quadrature and its equivalence to Gauss-Legendre quadrature for
Gauss–Jacobi quadrature can be used to compute integrals of the form
where α and β are real constants , which define the weight function , and where is a smooth function on the interval . This is accomplished via a weighted sum of function evaluations, i.e.,
where and are the sets of quadrature weights and points, respectively. In the case when is a polynomial of degree d, the equation can be made exact with a sufficient number of weights and points n. Specifically, an n-point Gauss–Jacobi quadrature can integrate all polynomials of degree exactly.
Gauss–Jacobi quadrature is the general form of quadrature that gives rise to special cases of other Gauss quadrature rules associated with specific weight functions defined by the choice of . For example, results in a weight function of and gives rise to the “standard” Gauss, or Gauss–Legendre, quadrature rules for computing integrals of the form
For example, suppose , i.e.,
f = @(x)x.^4;
This can be integrated exactly using a 3-point Gauss–Jacobi quadrature rule specified by
Q = quadGaussJacobi(3,0,0)
Q = struct with fields:
Points: [3×1 double]
Weights: [3×1 double]
Properties: [1×1 struct]
Note that the Q.Properties field contains the subfields:
Q.Properties
ans = struct with fields:
Degree: 5
Type: ‘Gauss-Legendre’
Domain: [-1 1]
which describe the degree, type and domain of the quadrature rule. Now, applying the quadrature rule, we find
I = dot(Q.Weights,f(Q.Points))
I = 0.4000
which is exact and equivalent to what would be obtained using quadGaussLegendre(3).
Another special case of Gauss–Jacobi quadrature includes Gauss–Chebyshev (type 1) quadrature associated with the choice (see Example 2 below).
Example 2 Using Gauss-Jacobi quadrature to integrate a non-polynomial function exactly
Gauss–Jacobi quadrature can be used to integrate (some) non-polynomial functions exactly. Consider, for example, the integral
Note that the factor is equivalent to the weight function with , i.e.,
As demonstrated above, the remaining polynomial term, , requires points to be integrated exactly. Thus, obtaining the following Gauss–Jacobi quadrature rule
Q = quadGaussJacobi(3,-1/2,-1/2)
Q = struct with fields:
Points: [3×1 double]
Weights: [3×1 double]
Properties: [1×1 struct]
the integral can be computed to be
IQ = dot(Q.Weights,f(Q.Points))
IQ = 1.1781
Symbolically integrating and converting the result to a double, it is found
syms x
IS = double(int(x^4/(sqrt(1-x^2)),x,-1,1))
IS = 1.1781
which is equal to IQ. This particular type of Gauss–Jacobi quadrature rule, i.e., , is also referred to as a Gauss–Chebyshev (type 1) quadrature rule.

This function is part of……..