






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Gauss quadrature, a method for numerical integration that chooses nodes and weights to make the formula exact for a polynomial of maximum degree. The document also covers composite quadrature formulas, which approximate integrals by approximating each integral with a low degree quadrature formula. Examples and explanations of the gauss-legendre quadrature formulas, composite midpoint rule, composite trapezoidal rule, and composite simpson's rule. Matlab's functions for numerical integration, quad and trapz, are also mentioned.
Typology: Study notes
1 / 12
This page cannot be seen from the preview
Don't miss anything!
Dmitriy Leykekhman
Spring 2009
I (^) Gauss Quadrature.
I (^) Composite Quadrature Formulas.
I (^) MATLAB’s Functions.
I (^) Idea of the Gauss Quadrature is to choose nodes x 0 ,... , xn and the weights w 0 ,... , wn such that the formula ∫ (^) b
a
p(x) dx ≈
∑^ n
i=
wip(xi).
is exact for a polynomial of maximum degree.
There is no choice of nodes x 0 ,... , xn and weights w 0 ,... , wn such that ∫ (^) b
a
pN (x) dx ≈
∑^ n
i=
wipN (xi).
for all polynomials pN of degree less or equal to N if N > 2 n + 1. I (^) The above lemma give an upper bound on the maximum degree.
Let’s force the formula to be exact for 1 , x, x^2 , and x^3. This gives us
w 1 + w 2 =
− 1
1 dx = 2
w 1 x 1 + w 2 x 2 =
− 1
x dx = 0
w 1 x^21 + w 2 x^22 =
− 1
x^2 dx =
w 1 x^31 + w 2 x^32 =
− 1
x^3 dx = 0.
a nonlinear system of 4 equations with for unknowns. Usually we need a nonlinear solver to solve nonlinear systems, but in this example we can solve it analytically to obtain
w 1 = w 2 = 1, x 1 = −
, x 2 =
The weights and nodes for the first 3 Gauss-Legendre formulas on [− 1 , 1]. xi wi exact for pN ,
− √^13 , √^13 1,1 N = 3
3 5 ,^0 ,
3 5
5 9 ,^
8 9 ,^
5 9 N^ = 5
-0. -0.
∫ (^) b
a
f (x)dx ≈
n∑− 1
i=
(xi+1 − xi)f
xi+1 + xi 2
∫ (^) b
a
f (x)dx ≈
n∑− 1
i=
xi+1 − xi 2
(f (xi+1) + f (xi))
The function values f (x 1 ), f (x 2 ),... , f (xn− 1 ) appear twice in the summation. This has to be utilized in the implementation of the composite Trapezoidal rule: ∫ (^) b
a
f (x)dx ≈ x 1 − x 0 2
f (x 0 )
n∑− 1
i=
xi − xi− 1 2
xi+1 − xi 2
f (xi)
xn − xn− 1 2
f (xn)
MATLAB has several build in functions for numerical integration. We will mention a couple quad and trapz. You can get more information by typing
help quad help trapz
The syntax for quad
QUAD Numerically evaluate integral, adaptive Simpson quadrature.
Q = QUAD(FUN,A,B) tries to approximate the integral of scalar-valued function FUN from A to B to within an error of 1.e-6 using recursive adaptive Simpson quadrature.
FUN is a function handle.
The function Y=FUN(X) should accept a vector argument X and return a vector result Y, the integrand evaluated at each element of X.